summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Yin <steve_y@apache.org>2013-11-14 08:18:05 +0000
committerDavid Tardon <dtardon@redhat.com>2013-11-16 14:29:36 +0100
commitf64d6b750388b3af2649f30e0aec81c24ce32e58 (patch)
tree2480f704d8f55cf977d15261dd0a535951c4bf15
parent49ca17de76ba4a6396b9207a82d460cbae7c6d53 (diff)
Integrate branch of IAccessible2
Just the winaccessibility directory initially. Change-Id: Ia21abb8d7088646ad6c1f83b3a03e7add716b0c0
-rw-r--r--winaccessibility/inc/AccComponentEventListener.hxx78
-rw-r--r--winaccessibility/inc/AccContainerEventListener.hxx98
-rw-r--r--winaccessibility/inc/AccDescendantManagerEventListener.hxx64
-rw-r--r--winaccessibility/inc/AccDialogEventListener.hxx63
-rw-r--r--winaccessibility/inc/AccEventListener.hxx90
-rw-r--r--winaccessibility/inc/AccFrameEventListener.hxx63
-rw-r--r--winaccessibility/inc/AccListEventListener.hxx54
-rw-r--r--winaccessibility/inc/AccMenuEventListener.hxx57
-rw-r--r--winaccessibility/inc/AccObject.hxx130
-rw-r--r--winaccessibility/inc/AccObjectContainerEventListener.hxx50
-rw-r--r--winaccessibility/inc/AccObjectManagerAgent.hxx102
-rw-r--r--winaccessibility/inc/AccObjectWinManager.hxx177
-rw-r--r--winaccessibility/inc/AccParagraphEventListener.hxx62
-rw-r--r--winaccessibility/inc/AccResource.hxx69
-rw-r--r--winaccessibility/inc/AccTableEventListener.hxx53
-rw-r--r--winaccessibility/inc/AccTextComponentEventListener.hxx48
-rw-r--r--winaccessibility/inc/AccTopWindowListener.hxx66
-rw-r--r--winaccessibility/inc/AccTreeEventListener.hxx50
-rw-r--r--winaccessibility/inc/AccWindowEventListener.hxx60
-rw-r--r--winaccessibility/inc/ResIDGenerator.hxx56
-rw-r--r--winaccessibility/inc/UAccCOM2.h30
-rw-r--r--winaccessibility/inc/accHelper.hxx145
-rw-r--r--winaccessibility/inc/act.hxx90
-rw-r--r--winaccessibility/inc/g_msacc.hxx27
-rw-r--r--winaccessibility/inc/unomsaaevent.hxx110
-rw-r--r--winaccessibility/source/UAccCOM/AccAction.cxx120
-rw-r--r--winaccessibility/source/UAccCOM/AccAction.h105
-rw-r--r--winaccessibility/source/UAccCOM/AccAction.rgs26
-rw-r--r--winaccessibility/source/UAccCOM/AccActionBase.cxx416
-rw-r--r--winaccessibility/source/UAccCOM/AccActionBase.h92
-rw-r--r--winaccessibility/source/UAccCOM/AccComponent.cxx72
-rw-r--r--winaccessibility/source/UAccCOM/AccComponent.h97
-rw-r--r--winaccessibility/source/UAccCOM/AccComponent.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccComponentBase.cxx213
-rw-r--r--winaccessibility/source/UAccCOM/AccComponentBase.h78
-rw-r--r--winaccessibility/source/UAccCOM/AccContext.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccEditableText.cxx508
-rw-r--r--winaccessibility/source/UAccCOM/AccEditableText.h115
-rw-r--r--winaccessibility/source/UAccCOM/AccEditableText.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccExtendedComponent.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccFont.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccHyperLink.cxx296
-rw-r--r--winaccessibility/source/UAccCOM/AccHyperLink.h140
-rw-r--r--winaccessibility/source/UAccCOM/AccHyperLink.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccHypertext.cxx409
-rw-r--r--winaccessibility/source/UAccCOM/AccHypertext.h161
-rw-r--r--winaccessibility/source/UAccCOM/AccHypertext.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccImage.cxx102
-rw-r--r--winaccessibility/source/UAccCOM/AccImage.h101
-rw-r--r--winaccessibility/source/UAccCOM/AccImage.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccKeyBinding.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccRelation.cxx214
-rw-r--r--winaccessibility/source/UAccCOM/AccRelation.h88
-rw-r--r--winaccessibility/source/UAccCOM/AccRelation.rgs25
-rw-r--r--winaccessibility/source/UAccCOM/AccSelection.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccTable.cxx1069
-rw-r--r--winaccessibility/source/UAccCOM/AccTable.h175
-rw-r--r--winaccessibility/source/UAccCOM/AccTable.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccText.cxx282
-rw-r--r--winaccessibility/source/UAccCOM/AccText.h140
-rw-r--r--winaccessibility/source/UAccCOM/AccText.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccTextBase.cxx995
-rw-r--r--winaccessibility/source/UAccCOM/AccTextBase.h122
-rw-r--r--winaccessibility/source/UAccCOM/AccValue.cxx224
-rw-r--r--winaccessibility/source/UAccCOM/AccValue.h104
-rw-r--r--winaccessibility/source/UAccCOM/AccValue.rgs23
-rw-r--r--winaccessibility/source/UAccCOM/AccessibleKeyStroke.h157
-rw-r--r--winaccessibility/source/UAccCOM/CheckEnableAccessible.cxx35
-rw-r--r--winaccessibility/source/UAccCOM/CheckEnableAccessible.h30
-rw-r--r--winaccessibility/source/UAccCOM/EnumVariant.cxx227
-rw-r--r--winaccessibility/source/UAccCOM/EnumVariant.h106
-rw-r--r--winaccessibility/source/UAccCOM/EnumVariant.rgs26
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.cxx3267
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.h294
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.rgs26
-rw-r--r--winaccessibility/source/UAccCOM/Resource.h70
-rw-r--r--winaccessibility/source/UAccCOM/StdAfx.cxx29
-rw-r--r--winaccessibility/source/UAccCOM/UAccCOM.cxx109
-rw-r--r--winaccessibility/source/UAccCOM/UAccCOM.def7
-rw-r--r--winaccessibility/source/UAccCOM/UAccCOM.rc149
-rw-r--r--winaccessibility/source/UAccCOM/UNOXWrapper.cxx27
-rw-r--r--winaccessibility/source/UAccCOM/UNOXWrapper.h72
-rw-r--r--winaccessibility/source/UAccCOM/UNOXWrapper.rgs26
-rw-r--r--winaccessibility/source/UAccCOM/acccommon.h95
-rw-r--r--winaccessibility/source/UAccCOM/stdafx.h64
-rw-r--r--winaccessibility/source/UAccCOMIDL/AccessibleKeyBinding.idl66
-rw-r--r--winaccessibility/source/UAccCOMIDL/AccessibleKeyStroke.idl149
-rw-r--r--winaccessibility/source/UAccCOMIDL/Charset.idl33
-rw-r--r--winaccessibility/source/UAccCOMIDL/UAccCOM.idl209
-rw-r--r--winaccessibility/source/UAccCOMIDL/defines.idl40
-rw-r--r--winaccessibility/source/UAccCOMIDL/ia2_api_all.idl5473
-rw-r--r--winaccessibility/source/service/AccComponentEventListener.cxx336
-rw-r--r--winaccessibility/source/service/AccContainerEventListener.cxx573
-rw-r--r--winaccessibility/source/service/AccDescendantManagerEventListener.cxx226
-rw-r--r--winaccessibility/source/service/AccDialogEventListener.cxx150
-rw-r--r--winaccessibility/source/service/AccEventListener.cxx309
-rw-r--r--winaccessibility/source/service/AccFrameEventListener.cxx173
-rw-r--r--winaccessibility/source/service/AccListEventListener.cxx123
-rw-r--r--winaccessibility/source/service/AccMenuEventListener.cxx151
-rw-r--r--winaccessibility/source/service/AccObject.cxx1109
-rw-r--r--winaccessibility/source/service/AccObjectContainerEventListener.cxx72
-rw-r--r--winaccessibility/source/service/AccObjectManagerAgent.cxx386
-rw-r--r--winaccessibility/source/service/AccObjectWinManager.cxx1321
-rw-r--r--winaccessibility/source/service/AccParagraphEventListener.cxx145
-rw-r--r--winaccessibility/source/service/AccResource.cxx85
-rw-r--r--winaccessibility/source/service/AccTableEventListener.cxx146
-rw-r--r--winaccessibility/source/service/AccTextComponentEventListener.cxx65
-rw-r--r--winaccessibility/source/service/AccTopWindowListener.cxx321
-rw-r--r--winaccessibility/source/service/AccTreeEventListener.cxx87
-rw-r--r--winaccessibility/source/service/AccWindowEventListener.cxx152
-rw-r--r--winaccessibility/source/service/ResIDGenerator.cxx54
-rw-r--r--winaccessibility/source/service/checkmt.cxx36
-rw-r--r--winaccessibility/source/service/checkmt.hxx28
-rw-r--r--winaccessibility/source/service/exports.dxp2
-rw-r--r--winaccessibility/source/service/msaaservice_impl.cxx289
-rw-r--r--winaccessibility/source/service/winaccessibility.component27
116 files changed, 25832 insertions, 0 deletions
diff --git a/winaccessibility/inc/AccComponentEventListener.hxx b/winaccessibility/inc/AccComponentEventListener.hxx
new file mode 100644
index 000000000000..1f9c37e5d76b
--- /dev/null
+++ b/winaccessibility/inc/AccComponentEventListener.hxx
@@ -0,0 +1,78 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCCOMPONENTEVENTLISTENER_HXX
+#define __ACCCOMPONENTEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+/**
+ * AccComponentEventListener is inherited from AccEventListener. It handles the evnets
+ * generated by component controls. The accessible roles are: CHECK_BOX, ICON, LABEL,
+ * MENU_ITEM, PUSH_BUTTON, RADIO_BUTTON, SCROLL_BAR, SEPARATOR, TOGGLE_BUTTON, TOOL_TIP, SPIN_BOX.
+ * It defines the procedure of specific event handling related with components and provides
+ * the detailed support for some related methods.
+ */
+class AccComponentEventListener: public AccEventListener
+{
+private:
+ static FILE *output, *output2, *output3, *outacc;//used for debugging
+public:
+ AccComponentEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccComponentEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ //for value changed event
+ virtual void SAL_CALL handleValueChangedEvent(Any oldValue, Any newValue);
+
+ //for action changed event
+ virtual void SAL_CALL handleActionChangedEvent();
+
+ //for text changed event
+ virtual void SAL_CALL handleTextChangedEvent(Any oldValue, Any newValue);
+
+ //for caret changed event
+ virtual void SAL_CALL handleCaretChangedEvent(Any oldValue, Any newValue);
+
+ //for visible data changed event
+ virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+ //for bound rect changed event
+ virtual void SAL_CALL handleBoundrectChangedEvent();
+
+ virtual void SAL_CALL setComponentState(short state, bool enable);
+ virtual void SAL_CALL fireStatePropertyChange(short state, bool set
+ );
+ virtual void SAL_CALL fireStateFocusdChange(bool enable);
+
+ void handleSelectionChangedEvent();
+
+ //add TEXT_SELECTION_CHANGED event
+ void handleTextSelectionChangedEvent();
+};
+
+#endif
diff --git a/winaccessibility/inc/AccContainerEventListener.hxx b/winaccessibility/inc/AccContainerEventListener.hxx
new file mode 100644
index 000000000000..fb354bc69617
--- /dev/null
+++ b/winaccessibility/inc/AccContainerEventListener.hxx
@@ -0,0 +1,98 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCCONTAINEREVENTLISTENERHXX
+#define __ACCCONTAINEREVENTLISTENERHXX
+
+#include <stdio.h>
+#include "AccEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccContainerEventListener is inherited from AccEventListener. It handles the evnets
+ * generated by container controls. The accessible roles are: CANVAS, COMBO_BOX, DOCUMENT,
+ * EMBEDDED_OBJECT, END_NOTE, FILLER, FOOTNOTE, FOOTER, GRAPHIC, HEADER, LAYERED_PANE,
+ * MENU_BAR, POPUP_MENU, OPTION_PANE, PAGE_TAB, PAGE_TAB_LIST, PANEL, SCROLL_PANE, SPLIT_PANE,
+ * STATUS_BAR, TABLE_CELL, TEXT_FRAME, TOOL_BAR, VIEW_PORT.
+ * It defines the procedure of specific event handling related with containsers and provides
+ * the detailed support for some related methods.
+ */
+class AccContainerEventListener: public AccEventListener
+{
+public:
+ AccContainerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccContainerEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ //for child changed event
+ virtual void SAL_CALL handleChildChangedEvent(Any oldValue, Any newValue);
+
+ //for selection changed event
+ virtual void SAL_CALL handleSelectionChangedEvent(const Any &oldValue, const Any &newValue);
+
+ //for all children changed event
+ virtual void SAL_CALL handleAllChildrenChangedEvent();
+
+ //for text changed event
+ virtual void SAL_CALL handleTextChangedEvent(Any oldValue, Any newValue);
+ virtual void SAL_CALL handleStateChangedEvent(Any oldValue, Any newValue);
+
+ //for visible data changed event
+ virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+ //for bound rect changed event
+ virtual void SAL_CALL handleBoundrectChangedEvent();
+
+ //for value changed event
+ virtual void SAL_CALL handleValueChangedEvent(Any oldValue, Any newValue);
+
+ //state changed
+ virtual void SAL_CALL setComponentState(short state, bool enable);
+ virtual void SAL_CALL fireStatePropertyChange(short state, bool set
+ );
+ virtual void SAL_CALL fireStateFocusdChange(bool enable);
+ virtual bool SAL_CALL IsEditable(Reference<com::sun::star::accessibility::XAccessibleContext> xContext);
+
+ // update all children's state
+ void SAL_CALL UpdateAllChildrenState( com::sun::star::accessibility::XAccessible* pXAccessible );
+
+ bool NotifyChildEvent(short nWinEvent,const Any &Value);
+
+ virtual void handleSelectionChangedAddEvent(const Any &oldValue, const Any &newValue);
+ virtual void handleSelectionChangedRemoveEvent(const Any &oldValue, const Any &newValue);
+ virtual void handleSelectionChangedWithinEvent(const Any &oldValue, const Any &newValue);
+
+ virtual void handlePageChangedEvent (const Any &oldValue, const Any &newValue);
+
+ virtual void handleSectionChangedEvent (const Any &oldValue, const Any &newValue);
+ virtual void handleColumnChangedEvent (const Any &oldValue, const Any &newValue);
+ //IAccessibility2 Implementation 2009-----
+ //for name changed event
+ virtual void SAL_CALL handleNameChangedEvent(Any name);
+ //-----IAccessibility2 Implementation 2009
+};
+
+#endif
diff --git a/winaccessibility/inc/AccDescendantManagerEventListener.hxx b/winaccessibility/inc/AccDescendantManagerEventListener.hxx
new file mode 100644
index 000000000000..c166c221a74f
--- /dev/null
+++ b/winaccessibility/inc/AccDescendantManagerEventListener.hxx
@@ -0,0 +1,64 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCDESCENDANTMANAGEREVENTLISTENER_HXX
+#define __ACCDESCENDANTMANAGEREVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccComponentEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccDescendantManagerEventListener is inherited from AccComponentEventListener. It handles
+ * the evnets generated by active descendant controls. They are: TREE, LIST, and TABLE.
+ * It defines the procedure of specific event handling related with active descendant components
+ * and provides the detailed support for some related methods.
+ */
+class AccDescendantManagerEventListener: public AccComponentEventListener
+{
+protected:
+ ::com::sun::star::accessibility::XAccessible* pActiveDescendant;
+public:
+ AccDescendantManagerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccDescendantManagerEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ //for selection changed event
+ virtual void SAL_CALL handleSelectionChangedEvent(Any oldValue, Any newValue);
+
+ //for child changed event
+ virtual void SAL_CALL handleChildChangedEvent (Any oldValue, Any newValue);
+
+ virtual void SAL_CALL handleChildChangedNoFocusEvent(Any oldValue, Any newValue);
+
+ bool NotifyChildEvent(short nWinEvent,const Any &Value);
+
+ virtual void handleSelectionChangedAddEvent(const Any &oldValue, const Any &newValue);
+ virtual void handleSelectionChangedRemoveEvent(const Any &oldValue, const Any &newValue);
+ virtual void handleSelectionChangedWithinEvent(const Any &oldValue, const Any &newValue);
+};
+
+#endif
diff --git a/winaccessibility/inc/AccDialogEventListener.hxx b/winaccessibility/inc/AccDialogEventListener.hxx
new file mode 100644
index 000000000000..1ee76994aa37
--- /dev/null
+++ b/winaccessibility/inc/AccDialogEventListener.hxx
@@ -0,0 +1,63 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCDIALOGEVENTLISTENER_HXX
+#define __ACCDIALOGEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccDialogEventListener is inherited from AccEventListener. It handles the evnets
+ * generated by Dialogs. The accessible role is: DIALOG.
+ * It defines the procedure of specific event handling related with dialogs and provides
+ * the detailed support for some related methods.
+ */
+class AccDialogEventListener: public AccEventListener
+{
+public:
+ AccDialogEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccDialogEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ //for child changed event
+ virtual void SAL_CALL handleChildChangedEvent (Any oldValue, Any newValue);
+
+ //for visible data changed event
+ virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+ //for bound rect changed event
+ virtual void SAL_CALL handleBoundrectChangedEvent();
+
+ //state changed
+ virtual void SAL_CALL setComponentState(short state, bool enable);
+ //virtual void SAL_CALL fireStatePropertyChange(short state, bool set);
+ //virtual void SAL_CALL fireStateFocusdChange(bool enable);
+
+};
+
+#endif
diff --git a/winaccessibility/inc/AccEventListener.hxx b/winaccessibility/inc/AccEventListener.hxx
new file mode 100644
index 000000000000..1f824ca8e7f9
--- /dev/null
+++ b/winaccessibility/inc/AccEventListener.hxx
@@ -0,0 +1,90 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCEVENTLISTENER_HXX
+#define __ACCEVENTLISTENER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <cppuhelper/weak.hxx>
+#include <vos/mutex.hxx>
+
+class AccObjectManagerAgent;
+using namespace ::com::sun::star::uno;
+/**
+ * AccEventListener is the general event listener for all controls. It defines the
+ * procedure of all the event handling and provides the basic support for some simple
+ * methods.
+ */
+class AccEventListener:
+ public com::sun::star::accessibility::XAccessibleEventListener,
+ public ::cppu::OWeakObject
+{
+private:
+ oslInterlockedCount m_refcount;
+protected:
+ //accessible owner's pointer
+ com::sun::star::accessibility::XAccessible* pAccessible;
+ //agent pointer for objects' manager
+ AccObjectManagerAgent* pAgent;
+ //disposed state indicator
+ bool m_isDisposed;
+ mutable ::vos::OMutex aRemoveMutex;
+public:
+ AccEventListener( com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ //for name changed event
+ virtual void SAL_CALL handleNameChangedEvent(Any name);
+
+ //for description changed event
+ virtual void SAL_CALL handleDescriptionChangedEvent(Any desc);
+
+ //for state changed event
+ virtual void SAL_CALL handleStateChangedEvent (Any oldValue, Any newValue);
+ virtual void SAL_CALL setComponentState(short state, bool enable);
+ virtual void SAL_CALL fireStatePropertyChange(short state, bool set
+ );
+ virtual void SAL_CALL fireStateFocusdChange(bool enable);
+
+ //for bound rect changed event
+ virtual void SAL_CALL handleBoundrectChangedEvent();
+
+ //for visible data changed event
+ virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+ //for interface
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+ //get the accessible role of pAccessible
+ virtual short SAL_CALL getRole();
+ //get the accessible parent's role
+ virtual short SAL_CALL getParentRole();
+public:
+ void removeMeFromBroadcaster();
+};
+
+#endif
diff --git a/winaccessibility/inc/AccFrameEventListener.hxx b/winaccessibility/inc/AccFrameEventListener.hxx
new file mode 100644
index 000000000000..28efe968b204
--- /dev/null
+++ b/winaccessibility/inc/AccFrameEventListener.hxx
@@ -0,0 +1,63 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCFRAMEEVENTLISTENER_HXX
+#define __ACCFRAMEEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccFrameEventListener is inherited from AccEventListener. It handles the evnets
+ * generated by Dialogs. The accessible roles are: FRAME and ROOT_PANE.
+ * It defines the procedure of specific event handling related with frames and provides
+ * the detailed support for some related methods.
+ */
+class AccFrameEventListener: public AccEventListener
+{
+public:
+ AccFrameEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccFrameEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ //for child changed event
+ virtual void SAL_CALL handleChildChangedEvent(Any oldValue, Any newValue);
+
+ //for visible data changed event
+ virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+ //for bound rect changed event
+ virtual void SAL_CALL handleBoundrectChangedEvent();
+
+ //state changed
+ virtual void SAL_CALL setComponentState(short state, bool enable);
+ //virtual void SAL_CALL fireStatePropertyChange(short state, bool set);
+ //virtual void SAL_CALL fireStateFocusdChange(bool enable);
+
+};
+
+#endif
diff --git a/winaccessibility/inc/AccListEventListener.hxx b/winaccessibility/inc/AccListEventListener.hxx
new file mode 100644
index 000000000000..581b4257d858
--- /dev/null
+++ b/winaccessibility/inc/AccListEventListener.hxx
@@ -0,0 +1,54 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCLISTEVENTLISTENER_HXX
+#define __ACCLISTEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccDescendantManagerEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccListEventListener is inherited from AccDescendantManagerEventListener. It handles
+ * the evnets generated by tree controls. The accessible role is: LIST.
+ * It defines the procedure of specific event handling related with list components
+ * and provides the detailed support for some related methods.
+ */
+class AccListEventListener: public AccDescendantManagerEventListener
+{
+private:
+ bool shouldDeleteChild;
+public:
+ AccListEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccListEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+ //for active descendant changed event
+ virtual void SAL_CALL handleActiveDescendantChangedEvent(Any oldValue, Any newValue);
+ //for value changed event
+ virtual void SAL_CALL handleValueChangedEvent(Any oldValue, Any newValue);
+};
+
+#endif
diff --git a/winaccessibility/inc/AccMenuEventListener.hxx b/winaccessibility/inc/AccMenuEventListener.hxx
new file mode 100644
index 000000000000..ace58073b08f
--- /dev/null
+++ b/winaccessibility/inc/AccMenuEventListener.hxx
@@ -0,0 +1,57 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCMENUEVENTLISTENER_HXX
+#define __ACCMENUEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccComponentEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccMenuEventListener is inherited from AccComponentEventListener. It handles the evnets
+ * generated by container controls. The accessible role is: MENU
+ * It defines the procedure of specific event handling related with menus and provides
+ * the detailed support for some related methods.
+ */
+class AccMenuEventListener: public AccComponentEventListener
+{
+public:
+ AccMenuEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccMenuEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ //for child changed event
+ virtual void SAL_CALL handleChildChangedEvent (Any oldValue, Any newValue);
+
+ //for selection changed event
+ virtual void SAL_CALL handleSelectionChangedEvent();
+
+ //for state changed event
+ virtual void SAL_CALL fireStatePropertyChange(short state, bool set );
+};
+
+#endif
diff --git a/winaccessibility/inc/AccObject.hxx b/winaccessibility/inc/AccObject.hxx
new file mode 100644
index 000000000000..feded8d80136
--- /dev/null
+++ b/winaccessibility/inc/AccObject.hxx
@@ -0,0 +1,130 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCOBJECT_HXX
+#define __ACCOBJECT_HXX
+
+#include <vector>
+#include <map>
+#include <oleacc.h>
+#include <windows.h>
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+
+#include "accHelper.hxx"
+#include "UAccCOM.h"
+
+class AccEventListener;
+class AccObjectManagerAgent;
+class AccObject;
+
+typedef std::map< const long, AccObject*,ltstr4 > IAccSelectionList;
+typedef std::vector<AccObject *> IAccChildList;
+
+
+class AccObject
+{
+private:
+
+ short m_accRole;
+ long m_resID;
+ HWND m_pParantID;
+ sal_Bool m_bShouldDestroy; //avoid access COM interface when acc object is deleted
+ IMAccessible* m_pIMAcc;
+ AccObject* m_pParentObj;
+ IAccChildList m_childrenList;
+ AccEventListener* m_accListener;
+ IAccSelectionList m_selectionList;
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > m_xAccRef;
+ ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessibleAction > m_xAccActionRef;
+ ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessibleContext > m_xAccContextRef;
+
+ sal_Bool ImplInitilizeCreateObj();//create COM object
+
+ void UpdateActionDesc();
+ void UpdateRole();
+
+ DWORD GetMSAAStateFromUNO(short xState);//translate state from UNO to MSAA value
+ ::com::sun::star::accessibility::XAccessibleSelection* GetXAccessibleSelection();
+ void GetExpandedState(sal_Bool* isExpandable, sal_Bool* isExpanded);
+ ::rtl::OUString GetMAccessibleValueFromAny(::com::sun::star::uno::Any pAny);
+
+public:
+
+ AccObject ( ::com::sun::star::accessibility::XAccessible* pXAcc = NULL,AccObjectManagerAgent* pAgent = NULL ,AccEventListener* accListener=NULL);
+ virtual ~AccObject();
+
+ sal_Bool UpdateAccessibleInfoFromUnoToMSAA( ); //implement accessible information mapping
+ void UpdateDefaultAction();
+
+ IMAccessible* GetIMAccessible(); //return COM interface in acc object
+ ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > GetXAccessible();
+
+ void SetResID(long id);//ResID means ChildID in MSAA
+ long GetResID();
+
+
+ void SetParentHWND(HWND hWnd);//need to set top window handle when send event to AT
+ HWND GetParentHWND();
+
+ void SetListener( AccEventListener* Listener );
+ AccEventListener* getListener();
+
+ void SetParentObj(AccObject* pParentAccObj);
+ AccObject* GetParentObj();
+
+ void InsertChild( AccObject* pChild,short pos = LAST_CHILD);
+ void DeleteChild( AccObject* pChild );
+ AccObject* NextChild();
+
+ void NotifyDestroy(sal_Bool ifDelete);
+ sal_Bool ifShouldDestroy();
+
+ void DecreaseState(short xState );//call COM interface DecreaseState method
+ void IncreaseState( short xState );//call COM interface IncreaseState method
+
+ void SetName( com::sun::star::uno::Any newName);
+ void SetValue( com::sun::star::uno::Any pAny );
+ void SetDescription( com::sun::star::uno::Any newDesc );
+ void SetRole( short Role );
+
+ short GetRole() const;
+
+ void UpdateState();
+ void UpdateName();
+ void UpdateValue();
+ void UpdateAction();
+ void UpdateDescription();
+ void UpdateValidWindow();
+ void UpdateLocation();
+
+ void setFocus();
+ void unsetFocus();
+
+ void AddSelect(long index, AccObject* accObj);
+ IAccSelectionList& GetSelection();
+ void setLocalizedResourceString();
+};
+
+#endif
diff --git a/winaccessibility/inc/AccObjectContainerEventListener.hxx b/winaccessibility/inc/AccObjectContainerEventListener.hxx
new file mode 100644
index 000000000000..35ae0069b574
--- /dev/null
+++ b/winaccessibility/inc/AccObjectContainerEventListener.hxx
@@ -0,0 +1,50 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef _ACCOBJECTCONTAINEREVENTLISTENER_HXX
+#define _ACCOBJECTCONTAINEREVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccContainerEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccObjectContainerEventListener is inherited from AccContainerEventListener. It handles the evnets
+ * generated by container controls. The accessible role is: SHAPE
+ * It defines the procedure of specific event handling related with shapes and provides
+ * the detailed support for some related methods.
+ */
+class AccObjectContainerEventListener: public AccContainerEventListener
+{
+public:
+ AccObjectContainerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccObjectContainerEventListener();
+
+ //overwrite handleStateChangedEvent()
+ virtual void SAL_CALL handleStateChangedEvent (Any oldValue, Any newValue);
+ //for visible data changed event, for shapes, the visiabledatachanged should be mapped to LOCATION_CHANGED
+ virtual void SAL_CALL handleVisibleDataChangedEvent();
+};
+
+#endif
diff --git a/winaccessibility/inc/AccObjectManagerAgent.hxx b/winaccessibility/inc/AccObjectManagerAgent.hxx
new file mode 100644
index 000000000000..0d3c085d167c
--- /dev/null
+++ b/winaccessibility/inc/AccObjectManagerAgent.hxx
@@ -0,0 +1,102 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCOBJECTMANAGERAGENT_HXX
+#define __ACCOBJECTMANAGERAGENT_HXX
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+
+struct IMAccessible;
+struct IAccessible;
+class AccObjectWinManager;
+
+/****************************************************************
+AccObjectMangerAgent is used for manaing AccObjects,which encapsulates
+platform differences,and call AccObjectWinManager for Windows platform. To do for
+Linux platform
+*****************************************************************/
+class AccObjectManagerAgent
+{
+private:
+
+ AccObjectWinManager* pWinManager;
+
+public:
+
+ AccObjectManagerAgent();
+ virtual ~AccObjectManagerAgent();
+
+ virtual unsigned char InsertAccObj( com::sun::star::accessibility::XAccessible* pXAcc,
+ com::sun::star::accessibility::XAccessible* pParentXAcc,
+ long pWnd=0);
+ virtual void GetIAccessibleFromResID(long childID,IMAccessible**);
+ virtual unsigned char GetIAccessibleFromXAccessible(com::sun::star::accessibility::XAccessible* pXAcc, IAccessible** ppIA);
+
+ virtual void DeleteAccObj( com::sun::star::accessibility::XAccessible* pXAcc );
+ virtual IMAccessible* GetIMAccByXAcc(com::sun::star::accessibility::XAccessible* pXAcc);
+
+ unsigned char NotifyAccEvent( short pEvent = 0, com::sun::star::accessibility::XAccessible* pXAcc = 0 );
+
+ unsigned char InsertChildrenAccObj( com::sun::star::accessibility::XAccessible* pXAcc,
+ long pWnd=0);
+ void DeleteChildrenAccObj( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ void DecreaseState( com::sun::star::accessibility::XAccessible* pXAcc,unsigned short pState );
+ void IncreaseState( com::sun::star::accessibility::XAccessible* pXAcc,unsigned short pState );
+ void UpdateState( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ void UpdateLocation( com::sun::star::accessibility::XAccessible* pXAcc,
+ long Top = 0,long left = 0,long width = 0,long height = 0 );
+ void UpdateAction( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ void UpdateValue( com::sun::star::accessibility::XAccessible* pXAcc );
+ void UpdateValue( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any );
+
+ void UpdateAccName( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any newName);
+ void UpdateAccName( com::sun::star::accessibility::XAccessible* pXAcc);
+
+ void UpdateDescription( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any newDesc );
+ void UpdateDescription( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ void NotifyDestroy(com::sun::star::accessibility::XAccessible* pXAcc);
+
+ com::sun::star::accessibility::XAccessible* GetParentXAccessible(
+ com::sun::star::accessibility::XAccessible* pXAcc );
+ short GetParentRole(com::sun::star::accessibility::XAccessible* pXAcc );
+ unsigned short IsContainer(com::sun::star::accessibility::XAccessible* pXAcc);
+
+ void SaveTopWindowHandle(long hWnd, com::sun::star::accessibility::XAccessible* pXAcc);
+
+ void UpdateChildState(com::sun::star::accessibility::XAccessible* pXAcc);
+
+ bool IsSpecialToolboItem(com::sun::star::accessibility::XAccessible* pXAcc);
+
+ short GetRole(com::sun::star::accessibility::XAccessible* pXAcc);
+
+ com::sun::star::accessibility::XAccessible* GetAccDocByAccTopWin( com::sun::star::accessibility::XAccessible* pXAcc );
+ bool IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ bool IsStateManageDescendant(com::sun::star::accessibility::XAccessible* pXAcc);
+};
+
+#endif
diff --git a/winaccessibility/inc/AccObjectWinManager.hxx b/winaccessibility/inc/AccObjectWinManager.hxx
new file mode 100644
index 000000000000..5b8de1b2e48b
--- /dev/null
+++ b/winaccessibility/inc/AccObjectWinManager.hxx
@@ -0,0 +1,177 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCOBJECTWINMANAGER_HXX
+#define __ACCOBJECTWINMANAGER_HXX
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+#include <map>
+#include <windows.h>
+#include <vos/mutex.hxx>
+#include <vcl/dllapi.h>
+#include "ResIDGenerator.hxx"
+#include "UAccCOM2.h"
+
+class ResIDGenerator;
+class AccObjectManagerAgent;
+class AccEventListener;
+class AccObject;
+
+/*******************************************************************
+AccObjectWinManager complete the functions:
+1. Insert, delete,query,update Acc objects
+2. Create, delete,fire AccEventLister, the lifecycle of AccEventListener is as same as
+ Acc Object
+ 3.Return COM interface for AT,by the call back in salframe
+ 4.Pass accessible information to Acc objects
+ *******************************************************************/
+class AccObjectWinManager
+{
+ friend class AccObjectManagerAgent;
+
+private:
+ struct ltstr1
+ {
+ bool operator()(const void* s1, const void* s2) const
+ {
+ return long(s1)<long(s2);
+ }
+ };
+ struct ltstr2
+ {
+ bool operator()(const HWND s1, const HWND s2) const
+ {
+ return long(s1)<long(s2);
+ }
+ };
+ struct ltstr3
+ {
+ bool operator()(const long s1, const long s2) const
+ {
+ return long(s1)<long(s2);
+ }
+ };
+ typedef std::map< void*, AccObject,ltstr1 > XIdToAccObjHash;
+ typedef std::map< HWND,void*,ltstr2 > XHWNDToXAccHash;
+ typedef std::map< const long, AccObject*,ltstr3 > XResIdToAccObjHash;
+
+ typedef std::map< const long, com::sun::star::accessibility::XAccessible*,ltstr3 > XHWNDToDocumentHash;
+
+
+ //XAccessible to AccObject
+ XIdToAccObjHash XIdAccList;
+
+ //HWND to All XAccessible pointer
+ XHWNDToXAccHash HwndXAcc;
+
+ //id_Child to AccObject
+ XResIdToAccObjHash XResIdAccList;
+
+ //for file name support
+ XHWNDToDocumentHash XHWNDDocList;
+
+ com::sun::star::accessibility::XAccessible* oldFocus;
+
+ AccObjectManagerAgent* pAgent;
+ static AccObjectWinManager* me;
+ ResIDGenerator ResIdGen;
+ mutable ::vos::OMutex aDeleteMutex;
+ mutable ::vos::OMutex aNotifyMutex;
+ mutable ::vos::OMutex maATInterfaceMutex;
+
+ AccObjectWinManager(AccObjectManagerAgent* Agent=NULL);
+
+private:
+ long ImpleGenerateResID();
+ AccObject* GetAccObjByXAcc( com::sun::star::accessibility::XAccessible* pXAcc);
+
+ com::sun::star::accessibility::XAccessible* GetXAccByAccObj(AccObject* pAccObj);
+
+ AccObject* GetTopWindowAccObj(HWND hWnd);
+
+ com::sun::star::accessibility::XAccessible* GetAccDocByHWND( long pWnd );
+
+ void DeleteAccListener( AccObject* pAccObj );
+ void InsertAccChildNode(AccObject* pCurObj,AccObject* pParentObj,HWND pWnd);
+ void DeleteAccChildNode(AccObject* pChild);
+ void DeleteFromHwndXAcc(com::sun::star::accessibility::XAccessible* pXAcc );
+ int UpdateAccSelection(com::sun::star::accessibility::XAccessible* pXAcc);
+
+ AccEventListener* createAccEventListener(com::sun::star::accessibility::XAccessible* pXAcc, AccObjectManagerAgent* Agent);
+public:
+ virtual ~AccObjectWinManager();
+ sal_Bool InsertAccObj( com::sun::star::accessibility::XAccessible* pXAcc,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWnd);
+ sal_Bool InsertChildrenAccObj( com::sun::star::accessibility::XAccessible* pXAcc,HWND pWnd=0);
+ void DeleteAccObj( com::sun::star::accessibility::XAccessible* pXAcc );
+ void DeleteChildrenAccObj(com::sun::star::accessibility::XAccessible* pAccObj);
+
+ static AccObjectWinManager* CreateAccObjectWinManagerInstance(AccObjectManagerAgent* Agent);
+
+ sal_Bool NotifyAccEvent( com::sun::star::accessibility::XAccessible* pXAcc,short state = 0 );
+
+ long Get_ToATInterface( HWND hWnd, long lParam, long wParam);
+
+ void DecreaseState( com::sun::star::accessibility::XAccessible* pXAcc,unsigned short pState );
+ void IncreaseState( com::sun::star::accessibility::XAccessible* pXAcc,unsigned short pState );
+ void UpdateState( com::sun::star::accessibility::XAccessible* pXAcc );
+ void SetLocation( com::sun::star::accessibility::XAccessible* pXAcc,
+ long Top = 0,long left = 0,long width = 0,long height = 0);
+
+ void SetValue( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any pAny );
+ void UpdateValue( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ void SetAccName( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any newName);
+ void UpdateAccName( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ void SetDescription( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any newDesc );
+ void UpdateDescription( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ void SetRole( com::sun::star::accessibility::XAccessible* pXAcc, long Role );
+
+ void UpdateAccFocus( com::sun::star::accessibility::XAccessible* newFocus );
+ void UpdateAction( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ sal_Bool IsContainer( com::sun::star::accessibility::XAccessible* pAccessible );
+
+ IMAccessible* GetIMAccByXAcc( com::sun::star::accessibility::XAccessible* pXAcc );
+ IMAccessible* GetIAccessibleFromResID(long resID);
+
+ void NotifyDestroy( com::sun::star::accessibility::XAccessible* pXAcc );
+ com::sun::star::accessibility::XAccessible* GetParentXAccessible( com::sun::star::accessibility::XAccessible* pXAcc );
+ short GetParentRole( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ void SaveTopWindowHandle(HWND hWnd, com::sun::star::accessibility::XAccessible* pXAcc);
+
+ void UpdateChildState(com::sun::star::accessibility::XAccessible* pXAcc);
+
+ bool IsSpecialToolboItem(com::sun::star::accessibility::XAccessible* pXAcc);
+
+ short GetRole(com::sun::star::accessibility::XAccessible* pXAcc);
+
+ com::sun::star::accessibility::XAccessible* GetAccDocByAccTopWin( com::sun::star::accessibility::XAccessible* pXAcc );
+ bool IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc );
+
+ bool IsStateManageDescendant(com::sun::star::accessibility::XAccessible* pAccessible);
+
+};
+#endif
diff --git a/winaccessibility/inc/AccParagraphEventListener.hxx b/winaccessibility/inc/AccParagraphEventListener.hxx
new file mode 100644
index 000000000000..ad6b2e9435d5
--- /dev/null
+++ b/winaccessibility/inc/AccParagraphEventListener.hxx
@@ -0,0 +1,62 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCPARAGRAPHEVENTLISTENER_HXX
+#define __ACCPARAGRAPHEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccContainerEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccParagraphEventListener is inherited from AccContainerEventListener. It handles the evnets
+ * generated by container controls. The accessible roles are: PARAGRAPH and HEADING.
+ * It defines the procedure of specific event handling related with text containsers and provides
+ * the detailed support for some related methods.
+ */
+class AccParagraphEventListener: public AccContainerEventListener
+{
+public:
+ AccParagraphEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccParagraphEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ //for caret changed event
+ virtual void SAL_CALL handleCaretChangedEvent(Any oldValue, Any newValue);
+
+ //for visible data changed event
+ virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+ //for bound rect changed event
+ virtual void SAL_CALL handleBoundrectChangedEvent();
+
+ virtual void SAL_CALL setComponentState(short state, bool enable);
+
+ //add TEXT_SELECTION_CHANGED event
+ void handleTextSelectionChangedEvent();
+};
+
+#endif
diff --git a/winaccessibility/inc/AccResource.hxx b/winaccessibility/inc/AccResource.hxx
new file mode 100644
index 000000000000..e6bcfb05cf2f
--- /dev/null
+++ b/winaccessibility/inc/AccResource.hxx
@@ -0,0 +1,69 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef _ACCRESOURCE_HXX
+#define _ACCRESOURCE_HXX
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+class SimpleResMgr;
+
+#define ACC_RES_STRING(id) ResourceManager::loadString(id)
+
+//==================================================================
+//= ResourceManager
+//= handling ressources within the FormLayer library
+//==================================================================
+class ResourceManager
+{
+ static SimpleResMgr* m_pImpl;
+
+private:
+ // no instantiation allowed
+ ResourceManager()
+ { }
+ ~ResourceManager()
+ { }
+
+ // we'll instantiate one static member of the following class, which, in it's dtor,
+ // ensures that m_pImpl will be deleted
+ class EnsureDelete
+ {
+ public:
+ EnsureDelete()
+ { }
+ ~EnsureDelete();
+ };
+ friend class EnsureDelete;
+
+protected:
+ static void ensureImplExists();
+
+public:
+ /** loads the string with the specified resource id from the FormLayer resource file
+ */
+ static ::rtl::OUString loadString(sal_uInt16 _nResId);
+};
+
+
+#endif
diff --git a/winaccessibility/inc/AccTableEventListener.hxx b/winaccessibility/inc/AccTableEventListener.hxx
new file mode 100644
index 000000000000..5e22d8449fef
--- /dev/null
+++ b/winaccessibility/inc/AccTableEventListener.hxx
@@ -0,0 +1,53 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCTABLEEVENTLISTENER_HXX
+#define __ACCTABLEEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccDescendantManagerEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccTableEventListener is inherited from AccDescendantManagerEventListener. It handles
+ * the evnets generated by tree controls. The accessible role is: TABLE.
+ * It defines the procedure of specific event handling related with table components
+ * and provides the detailed support for some related methods.
+ */
+class AccTableEventListener: public AccDescendantManagerEventListener
+{
+public:
+ AccTableEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccTableEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+ //for active descendant changed event
+ virtual void SAL_CALL handleActiveDescendantChangedEvent(Any oldValue, Any newValue);
+
+ void SAL_CALL handleTableModelChangeEvent(Any newValue);
+
+};
+
+#endif
diff --git a/winaccessibility/inc/AccTextComponentEventListener.hxx b/winaccessibility/inc/AccTextComponentEventListener.hxx
new file mode 100644
index 000000000000..060d4de400fc
--- /dev/null
+++ b/winaccessibility/inc/AccTextComponentEventListener.hxx
@@ -0,0 +1,48 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCTEXTCOMPONENTEVENTLISTENER_HXX
+#define __ACCTEXTCOMPONENTEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccComponentEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccTextComponentEventListener is inherited from AccComponentEventListener. It handles the evnets
+ * generated by container controls. The accessible role is: TEXT
+ * It defines the procedure of specific event handling related with text components and provides
+ * the detailed support for some related methods.
+ */
+class AccTextComponentEventListener: public AccComponentEventListener
+{
+public:
+ AccTextComponentEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccTextComponentEventListener();
+
+ virtual void SAL_CALL setComponentState(short state, bool enable);
+
+};
+
+#endif
diff --git a/winaccessibility/inc/AccTopWindowListener.hxx b/winaccessibility/inc/AccTopWindowListener.hxx
new file mode 100644
index 000000000000..f061b7b7179d
--- /dev/null
+++ b/winaccessibility/inc/AccTopWindowListener.hxx
@@ -0,0 +1,66 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCTOPWINDOWLISTENER_HXX
+#define __ACCTOPWINDOWLISTENER_HXX
+
+#include <com/sun/star/awt/XTopWindowListener.hpp>
+#include <com/sun/star/awt/XExtendedToolkit.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <cppuhelper/weak.hxx>
+
+#include "AccObjectManagerAgent.hxx"
+
+/**
+ * AccEventListener is the general event listener for all top windows. The top windows defined
+ * in UNO are: FRAME, WINDOW, DIALOG, MENU, TOOLTIP.
+ * It implements the methods of XTopWindowListener and the most important method is windowOpened().
+ * In this method, all the accessible objects (including COM object and Uno objects) are created and
+ * cached into bridge managers, and they are monitored by listeners for later accessible evnet handling.
+ */
+class AccTopWindowListener:
+ public com::sun::star::awt::XTopWindowListener,
+ public ::cppu::OWeakObject
+
+{
+private:
+ AccObjectManagerAgent accManagerAgent;
+ oslInterlockedCount m_refcount;
+public:
+ AccTopWindowListener();
+ virtual ~AccTopWindowListener();
+ virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+ virtual void AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWND );
+ //for On-Demand load.
+ virtual void handleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible );
+};
+
+#endif
diff --git a/winaccessibility/inc/AccTreeEventListener.hxx b/winaccessibility/inc/AccTreeEventListener.hxx
new file mode 100644
index 000000000000..430fe307c126
--- /dev/null
+++ b/winaccessibility/inc/AccTreeEventListener.hxx
@@ -0,0 +1,50 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCTREEEVENTLISTENER_HXX
+#define __ACCTREEEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccDescendantManagerEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccTreeEventListener is inherited from AccDescendantManagerEventListener. It handles
+ * the evnets generated by tree controls. The accessible role is: TREE.
+ * It defines the procedure of specific event handling related with tree components
+ * and provides the detailed support for some related methods.
+ */
+class AccTreeEventListener: public AccDescendantManagerEventListener
+{
+public:
+ AccTreeEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccTreeEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+ //for active descendant changed event
+ virtual void SAL_CALL handleActiveDescendantChangedEvent(Any oldValue, Any newValue);
+};
+
+#endif
diff --git a/winaccessibility/inc/AccWindowEventListener.hxx b/winaccessibility/inc/AccWindowEventListener.hxx
new file mode 100644
index 000000000000..38b671e1a816
--- /dev/null
+++ b/winaccessibility/inc/AccWindowEventListener.hxx
@@ -0,0 +1,60 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCWINDOWEVENTLISTENER_HXX
+#define __ACCWINDOWEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+/**
+ * AccWindowEventListener is inherited from AccEventListener. It handles the events
+ * generated by Dialogs. The accessible role is: WINDOW.
+ * It defines the procedure of specific event handling related with windows and provides
+ * the detailed support for some related methods.
+ */
+class AccWindowEventListener: public AccEventListener
+{
+public:
+ AccWindowEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+ virtual ~AccWindowEventListener();
+
+ //AccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ //for child changed event
+ virtual void SAL_CALL handleChildChangedEvent (Any oldValue, Any newValue);
+
+ //for visible data changed event
+ virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+ //for bound rect changed event
+ virtual void SAL_CALL handleBoundrectChangedEvent();
+
+ //state changed
+ virtual void SAL_CALL setComponentState(short state, bool enable);
+
+};
+
+#endif
diff --git a/winaccessibility/inc/ResIDGenerator.hxx b/winaccessibility/inc/ResIDGenerator.hxx
new file mode 100644
index 000000000000..bc5644217a3f
--- /dev/null
+++ b/winaccessibility/inc/ResIDGenerator.hxx
@@ -0,0 +1,56 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __RESIDGENERATOR_HXX
+#define __RESIDGENERATOR_HXX
+
+#define PRIMARY_RESID 0x00000001
+#include <deque>
+
+//ResID i.e. MSAA child ID,
+//this class is responsible for generating a child ID
+class ResIDGenerator
+{
+private:
+
+ long min;
+ long max;
+ std::deque<long> subList;
+
+public:
+
+ ResIDGenerator( long minNum = PRIMARY_RESID,long maxNum = PRIMARY_RESID);
+ long GenerateNewResID();
+ void SetSub(long number)
+ {
+ subList.push_back(number);
+ };
+ virtual ~ResIDGenerator();
+
+};
+
+inline ResIDGenerator::ResIDGenerator( long minNum ,long maxNum )
+{
+ min = minNum;
+ max = maxNum;
+}
+
+#endif
diff --git a/winaccessibility/inc/UAccCOM2.h b/winaccessibility/inc/UAccCOM2.h
new file mode 100644
index 000000000000..cb0d355caed8
--- /dev/null
+++ b/winaccessibility/inc/UAccCOM2.h
@@ -0,0 +1,30 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __UACCCOM2_H
+#define __UACCCOM2_H
+
+// Just a wrapper header for disabling this warning....
+
+#pragma warning( disable: 4917 ) /* a GUID can only be associated with a class, interface or namespace */
+#include "UAccCOM.h"
+
+#endif
diff --git a/winaccessibility/inc/accHelper.hxx b/winaccessibility/inc/accHelper.hxx
new file mode 100644
index 000000000000..df1abeb80d2c
--- /dev/null
+++ b/winaccessibility/inc/accHelper.hxx
@@ -0,0 +1,145 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCHELPER_HXX
+#define __ACCHELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+#include "UAccCOM2.h"
+
+enum DIRECTION
+{
+ FIRST_CHILD=0,
+ LAST_CHILD=-1,
+ BEFORE_CHILD=1 ,
+ AFTER_CHILD=2
+};
+
+#define CHILDID_SELF 0
+#define UNO_MSAA_UNMAPPING 0x00000000
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility::AccessibleRole;
+using namespace com::sun::star::accessibility::AccessibleStateType;
+
+//Role mapping table,left side is UNO role, right side is MSAA role
+const short ROLE_TABLE[][2] =
+ {
+ {UNKNOWN, IA2_ROLE_UNKNOWN},
+ {ALERT , ROLE_SYSTEM_DIALOG},
+ {COLUMN_HEADER , ROLE_SYSTEM_COLUMNHEADER},
+ //{CANVAS , ROLE_SYSTEM_CLIENT},
+ {CANVAS , IA2_ROLE_CANVAS},
+ {CHECK_BOX , ROLE_SYSTEM_CHECKBUTTON},
+ {CHECK_MENU_ITEM , IA2_ROLE_CHECK_MENU_ITEM},
+ {COLOR_CHOOSER, IA2_ROLE_COLOR_CHOOSER},
+ {COMBO_BOX , ROLE_SYSTEM_COMBOBOX},
+ {DATE_EDITOR , IA2_ROLE_DATE_EDITOR},
+ {DESKTOP_ICON , IA2_ROLE_DESKTOP_ICON},
+ {DESKTOP_PANE, IA2_ROLE_DESKTOP_PANE},
+ {DIRECTORY_PANE, IA2_ROLE_DIRECTORY_PANE},
+ {DIALOG, ROLE_SYSTEM_DIALOG},
+ {DOCUMENT, ROLE_SYSTEM_DOCUMENT},
+ {EMBEDDED_OBJECT , IA2_ROLE_EMBEDDED_OBJECT },
+ {END_NOTE , IA2_ROLE_ENDNOTE },
+ {FILE_CHOOSER , IA2_ROLE_FILE_CHOOSER },
+ {FILLER, ROLE_SYSTEM_WHITESPACE},
+ {FONT_CHOOSER, IA2_ROLE_FONT_CHOOSER},
+ {FOOTER, IA2_ROLE_FOOTER},
+ {FOOTNOTE, IA2_ROLE_FOOTNOTE},
+ //{FRAME, IA2_ROLE_FRAME},
+ {FRAME, ROLE_SYSTEM_DIALOG},
+ {GLASS_PANE , IA2_ROLE_GLASS_PANE},
+ {GRAPHIC , ROLE_SYSTEM_GRAPHIC},
+ {GROUP_BOX, ROLE_SYSTEM_GROUPING},
+ {HEADER , IA2_ROLE_HEADER},
+ {HEADING , IA2_ROLE_HEADING},
+ {HYPER_LINK , ROLE_SYSTEM_TEXT},
+ {ICON , IA2_ROLE_ICON},
+ {INTERNAL_FRAME, IA2_ROLE_INTERNAL_FRAME},
+ {LABEL, ROLE_SYSTEM_STATICTEXT},
+ {LAYERED_PANE , IA2_ROLE_LAYERED_PANE},
+ {LIST , ROLE_SYSTEM_LIST},
+ {LIST_ITEM , ROLE_SYSTEM_LISTITEM},
+ //{MENU , ROLE_SYSTEM_MENUPOPUP},
+ {MENU, ROLE_SYSTEM_MENUITEM},
+ {MENU_BAR, ROLE_SYSTEM_MENUBAR},
+ {MENU_ITEM, ROLE_SYSTEM_MENUITEM},
+ {OPTION_PANE , IA2_ROLE_OPTION_PANE},
+ {PAGE_TAB, ROLE_SYSTEM_PAGETAB},
+ {PAGE_TAB_LIST, ROLE_SYSTEM_PAGETABLIST},
+ {PANEL, IA2_ROLE_OPTION_PANE},
+ {PARAGRAPH, IA2_ROLE_PARAGRAPH},
+ {PASSWORD_TEXT, ROLE_SYSTEM_TEXT},
+ {POPUP_MENU, ROLE_SYSTEM_MENUPOPUP},
+ {PUSH_BUTTON, ROLE_SYSTEM_PUSHBUTTON},
+ {PROGRESS_BAR, ROLE_SYSTEM_PROGRESSBAR},
+ {RADIO_BUTTON, ROLE_SYSTEM_RADIOBUTTON},
+ {RADIO_MENU_ITEM, IA2_ROLE_RADIO_MENU_ITEM},
+ {ROW_HEADER , ROLE_SYSTEM_ROWHEADER},
+ {ROOT_PANE, IA2_ROLE_ROOT_PANE},
+ {SCROLL_BAR , ROLE_SYSTEM_SCROLLBAR},
+ {SCROLL_PANE , IA2_ROLE_SCROLL_PANE},
+ {SHAPE, IA2_ROLE_SHAPE},
+ {SEPARATOR , ROLE_SYSTEM_SEPARATOR},
+ {SLIDER , ROLE_SYSTEM_SLIDER},
+ {SPIN_BOX , ROLE_SYSTEM_SPINBUTTON},
+ {SPLIT_PANE, IA2_ROLE_SPLIT_PANE},
+ {STATUS_BAR, ROLE_SYSTEM_STATUSBAR},
+ {TABLE, ROLE_SYSTEM_TABLE},
+ {TABLE_CELL , ROLE_SYSTEM_CELL},
+ {TEXT, ROLE_SYSTEM_TEXT},
+ {TEXT_FRAME , IA2_ROLE_TEXT_FRAME},
+ //for change toggle button to push button for jaws
+ {TOGGLE_BUTTON, ROLE_SYSTEM_PUSHBUTTON},
+
+ {TOOL_BAR, ROLE_SYSTEM_TOOLBAR},
+ {TOOL_TIP, ROLE_SYSTEM_TOOLTIP},
+ {TREE , ROLE_SYSTEM_OUTLINE},
+ {VIEW_PORT , IA2_ROLE_VIEW_PORT},
+ {WINDOW, ROLE_SYSTEM_WINDOW},
+ {BUTTON_DROPDOWN, ROLE_SYSTEM_BUTTONDROPDOWN},
+ {BUTTON_MENU, ROLE_SYSTEM_BUTTONMENU},
+ {CAPTION, IA2_ROLE_CAPTION},
+ {CHART, IA2_ROLE_SHAPE},
+ {EDIT_BAR, IA2_ROLE_EDITBAR},
+ {FORM, IA2_ROLE_FORM},
+ {IMAGE_MAP , IA2_ROLE_IMAGE_MAP},
+ {NOTE, IA2_ROLE_NOTE},
+ {PAGE, IA2_ROLE_PAGE},
+ {RULER , IA2_ROLE_RULER},
+ {SECTION, IA2_ROLE_SECTION},
+ {TREE_ITEM , ROLE_SYSTEM_OUTLINEITEM},
+ {TREE_TABLE, ROLE_SYSTEM_OUTLINE}
+ };
+
+struct ltstr4
+{
+ bool operator()(const long s1, const long s2) const
+ {
+ return long(s1)<long(s2);
+ }
+};
+
+#endif
diff --git a/winaccessibility/inc/act.hxx b/winaccessibility/inc/act.hxx
new file mode 100644
index 000000000000..09fb1e3ac767
--- /dev/null
+++ b/winaccessibility/inc/act.hxx
@@ -0,0 +1,90 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCACT_HXX
+#define __ACCACT_HXX
+
+#include <windows.h>
+#include <tchar.h>
+
+
+static bool IsXPOrLater()
+{
+ OSVERSIONINFO osvi;
+
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
+
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+
+ GetVersionEx(&osvi);
+ return ((osvi.dwMajorVersion > 5) ||
+ ((osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion >= 1)));
+}
+
+static HANDLE pActCtx = INVALID_HANDLE_VALUE;
+static ULONG_PTR lpCookie;
+
+static bool ActivateActContext()
+{
+ if(!IsXPOrLater())
+ return false;
+
+ ACTCTX actctx;
+
+ ZeroMemory(&actctx, sizeof(actctx));
+
+ actctx.cbSize = sizeof(actctx);
+
+ TCHAR szDllDirPath[1024];
+ ::GetCurrentDirectory(1024,szDllDirPath);
+ LPTSTR szDllPath = szDllDirPath;
+ lstrcat(szDllPath, _T("\\UAccCOM.dll"));
+
+ actctx.lpSource = szDllPath;
+ actctx.lpResourceName = MAKEINTRESOURCE(97);
+ actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
+
+ HANDLE pActCtx = CreateActCtx(&actctx);
+
+ if(pActCtx != INVALID_HANDLE_VALUE)
+ {
+ if(ActivateActCtx(pActCtx, &lpCookie))
+ {
+ return true;
+ }
+ }
+ pActCtx = INVALID_HANDLE_VALUE;
+ lpCookie = 0;
+ return false;
+}
+
+static void DeactivateActContext()
+{
+ if(!IsXPOrLater())
+ return;
+
+ if(lpCookie)
+ DeactivateActCtx(0, lpCookie);
+
+ if(pActCtx!=INVALID_HANDLE_VALUE)
+ ReleaseActCtx(pActCtx);
+}
+#endif \ No newline at end of file
diff --git a/winaccessibility/inc/g_msacc.hxx b/winaccessibility/inc/g_msacc.hxx
new file mode 100644
index 000000000000..4b33f6213416
--- /dev/null
+++ b/winaccessibility/inc/g_msacc.hxx
@@ -0,0 +1,27 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __G_MSACC_HXX
+#define __G_MSACC_HXX
+
+extern AccTopWindowListener* g_pTop;
+
+#endif
diff --git a/winaccessibility/inc/unomsaaevent.hxx b/winaccessibility/inc/unomsaaevent.hxx
new file mode 100644
index 000000000000..9f00a6cc10fd
--- /dev/null
+++ b/winaccessibility/inc/unomsaaevent.hxx
@@ -0,0 +1,110 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __UNOMSAAEVENT_HXX
+#define __UNOMSAAEVENT_HXX
+
+//STATE_CHANGED with get FOCUSED -> EVENT_OBJECT_FOCUS
+const short UM_EVENT_STATE_FOCUSED = 0 ;
+
+//STATE_CHANGED --> EVENT_OBJECT_STATECHANGE
+const short UM_EVENT_STATE_CHECKED = 1 ;
+const short UM_EVENT_STATE_ARMED = 2 ;
+const short UM_EVENT_STATE_PRESSED = 3 ;
+const short UM_EVENT_STATE_SELECTED = 4 ;
+const short UM_EVENT_STATE_SHOWING = 5 ;
+
+//if acc role is MENU_BAR, STATE_CHANGED with get FOCUSED -> EVENT_SYSTEM_MENUSTART
+const short UM_EVENT_MENU_START = 6 ;
+
+//if acc role is MENU_BAR, STATE_CHANGED with lose FOCUSED -> EVENT_SYSTEM_MENUEND
+const short UM_EVENT_MENU_END = 7 ;
+
+//if acc role is POPUP_MENU, STATE_CHANGED with get FOCUSED -> EVENT_SYSTEM_MENUPOPUPSTART
+const short UM_EVENT_MENUPOPUPSTART = 8 ;
+
+//if acc role is POPUP_MENU, STATE_CHANGED with lose FOCUSED -> EVENT_SYSTEM_MENUPOPUPEND
+const short UM_EVENT_MENUPOPUPEND = 9 ;
+
+//SELECTION_CHANGED -> EVENT_OBJECT_SELECTION
+const short UM_EVENT_SELECTION_CHANGED = 10 ;
+
+//INVALIDATE_ALL_CHILDREN --> EVENT_OBJECT_SHOW
+const short UM_EVENT_INVALIDATE_ALL_CHILDREN = 11 ;
+
+//VALUE_CHANGED --> EVENT_OBJECT_VALUECHANGE
+const short UM_EVENT_OBJECT_VALUECHANGE = 12 ;
+
+//NAME_CHANGED --> EVENT_OBJECT_NAMECHANGE
+const short UM_EVENT_OBJECT_NAMECHANGE = 13 ;
+
+//DESCRIPTION_CHANGED --> EVENT_OBJECT_DESCRIPTIONCHANGE
+const short UM_EVENT_OBJECT_DESCRIPTIONCHANGE = 14 ;
+
+//ACTION_CHANGED --> EVENT_OBJECT_DEFACTIONCHANGE
+const short UM_EVENT_OBJECT_DEFACTIONCHANGE = 15 ;
+
+//CARET_CHANGED --> EVENT_OBJECT_LOCATIONCHANGED
+const short UM_EVENT_OBJECT_CARETCHANGE = 16 ;
+
+//TEXT_CHANGED --> EVENT_OBJECT_VALUECHANGE
+const short UM_EVENT_OBJECT_TEXTCHANGE = 17 ;
+
+//ACTIVE_DESCENDANT_CHANGED --> EVENT_OBJECT_FOCUS
+const short UM_EVENT_ACTIVE_DESCENDANT_CHANGED = 18 ;
+
+//BOUNDRECT_CHANGED --> EVENT_OBJECT_LOCATIONCHANGE
+const short UM_EVENT_BOUNDRECT_CHANGED = 19 ;
+
+//VISIBLE_DATA_CHANGED --> EVENT_OBJECT_VALUECHANGE
+const short UM_EVENT_VISIBLE_DATA_CHANGED = 20 ;
+
+//to enable SHOW on dialogs, windows, frames
+const short UM_EVENT_SHOW = 21 ;
+
+const short UM_EVENT_STATE_BUSY = 22 ;
+
+const short UM_EVENT_TABLE_CAPTION_CHANGED = 24;
+const short UM_EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED = 25;
+const short UM_EVENT_TABLE_COLUMN_HEADER_CHANGED = 26;
+const short UM_EVENT_TABLE_MODEL_CHANGED = 27;
+const short UM_EVENT_TABLE_ROW_HEADER_CHANGED = 28;
+const short UM_EVENT_TABLE_SUMMARY_CHANGED = 29;
+const short UM_EVENT_OBJECT_REORDER = 30;
+const short UM_EVENT_PAGE_CHANGED =31;
+const short UM_EVENT_CHILD_ADDED =32;
+const short UM_EVENT_CHILD_REMOVED =33;
+const short UM_EVENT_TABLE_ROW_DESCRIPTION_CHANGED = 34;
+const short UM_EVENT_SELECTION_CHANGED_ADD = 35 ;
+const short UM_EVENT_SELECTION_CHANGED_REMOVE = 36 ;
+const short UM_EVENT_SELECTION_CHANGED_WITHIN = 37 ;
+
+//support for PAGE_CHANGED event
+const short UM_EVENT_OBJECT_PAGECHANGED = 38;
+
+//to add TEXT_SELECTION_CHANGED event
+const short UM_EVENT_TEXT_SELECTION_CHANGED = 39;
+
+//for section change and column chang event
+const short UM_EVENT_SECTION_CHANGED = 40;
+const short UM_EVENT_COLUMN_CHANGED = 41;
+
+#endif
diff --git a/winaccessibility/source/UAccCOM/AccAction.cxx b/winaccessibility/source/UAccCOM/AccAction.cxx
new file mode 100644
index 000000000000..fe233f4ef3ab
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccAction.cxx
@@ -0,0 +1,120 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+/**
+ * AccAction.cpp : Implementation of CAccAction
+ */
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccAction.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+ * Returns the number of action.
+ *
+ * @param nActions the number of action.
+ */
+STDMETHODIMP CAccAction::nActions(/*[out,retval]*/long* nActions)
+{
+
+ return CAccActionBase::nActions(nActions);
+}
+
+/**
+ * Performs specified action on the object.
+ *
+ * @param actionIndex the index of action.
+ */
+STDMETHODIMP CAccAction::doAction(/* [in] */ long actionIndex)
+{
+
+ return CAccActionBase::doAction(actionIndex);
+}
+
+/**
+ * Gets description of specified action.
+ *
+ * @param actionIndex the index of action.
+ * @param description the description string of the specified action.
+ */
+STDMETHODIMP CAccAction::get_description(long actionIndex,BSTR __RPC_FAR *description)
+{
+
+ return CAccActionBase::get_description(actionIndex, description);
+}
+
+STDMETHODIMP CAccAction::get_name( long actionIndex, BSTR __RPC_FAR *name)
+{
+
+ return CAccActionBase::get_name(actionIndex, name);
+}
+
+STDMETHODIMP CAccAction::get_localizedName( long actionIndex, BSTR __RPC_FAR *localizedName)
+{
+
+ return CAccActionBase::get_localizedName(actionIndex, localizedName);
+}
+
+/**
+ * Returns key binding object (if any) associated with specified action
+ * key binding is string.
+ * e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+ *
+ * @param actionIndex the index of action.
+ * @param nMaxBinding the max number of key binding.
+ * @param keyBinding the key binding array.
+ * @param nBinding the actual number of key binding returned.
+ */
+STDMETHODIMP CAccAction::get_keyBinding(
+ /* [in] */ long actionIndex,
+ /* [in] */ long nMaxBinding,
+ /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+ /* [retval][out] */ long __RPC_FAR *nBinding)
+{
+
+ return CAccActionBase::get_keyBinding(actionIndex, nMaxBinding, keyBinding, nBinding);
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param pXInterface the pointer of UNO interface.
+ */
+STDMETHODIMP CAccAction::put_XInterface(long pXInterface)
+{
+
+ return CAccActionBase::put_XInterface(pXInterface);
+}
+/**
+ * Put UNO interface.
+ * @param pXSubInterface XAccessibleHyperlink interface.
+ * @return Result.
+*/
+STDMETHODIMP CAccAction::put_XSubInterface(long pXSubInterface)
+{
+
+
+ pRXAct = (XAccessibleAction*)pXSubInterface;
+
+ return S_OK;
+}
diff --git a/winaccessibility/source/UAccCOM/AccAction.h b/winaccessibility/source/UAccCOM/AccAction.h
new file mode 100644
index 000000000000..01488b1dfbbc
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccAction.h
@@ -0,0 +1,105 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCACTION_H_
+#define __ACCACTION_H_
+
+#include "resource.h" // main symbols
+#include "AccActionBase.h"
+
+/**
+ * CAccAction implements IAccessibleAction interface.
+ */
+class ATL_NO_VTABLE CAccAction :
+ public CComObjectRoot,
+ public CComCoClass<CAccAction, &CLSID_AccAction>,
+ public IAccessibleAction,
+ public CAccActionBase
+{
+public:
+ CAccAction()
+ {
+
+ }
+ ~CAccAction()
+ {
+
+ }
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_ACCACTION)
+
+ BEGIN_COM_MAP(CAccAction)
+ COM_INTERFACE_ENTRY(IAccessibleAction)
+ COM_INTERFACE_ENTRY(IUNOXWrapper)
+ COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+ END_COM_MAP()
+
+ static HRESULT WINAPI _SmartQI(void* pv,
+ REFIID iid, void** ppvObject, DWORD)
+ {
+ return ((CAccAction*)pv)->SmartQI(iid,ppvObject);
+ }
+
+ HRESULT SmartQI(REFIID iid, void** ppvObject)
+ {
+ if( m_pOuterUnknown )
+ return OuterQueryInterface(iid,ppvObject);
+ return E_FAIL;
+ }
+
+ // IAccessibleAction
+public:
+ // IAccessibleAction
+
+ // Returns the number of action.
+ STDMETHOD(nActions)(/*[out,retval]*/long* nActions);
+
+ // Performs specified action on the object.
+ STDMETHOD(doAction)(/* [in] */ long actionIndex);
+
+ // Gets description of specified action.
+ STDMETHOD(get_description)(long actionIndex,BSTR __RPC_FAR *description);
+
+ // added , 2006/06/28, for driver 07/11
+ // get the action name
+ STDMETHOD(get_name)( long actionIndex, BSTR __RPC_FAR *name);
+
+ // get the localized action name
+ STDMETHOD(get_localizedName)( long actionIndex, BSTR __RPC_FAR *localizedName);
+
+ // Returns key binding object (if any) associated with specified action
+ // key binding is string.
+ // e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+ STDMETHOD(get_keyBinding)(
+ /* [in] */ long actionIndex,
+ /* [in] */ long nMaxBinding,
+ /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+ /* [retval][out] */ long __RPC_FAR *nBinding);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XSubInterface)(long pXSubInterface);
+
+};
+
+#endif //__ACCACTION_H_
diff --git a/winaccessibility/source/UAccCOM/AccAction.rgs b/winaccessibility/source/UAccCOM/AccAction.rgs
new file mode 100644
index 000000000000..7b51e7b701cf
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccAction.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+ UAccCOM.AccAction.1 = s 'AccAction Class'
+ {
+ CLSID = s '{AA49F20E-BB4E-400D-A5B0-6F5B7B770227}'
+ }
+ UAccCOM.AccAction = s 'AccAction Class'
+ {
+ CLSID = s '{AA49F20E-BB4E-400D-A5B0-6F5B7B770227}'
+ CurVer = s 'UAccCOM.AccAction.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {AA49F20E-BB4E-400D-A5B0-6F5B7B770227} = s 'AccAction Class'
+ {
+ ProgID = s 'UAccCOM.AccAction.1'
+ VersionIndependentProgID = s 'UAccCOM.AccAction'
+ ForceRemove 'Programmable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ 'TypeLib' = s '{19ECB1B0-9376-4FF9-B580-223FC9C200B8}'
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccActionBase.cxx b/winaccessibility/source/UAccCOM/AccActionBase.cxx
new file mode 100644
index 000000000000..bcad3c0df9c2
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccActionBase.cxx
@@ -0,0 +1,416 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+//////////////////////////////////////////////////////////////////////
+// AccActionBase.cpp: implementation of the CAccActionBase class.
+//////////////////////////////////////////////////////////////////////
+#include "stdafx.h"
+
+#include "AccActionBase.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+
+#include "AccessibleKeyStroke.h"
+
+#ifndef __ACCCOMMON_H_
+#include "acccommon.h"
+#endif
+
+using namespace com::sun::star::accessibility::AccessibleRole;
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::awt;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CAccActionBase::CAccActionBase()
+{}
+
+CAccActionBase::~CAccActionBase()
+{}
+
+/**
+ * Helper function used for getting default action by UNO role.
+ *
+ * @param pRContext UNO context interface pointer.
+ * @param pRet the corresponding string to be returned.
+ */
+void GetDfActionByUNORole(XAccessibleContext* pRContext, BSTR* pRet)
+{
+ // #CHECK#
+ if(pRContext == NULL || pRet == NULL)
+ {
+ return;
+ }
+
+ long Role = pRContext->getAccessibleRole();
+
+ switch(Role)
+ {
+ case PUSH_BUTTON:
+ *pRet = ::SysAllocString(PRESS);
+ break;
+ case RADIO_BUTTON:
+ case MENU_ITEM:
+ case LIST_ITEM:
+ *pRet = ::SysAllocString(SELECT);
+ break;
+ case CHECK_BOX:
+ {
+ Reference< XAccessibleStateSet > pRState = pRContext->getAccessibleStateSet();
+ if( !pRState.is() )
+ {
+ return;
+ }
+
+ Sequence<short> pStates = pRState->getStates();
+ int count = pStates.getLength();
+ *pRet = ::SysAllocString(CHECK);
+ for( int iIndex = 0;iIndex < count;iIndex++ )
+ {
+ if( pStates[iIndex] == AccessibleStateType::CHECKED )
+ {
+ SAFE_SYSFREESTRING(*pRet);
+ *pRet = ::SysAllocString(UNCHECK);
+ break;
+ }
+ }
+ break;
+ }
+ }
+}
+
+/**
+ * Returns the number of action.
+ *
+ * @param nActions the number of action.
+ */
+STDMETHODIMP CAccActionBase::nActions(/*[out,retval]*/long* nActions)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if( pRXAct.is() && nActions != NULL )
+ {
+ *nActions = GetXInterface()->getAccessibleActionCount();
+ return S_OK;
+ }
+ *nActions = 0;
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Performs specified action on the object.
+ *
+ * @param actionIndex the index of action.
+ */
+STDMETHODIMP CAccActionBase::doAction(/* [in] */ long actionIndex)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if( pRXAct.is() )
+ {
+ return GetXInterface()->doAccessibleAction( actionIndex )?S_OK:E_FAIL;
+ }
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets description of specified action.
+ *
+ * @param actionIndex the index of action.
+ * @param description the description string of the specified action.
+ */
+STDMETHODIMP CAccActionBase::get_description(long actionIndex,BSTR __RPC_FAR *description)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(description == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXAct.is())
+ return E_FAIL;
+
+ ::rtl::OUString ouStr = GetXInterface()->getAccessibleActionDescription(actionIndex);
+ // #CHECK#
+
+ SAFE_SYSFREESTRING(*description);
+ *description = SysAllocString((OLECHAR*)ouStr.getStr());
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CAccActionBase::get_name( long, BSTR __RPC_FAR *)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CAccActionBase::get_localizedName( long, BSTR __RPC_FAR *)
+{
+ return E_NOTIMPL;
+}
+
+/**
+ * Returns key binding object (if any) associated with specified action
+ * key binding is string.
+ * e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+ *
+ * @param actionIndex the index of action.
+ * @param nMaxBinding the max number of key binding.
+ * @param keyBinding the key binding array.
+ * @param nBinding the actual number of key binding returned.
+ */
+STDMETHODIMP CAccActionBase::get_keyBinding(
+ /* [in] */ long actionIndex,
+ /* [in] */ long,
+ /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+ /* [retval][out] */ long __RPC_FAR *nBinding)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if( !keyBinding || !nBinding)
+ return E_INVALIDARG;
+
+ if( !pRXAct.is() )
+ return E_FAIL;
+
+ Reference< XAccessibleKeyBinding > binding = GetXInterface()->getAccessibleActionKeyBinding(actionIndex);
+ if( !binding.is() )
+ return E_FAIL;
+
+ long nCount = (binding.get())->getAccessibleKeyBindingCount();
+
+ OLECHAR wString[64];
+
+ *keyBinding = (BSTR*)::CoTaskMemAlloc(nCount*sizeof(BSTR));
+
+ // #CHECK Memory Allocation#
+ if(*keyBinding == NULL)
+ return E_FAIL;
+
+ for( int index = 0;index < nCount;index++ )
+ {
+ memset(wString,0,sizeof(wString));
+ GetkeyBindingStrByXkeyBinding( (binding.get())->getAccessibleKeyBinding(index), wString );
+
+ (*keyBinding)[index] = SysAllocString(wString);
+ }
+
+ *nBinding = nCount;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param pXInterface the pointer of UNO interface.
+ */
+STDMETHODIMP CAccActionBase::put_XInterface(long pXInterface)
+{
+
+
+ ENTER_PROTECTED_BLOCK
+
+ CUNOXWrapper::put_XInterface(pXInterface);
+
+ //special query.
+ if(pUNOInterface == NULL)
+ return E_FAIL;
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ return E_FAIL;
+
+ Reference<XAccessibleAction> pRXI(pRContext,UNO_QUERY);
+ if( !pRXI.is() )
+ pRXAct = NULL;
+ else
+ pRXAct = pRXI.get();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Helper function used for converting keybinding to string.
+ *
+ * @param keySet the key stroke sequence.
+ * @param pString the output keybinding string.
+ */
+void CAccActionBase::GetkeyBindingStrByXkeyBinding( const Sequence< KeyStroke > &keySet, OLECHAR* pString )
+{
+ // #CHECK#
+ if(pString == NULL)
+ return;
+
+ for( int iIndex = 0;iIndex < keySet.getLength();iIndex++ )
+ {
+ KeyStroke stroke = keySet[iIndex];
+ OLECHAR wString[64] = {NULL};
+ if(iIndex>0)
+ wcscat( wString, OLESTR(" ") );
+ if((stroke.Modifiers & MODIFIER_SHIFT) == MODIFIER_SHIFT)
+ wcscat( wString, OLESTR("Shift+") );
+ if((stroke.Modifiers & MODIFIER_CTRL) == MODIFIER_CTRL)
+ wcscat( wString, OLESTR("Ctrl+") );
+ if((stroke.Modifiers & MODIFIER_ALT) == MODIFIER_ALT)
+ wcscat( wString, OLESTR("Alt+") );
+ if(stroke.KeyCode)
+ {
+ OLECHAR* pChar = getOLECHARFromKeyCode(stroke.KeyCode);
+ if(pChar != NULL)
+ wcscat( wString, pChar );
+ else if (stroke.KeyCode <= 255)
+ {
+ OLECHAR pChar[4] = {NULL};
+ swprintf( pChar, L"%c", stroke.KeyCode);
+ wcscat( wString, pChar);
+ }
+ else
+ {
+ OLECHAR pChar[4] = {NULL};
+ swprintf( pChar, L"%d", stroke.KeyCode);
+ wcscat( wString, pChar);
+ }
+ }
+
+ wcscat( pString, wString);
+ }
+}
+
+/**
+ * Helper function used for converting key code to ole string.
+ *
+ * @param key the key code.
+ */
+OLECHAR* CAccActionBase::getOLECHARFromKeyCode(long key)
+{
+ static struct keyMap
+ {
+ int keyCode;
+ OLECHAR* key;
+ }
+ map[] =
+ {
+ {MODIFIER_SHIFT, L"SHIFT" },
+ {MODIFIER_CTRL, L"CTRL" },
+ {MODIFIER_ALT, L"ALT" },
+ CODEENTRY(NUM0),CODEENTRY(NUM1),CODEENTRY(NUM2),CODEENTRY(NUM3),CODEENTRY(NUM4),CODEENTRY(NUM5),
+ CODEENTRY(NUM6),CODEENTRY(NUM7),CODEENTRY(NUM8),CODEENTRY(NUM9),
+ CODEENTRY(A),CODEENTRY(B),CODEENTRY(C),CODEENTRY(D),CODEENTRY(E),CODEENTRY(F),
+ CODEENTRY(G),CODEENTRY(H),CODEENTRY(I),CODEENTRY(J),CODEENTRY(K),CODEENTRY(L),
+ CODEENTRY(M),CODEENTRY(N),CODEENTRY(O),CODEENTRY(P),CODEENTRY(Q),CODEENTRY(R),
+ CODEENTRY(S),CODEENTRY(T),CODEENTRY(U),CODEENTRY(V),CODEENTRY(W),CODEENTRY(X),
+ CODEENTRY(Y),CODEENTRY(Z),
+ CODEENTRY(F1),CODEENTRY(F2),CODEENTRY(F3),CODEENTRY(F4),CODEENTRY(F5),CODEENTRY(F6),
+ CODEENTRY(F7),CODEENTRY(F8),CODEENTRY(F9),CODEENTRY(F10),CODEENTRY(F11),CODEENTRY(F12),
+ CODEENTRY(F13),CODEENTRY(F14),CODEENTRY(F15),CODEENTRY(F16),CODEENTRY(F17),CODEENTRY(F18),
+ CODEENTRY(F19),CODEENTRY(F20),CODEENTRY(F21),CODEENTRY(F22),CODEENTRY(F23),CODEENTRY(F24),
+ CODEENTRY(F25),CODEENTRY(F26),
+
+ { KEYCODE_DOWN, L"DOWN" },
+ { KEYCODE_UP, L"UP" },
+ { KEYCODE_LEFT, L"LEFT" },
+ { KEYCODE_RIGHT, L"RIGHT" },
+ { KEYCODE_HOME, L"HOME" },
+ { KEYCODE_END, L"END" },
+ { KEYCODE_PAGEUP, L"PAGEUP" },
+ { KEYCODE_PAGEDOWN, L"PAGEDOWN" },
+ { KEYCODE_RETURN, L"RETURN" },
+ { KEYCODE_ESCAPE, L"ESCAPE" },
+ { KEYCODE_TAB, L"TAB" },
+ { KEYCODE_BACKSPACE, L"BACKSPACE" },
+ { KEYCODE_SPACE, L"SPACE" },
+ { KEYCODE_INSERT, L"INSERT" },
+ { KEYCODE_DELETE, L"DELETE" },
+ { KEYCODE_ADD, L"ADD" },
+ { KEYCODE_SUBTRACT, L"SUBTRACT" },
+ { KEYCODE_MULTIPLY, L"MULTIPLY" },
+ { KEYCODE_DIVIDE, L"DIVIDE" },
+ { KEYCODE_POINT, L"POINT" },
+ { KEYCODE_COMMA, L"COMMA" },
+ { KEYCODE_LESS, L"LESS" },
+ { KEYCODE_GREATER, L"GREATER" },
+ { KEYCODE_EQUAL, L"EQUAL" },
+ { KEYCODE_OPEN, L"OPEN" },
+ { KEYCODE_CUT, L"CUT" },
+ { KEYCODE_COPY, L"COPY" },
+ { KEYCODE_PASTE, L"PASTE" },
+ { KEYCODE_UNDO, L"UNDO" },
+ { KEYCODE_REPEAT, L"REPEAT" },
+ { KEYCODE_FIND, L"FIND" },
+ { KEYCODE_PROPERTIES, L"PROPERTIES" },
+ { KEYCODE_FRONT, L"FRONT" },
+ { KEYCODE_CONTEXTMENU, L"CONTEXTMENU" },
+ { KEYCODE_HELP, L"HELP" },
+ };
+ static long nCount = countof(map);
+
+ long min = 0;
+ long max = nCount-1;
+ long mid = nCount/2;
+ while(min<max)
+ {
+ if(key<map[mid].keyCode)
+ max = mid-1;
+ else if(key>map[mid].keyCode)
+ min = mid+1;
+ else
+ break;
+ mid = (min+max)/2;
+ }
+
+ if(key == map[mid].keyCode)
+ {
+ return map[mid].key;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
diff --git a/winaccessibility/source/UAccCOM/AccActionBase.h b/winaccessibility/source/UAccCOM/AccActionBase.h
new file mode 100644
index 000000000000..349bd49ad6d8
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccActionBase.h
@@ -0,0 +1,92 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+//////////////////////////////////////////////////////////////////////
+// AccActionBase.h: interface for the CAccActionBase class.
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_ACCACTIONBASE_H__F87FAD24_D66E_4D22_9B24_3304A303DC84__INCLUDED_)
+#define AFX_ACCACTIONBASE_H__F87FAD24_D66E_4D22_9B24_3304A303DC84__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define WNT
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include "UNOXWrapper.h"
+
+class ATL_NO_VTABLE CAccActionBase : public CUNOXWrapper
+{
+public:
+ CAccActionBase();
+ virtual ~CAccActionBase();
+
+ // IAccessibleAction
+public:
+ // IAccessibleAction
+
+ // Returns the number of action.
+ STDMETHOD(nActions)(/*[out,retval]*/long* nActions);
+
+ // Performs specified action on the object.
+ STDMETHOD(doAction)(/* [in] */ long actionIndex);
+
+ // Gets description of specified action.
+ STDMETHOD(get_description)(long actionIndex,BSTR __RPC_FAR *description);
+
+ // added , 2006/06/28, for driver 07/11
+ // get the action name
+ STDMETHOD(get_name)( long actionIndex, BSTR __RPC_FAR *name);
+
+ // get the localized action Name
+ STDMETHOD(get_localizedName)( long actionIndex, BSTR __RPC_FAR *localizedName);
+
+ // Returns key binding object (if any) associated with specified action
+ // key binding is string.
+ // e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+ STDMETHOD(get_keyBinding)(
+ /* [in] */ long actionIndex,
+ /* [in] */ long nMaxBinding,
+ /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+ /* [retval][out] */ long __RPC_FAR *nBinding);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+ static void GetkeyBindingStrByXkeyBinding( const com::sun::star::uno::Sequence< com::sun::star::awt::KeyStroke > &keySet, OLECHAR* pString );
+
+protected:
+
+ static OLECHAR* getOLECHARFromKeyCode(long key);
+
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleAction> pRXAct;
+
+private:
+ inline com::sun::star::accessibility::XAccessibleAction* GetXInterface()
+ {
+ return pRXAct.get();
+ }
+};
+
+#endif // !defined(AFX_ACCACTIONBASE_H__F87FAD24_D66E_4D22_9B24_3304A303DC84__INCLUDED_)
diff --git a/winaccessibility/source/UAccCOM/AccComponent.cxx b/winaccessibility/source/UAccCOM/AccComponent.cxx
new file mode 100644
index 000000000000..b209ea5006db
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccComponent.cxx
@@ -0,0 +1,72 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+/**
+ * AccComponent.cpp : Implementation of CUAccCOMApp and DLL registration.
+ */
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccComponent.h"
+
+/**
+ * Returns the location of the upper left corner of the object's bounding
+ * box relative to the parent.
+ *
+ * @param Location the upper left corner of the object's bounding box.
+ */
+STDMETHODIMP CAccComponent::get_locationInParent(long *x, long *y)
+{
+
+ return CAccComponentBase::get_locationInParent(x,y);
+}
+
+/**
+ * Returns the foreground color of this object.
+ *
+ * @param Color the color of foreground.
+ */
+STDMETHODIMP CAccComponent::get_foreground(IA2Color * foreground)
+{
+
+ return CAccComponentBase::get_foreground(foreground);
+}
+
+/**
+ * Returns the background color of this object.
+ *
+ * @param Color the color of background.
+ */
+STDMETHODIMP CAccComponent::get_background(IA2Color * background)
+{
+
+ return CAccComponentBase::get_background(background);
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param pXInterface the pointer of UNO interface.
+ */
+STDMETHODIMP CAccComponent::put_XInterface(long pXInterface)
+{
+
+ return CAccComponentBase::put_XInterface(pXInterface);
+}
diff --git a/winaccessibility/source/UAccCOM/AccComponent.h b/winaccessibility/source/UAccCOM/AccComponent.h
new file mode 100644
index 000000000000..6544bbf273e4
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccComponent.h
@@ -0,0 +1,97 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#if !defined(AFX_ACCCOMPONENT_H__626D760C_3944_4B0E_BB4D_F0D20AEDF7DC__INCLUDED_)
+#define AFX_ACCCOMPONENT_H__626D760C_3944_4B0E_BB4D_F0D20AEDF7DC__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h" // main symbols
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include "UNOXWrapper.h"
+#include "AccComponentBase.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+ * CAccComponent implements IAccessibleComponent interface.
+ */
+class ATL_NO_VTABLE CAccComponent :
+ public CComObjectRoot,
+ public CComCoClass<CAccComponent,&CLSID_AccComponent>,
+ public IAccessibleComponent,
+ public CAccComponentBase
+{
+public:
+ CAccComponent()
+ {
+ }
+ ~CAccComponent()
+ {
+ }
+
+ BEGIN_COM_MAP(CAccComponent)
+ COM_INTERFACE_ENTRY(IAccessibleComponent)
+ COM_INTERFACE_ENTRY(IUNOXWrapper)
+ COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+ END_COM_MAP()
+
+ static HRESULT WINAPI _SmartQI(void* pv,
+ REFIID iid, void** ppvObject, DWORD)
+ {
+ return ((CAccComponent*)pv)->SmartQI(iid,ppvObject);
+ }
+
+ HRESULT SmartQI(REFIID iid, void** ppvObject)
+ {
+ if( m_pOuterUnknown )
+ return OuterQueryInterface(iid,ppvObject);
+ return E_FAIL;
+ }
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_AccComponent)
+
+ // IAccessibleComponent
+public:
+ // IAccessibleComponent
+
+ // Returns the location of the upper left corner of the object's bounding
+ // box relative to the parent.
+ STDMETHOD(get_locationInParent)(long *x, long *y);
+
+ // Returns the foreground color of this object.
+ STDMETHOD(get_foreground)(IA2Color * foreground);
+
+ // Returns the background color of this object.
+ STDMETHOD(get_background)(IA2Color * background);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+};
+
+#endif // !defined(AFX_ACCCOMPONENT_H__626D760C_3944_4B0E_BB4D_F0D20AEDF7DC__INCLUDED_)
diff --git a/winaccessibility/source/UAccCOM/AccComponent.rgs b/winaccessibility/source/UAccCOM/AccComponent.rgs
new file mode 100644
index 000000000000..ee87c169e969
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccComponent.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccComponent.1 = s 'AccComponent Class'
+ {
+ CLSID = s '{9FD9BA47-70AF-4160-99F1-526F2B9F111B}'
+ }
+ UAccCOM.AccComponent = s 'AccComponent Class'
+ {
+ CLSID = s '{9FD9BA47-70AF-4160-99F1-526F2B9F111B}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {9FD9BA47-70AF-4160-99F1-526F2B9F111B} = s 'AccComponent Class'
+ {
+ ProgID = s 'UAccCOM.AccComponent.1'
+ VersionIndependentProgID = s 'UAccCOM.AccComponent'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccComponentBase.cxx b/winaccessibility/source/UAccCOM/AccComponentBase.cxx
new file mode 100644
index 000000000000..234177e62d7d
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccComponentBase.cxx
@@ -0,0 +1,213 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+#include "AccComponentBase.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include "MAccessible.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CAccComponentBase::CAccComponentBase()
+{}
+
+CAccComponentBase::~CAccComponentBase()
+{}
+
+
+/**
+ * Returns the location of the upper left corner of the object's bounding
+ * box relative to the parent.
+ *
+ * @param Location the upper left corner of the object's bounding box.
+ */
+STDMETHODIMP CAccComponentBase::get_locationInParent(long *x, long *y)
+{
+
+ CHECK_ENABLE_INF
+
+ try
+ {
+ if (x == NULL || y == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXComp.is())
+ return E_FAIL;
+
+ const ::com::sun::star::awt::Point& pt = GetXInterface()->getLocation();
+ *x = pt.X;
+ *y = pt.Y;
+ return S_OK;
+ }
+ catch(...)
+ {
+ return E_FAIL;
+ }
+}
+
+/**
+ * Returns the location of the upper left corner of the object's bounding
+ * box in screen.
+ *
+ * @param Location the upper left corner of the object's bounding
+ * box in screen coordinates.
+ */
+STDMETHODIMP CAccComponentBase::get_locationOnScreen(long *x, long *y)
+{
+
+ CHECK_ENABLE_INF
+
+ try
+ {
+ if (x == NULL || y == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXComp.is())
+ return E_FAIL;
+
+ const ::com::sun::star::awt::Point& pt = GetXInterface()->getLocationOnScreen();
+ *x = pt.X;
+ *y = pt.Y;
+ return S_OK;
+
+ }
+ catch(...)
+ {
+ return E_FAIL;
+ }
+}
+
+/**
+ * Grabs the focus to this object.
+ *
+ * @param success the boolean result to be returned.
+ */
+STDMETHODIMP CAccComponentBase::grabFocus(boolean * success)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (success == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXComp.is())
+ {
+ return E_FAIL;
+ }
+ GetXInterface()->grabFocus();
+ *success = TRUE;
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Returns the foreground color of this object.
+ *
+ * @param Color the color of foreground.
+ */
+STDMETHODIMP CAccComponentBase::get_foreground(IA2Color * foreground)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (foreground == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXComp.is())
+ {
+ return E_FAIL;
+ }
+ *foreground = (long)GetXInterface()->getForeground();
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Returns the background color of this object.
+ *
+ * @param Color the color of background.
+ */
+STDMETHODIMP CAccComponentBase::get_background(IA2Color * background)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (background == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXComp.is())
+ {
+ return E_FAIL;
+ }
+ *background = (long)GetXInterface()->getBackground();
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param pXInterface the pointer of UNO interface.
+ */
+STDMETHODIMP CAccComponentBase::put_XInterface(long pXInterface)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ CUNOXWrapper::put_XInterface(pXInterface);
+ //special query.
+ if(pUNOInterface == NULL)
+ return E_FAIL;
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ {
+ return E_FAIL;
+ }
+ Reference<XAccessibleComponent> pRXI(pRContext,UNO_QUERY);
+ if( !pRXI.is() )
+ pRXComp = NULL;
+ else
+ pRXComp = pRXI.get();
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
diff --git a/winaccessibility/source/UAccCOM/AccComponentBase.h b/winaccessibility/source/UAccCOM/AccComponentBase.h
new file mode 100644
index 000000000000..6eed5782be91
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccComponentBase.h
@@ -0,0 +1,78 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+//////////////////////////////////////////////////////////////////////
+// AccComponentBase.h: interface for the CAccComponentBase class.
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_ACCCOMPONENTBASE_H__946BE230_1DCB_494B_ACF6_32A2E197DD2A__INCLUDED_)
+#define AFX_ACCCOMPONENTBASE_H__946BE230_1DCB_494B_ACF6_32A2E197DD2A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define WNT
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include "UNOXWrapper.h"
+
+class ATL_NO_VTABLE CAccComponentBase : public CUNOXWrapper
+{
+public:
+ CAccComponentBase();
+ virtual ~CAccComponentBase();
+ // IAccessibleComponent
+public:
+ // IAccessibleComponent
+
+ // Returns the location of the upper left corner of the object's bounding
+ // box relative to the parent.
+ STDMETHOD(get_locationInParent)(long *x, long *y);
+
+ // Returns the location of the upper left corner of the object's bounding
+ // box in screen.
+ STDMETHOD(get_locationOnScreen)(long *x, long *y);
+
+ // Grabs the focus to this object.
+ STDMETHOD(grabFocus)(boolean * success);
+
+ // Returns the foreground color of this object.
+ STDMETHOD(get_foreground)(IA2Color * foreground);
+
+ // Returns the background color of this object.
+ STDMETHOD(get_background)(IA2Color * background);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+protected:
+
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleComponent> pRXComp;
+
+ inline com::sun::star::accessibility::XAccessibleComponent* GetXInterface()
+ {
+ return pRXComp.get();
+ }
+};
+
+#endif // !defined(AFX_ACCCOMPONENTBASE_H__946BE230_1DCB_494B_ACF6_32A2E197DD2A__INCLUDED_)
diff --git a/winaccessibility/source/UAccCOM/AccContext.rgs b/winaccessibility/source/UAccCOM/AccContext.rgs
new file mode 100644
index 000000000000..b3e9e3a081da
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccContext.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccContext.1 = s 'AccContext Class'
+ {
+ CLSID = s '{F77CAEC2-F04C-4E74-A36C-F3B557BC59E1}'
+ }
+ UAccCOM.AccContext = s 'AccContext Class'
+ {
+ CLSID = s '{F77CAEC2-F04C-4E74-A36C-F3B557BC59E1}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {F77CAEC2-F04C-4E74-A36C-F3B557BC59E1} = s 'AccContext Class'
+ {
+ ProgID = s 'UAccCOM.AccContext.1'
+ VersionIndependentProgID = s 'UAccCOM.AccContext'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccEditableText.cxx b/winaccessibility/source/UAccCOM/AccEditableText.cxx
new file mode 100644
index 000000000000..2dce3b8e111a
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccEditableText.cxx
@@ -0,0 +1,508 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+/**
+ * AccEditableText.cpp : Implementation of CUAccCOMApp and DLL registration.
+ */
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccEditableText.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/TabStop.hpp>
+#include <vector>
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::awt;
+using namespace com::sun::star::beans;
+using namespace std;
+
+/**
+ * Copys a range of text to the clipboard.
+ *
+ * @param startOffset the start offset of copying.
+ * @param endOffset the end offset of copying.
+ * @param success the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::copyText(long startOffset, long endOffset)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK XInterface#
+ if(!pRXEdtTxt.is())
+ {
+ return E_FAIL;
+ }
+
+ if ( GetXInterface()->copyText( startOffset, endOffset ) )
+ return S_OK;
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Deletes a range of text.
+ *
+ * @param startOffset the start offset of deleting.
+ * @param endOffset the end offset of deleting.
+ * @param success the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::deleteText(long startOffset, long endOffset)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if( !pRXEdtTxt.is() )
+ return E_FAIL;
+
+ if( GetXInterface()->deleteText( startOffset, endOffset ) )
+ return S_OK;
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Inserts text at a specified offset.
+ *
+ * @param offset the offset of inserting.
+ * @param text the text to be inserted.
+ * @param success the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::insertText(long offset, BSTR * text)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (text == NULL)
+ return E_INVALIDARG;
+
+ if( !pRXEdtTxt.is() )
+ return E_FAIL;
+
+ ::rtl::OUString ouStr(*text);
+
+ if( GetXInterface()->insertText( ouStr, offset ) )
+ return S_OK;
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Cuts a range of text to the clipboard.
+ *
+ * @param startOffset the start offset of cuting.
+ * @param endOffset the end offset of cuting.
+ * @param success the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::cutText(long startOffset, long endOffset)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if( !pRXEdtTxt.is() )
+ return E_FAIL;
+
+ if( GetXInterface()->cutText( startOffset, endOffset ) )
+ return S_OK;
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Pastes text from clipboard at specified offset.
+ *
+ * @param offset the offset of pasting.
+ * @param success the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::pasteText(long offset)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if( !pRXEdtTxt.is() )
+ return E_FAIL;
+
+ if( GetXInterface()->pasteText( offset ) )
+ return S_OK;
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Replaces range of text with new text.
+ *
+ * @param startOffset the start offset of replacing.
+ * @param endOffset the end offset of replacing.
+ * @param text the replacing text.
+ * @param success the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::replaceText(long startOffset, long endOffset, BSTR * text)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if (text == NULL)
+ return E_INVALIDARG;
+ if( !pRXEdtTxt.is() )
+ return E_FAIL;
+
+ ::rtl::OUString ouStr(*text);
+
+ if( GetXInterface()->replaceText( startOffset,endOffset, ouStr) )
+ return S_OK;
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Sets attributes of range of text.
+ *
+ * @param startOffset the start offset.
+ * @param endOffset the end offset.
+ * @param attributes the attribute text.
+ * @param success the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, BSTR * attributes)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if (attributes == NULL)
+ return E_INVALIDARG;
+ if( !pRXEdtTxt.is() )
+ return E_FAIL;
+
+ ::rtl::OUString ouStr(*attributes);
+
+ sal_Int32 nIndex = 0;
+ sal_Unicode cTok = ';';
+ vector< ::rtl::OUString > vecAttr;
+ do
+ {
+ ::rtl::OUString ouToken = ouStr.getToken(0, cTok, nIndex);
+ vecAttr.push_back(ouToken);
+ }
+ while(nIndex >= 0);
+
+ Sequence< PropertyValue > beanSeq(vecAttr.size());
+ for(unsigned int i = 0; i < vecAttr.size(); i ++)
+ {
+ ::rtl::OUString attr = vecAttr[i];
+ sal_Int32 nPos = attr.indexOf(':');
+ if(nPos > -1)
+ {
+ ::rtl::OUString attrName = attr.copy(0, nPos);
+ ::rtl::OUString attrValue = attr.copy(nPos + 1, attr.getLength() - nPos - 1);
+ beanSeq[i].Name = attrName;
+ get_AnyFromOLECHAR(attrName, attrValue, beanSeq[i].Value);
+ }
+ }
+
+ if( GetXInterface()->setAttributes( startOffset,endOffset, beanSeq) )
+ return S_OK;
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Convert attributes string to Any type.
+ * Reference to infra\accessibility\bridge\org\openoffice\java\accessibility\AccessibleTextImpl.java
+ *
+ * @param ouName the string of attribute name.
+ * @param ouValue the string of attribute value.
+ * @param rAny the Any object to be returned.
+ */
+void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, Any &rAny)
+{
+ if(ouName.compareTo(L"CharBackColor") == 0 ||
+ ouName.compareTo(L"CharColor") == 0 ||
+ ouName.compareTo(L"ParaAdjust") == 0 ||
+ ouName.compareTo(L"ParaFirstLineIndent") == 0 ||
+ ouName.compareTo(L"ParaLeftMargin") == 0 ||
+ ouName.compareTo(L"ParaRightMargin") == 0 ||
+ ouName.compareTo(L"ParaTopMargin") == 0 ||
+ ouName.compareTo(L"ParaBottomMargin") == 0 ||
+ ouName.compareTo(L"CharFontPitch") == 0)
+ {
+ // Convert to int.
+ // NOTE: CharFontPitch is not implemented in java file.
+ sal_Int32 nValue = ouValue.toInt32();
+ rAny.setValue(&nValue, getCppuType((sal_Int32 *)0));
+ }
+ else if(ouName.compareTo(L"CharShadowed") == 0 ||
+ ouName.compareTo(L"CharContoured") == 0)
+ {
+ // Convert to boolean.
+ boolean nValue = (boolean)ouValue.toBoolean();
+ rAny.setValue(&nValue, getCppuType((sal_Bool *)sal_False));
+ }
+ else if(ouName.compareTo(L"CharEscapement") == 0 ||
+ ouName.compareTo(L"CharStrikeout") == 0 ||
+ ouName.compareTo(L"CharUnderline") == 0 ||
+ ouName.compareTo(L"CharFontPitch") == 0)
+ {
+ // Convert to short.
+ short nValue = (short)ouValue.toInt32();
+ rAny.setValue(&nValue, getCppuType((short *)0));
+ }
+ else if(ouName.compareTo(L"CharHeight") == 0 ||
+ ouName.compareTo(L"CharWeight") == 0)
+ {
+ // Convert to float.
+ float fValue = ouValue.toFloat();
+ rAny.setValue(&fValue, getCppuType((float *)0));
+ }
+ else if(ouName.compareTo(L"CharFontName") == 0)
+ {
+ // Convert to string.
+ rAny.setValue(&ouValue, getCppuType((::rtl::OUString *)0));
+ }
+ else if(ouName.compareTo(L"CharPosture") == 0)
+ {
+ // Convert to FontSlant.
+ ::com::sun::star::awt::FontSlant fontSlant = (::com::sun::star::awt::FontSlant)ouValue.toInt32();
+ rAny.setValue(&fontSlant, getCppuType((::com::sun::star::awt::FontSlant*)0));
+ }
+ else if(ouName.compareTo(L"ParaTabStops") == 0)
+ {
+ //
+ // Convert to the Sequence with TabStop element.
+ vector< ::com::sun::star::style::TabStop > vecTabStop;
+ ::com::sun::star::style::TabStop tabStop;
+ ::rtl::OUString ouSubValue;
+ sal_Int32 nIndex = 0;
+ sal_Int32 pos = 0, posComma = 0;
+
+ do
+ {
+ // Position.
+ pos = ouValue.indexOf(L"Position=", pos);
+ if(pos != -1)
+ {
+ posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "Position=".
+ if(posComma != -1)
+ {
+ ouSubValue = ouValue.copy(pos + 9, posComma - pos - 9);
+ tabStop.Position = ouSubValue.toInt32();
+ pos = posComma + 1;
+
+ // TabAlign.
+ pos = ouValue.indexOf(L"TabAlign=", pos);
+ if(pos != -1)
+ {
+ posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=".
+ if(posComma != -1)
+ {
+ ouSubValue = ouValue.copy(pos + 9, posComma - pos - 9);
+ tabStop.Alignment = (::com::sun::star::style::TabAlign)ouSubValue.toInt32();
+ pos = posComma + 1;
+
+ // DecimalChar.
+ pos = ouValue.indexOf(L"DecimalChar=", pos);
+ if(pos != -1)
+ {
+ posComma = ouValue.indexOf(',', pos + 11); // 11 = length of "TabAlign=".
+ if(posComma != -1)
+ {
+ ouSubValue = ouValue.copy(pos + 11, posComma - pos - 11);
+ tabStop.DecimalChar = (sal_Unicode)ouSubValue.toChar();
+ pos = posComma + 1;
+
+ // FillChar.
+ pos = ouValue.indexOf(L"FillChar=", pos);
+ if(pos != -1)
+ {
+ posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=".
+ if(posComma != -1)
+ {
+ ouSubValue = ouValue.copy(pos + 9, posComma - pos - 9);
+ tabStop.DecimalChar = (sal_Unicode)ouSubValue.toChar();
+ pos = posComma + 1;
+
+ // Complete TabStop element.
+ vecTabStop.push_back(tabStop);
+ }
+ else
+ break; // No match comma.
+ }
+ else
+ break; // No match FillChar.
+ }
+ else
+ break; // No match comma.
+ }
+ else
+ break; // No match DecimalChar.
+ }
+ else
+ break; // No match comma.
+ }
+ else
+ break; // No match TabAlign.
+ }
+ else
+ break; // No match comma.
+ }
+ else
+ break; // No match Position.
+ }
+ while(pos < ouValue.getLength());
+
+ //
+ // Dump into Sequence.
+ int iSeqLen = (vecTabStop.size() == 0) ? 1 : vecTabStop.size();
+ Sequence< ::com::sun::star::style::TabStop > seqTabStop(iSeqLen);
+
+ if(vecTabStop.size() != 0)
+ {
+ // Dump every element.
+ for(int i = 0; i < iSeqLen; i ++)
+ {
+ seqTabStop[i] = vecTabStop[i];
+ }
+ }
+ else
+ {
+ // Create default value.
+ seqTabStop[0].Position = 0;
+ seqTabStop[0].Alignment = ::com::sun::star::style::TabAlign_DEFAULT;
+ seqTabStop[0].DecimalChar = '.';
+ seqTabStop[0].FillChar = ' ';
+ }
+
+ // Assign to Any object.
+ rAny.setValue(&seqTabStop, getCppuType((Sequence< ::com::sun::star::style::TabStop >*)0));
+ }
+ else if(ouName.compareTo(L"ParaLineSpacing") == 0)
+ {
+ // Parse value string.
+ ::com::sun::star::style::LineSpacing lineSpacing;
+ ::rtl::OUString ouSubValue;
+ sal_Int32 pos = 0, posComma = 0;
+
+ pos = ouValue.indexOf(L"Mode=", pos);
+ if(pos != -1)
+ {
+ posComma = ouValue.indexOf(',', pos + 5); // 5 = length of "Mode=".
+ if(posComma != -1)
+ {
+ ouSubValue = ouValue.copy(pos + 5, posComma - pos - 5);
+ lineSpacing.Mode = (sal_Int16)ouSubValue.toInt32();
+ pos = posComma + 1;
+
+ pos = ouValue.indexOf(L"Height=", pos);
+ if(pos != -1)
+ {
+ ouSubValue = ouValue.copy(pos + 7, ouValue.getLength() - pos - 7);
+ lineSpacing.Height = (sal_Int16)ouSubValue.toInt32();
+ }
+ else
+ {
+ lineSpacing.Height = (sal_Int16)100; // Default height.
+ }
+ }
+ else
+ {
+ lineSpacing.Height = (sal_Int16)100; // Default height.
+ }
+ }
+ else
+ {
+ // Default Mode and Height.
+ lineSpacing.Mode = (sal_Int16)0;
+ lineSpacing.Height = (sal_Int16)100; // Default height.
+ }
+
+ // Convert to Any object.
+ rAny.setValue(&lineSpacing, getCppuType((::com::sun::star::style::LineSpacing* )0));
+ }
+ else
+ {
+ // Do nothing.
+ sal_Int32 nDefault = 0;
+ rAny.setValue(&nDefault, getCppuType((sal_Int32 *)0));
+ }
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param pXInterface the pointer of UNO interface.
+ */
+STDMETHODIMP CAccEditableText::put_XInterface(long pXInterface)
+{
+
+
+ ENTER_PROTECTED_BLOCK
+
+ CUNOXWrapper::put_XInterface(pXInterface);
+ //special query.
+ if(pUNOInterface == NULL)
+ return E_FAIL;
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ {
+ return E_FAIL;
+ }
+ Reference<XAccessibleEditableText> pRXI(pRContext,UNO_QUERY);
+ if( !pRXI.is() )
+ pRXEdtTxt = NULL;
+ else
+ pRXEdtTxt = pRXI.get();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
diff --git a/winaccessibility/source/UAccCOM/AccEditableText.h b/winaccessibility/source/UAccCOM/AccEditableText.h
new file mode 100644
index 000000000000..8542a740a5ee
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccEditableText.h
@@ -0,0 +1,115 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#if !defined(AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_)
+#define AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h"
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#include "UNOXWrapper.h"
+
+/**
+ * CAccEditableText implements IAccessibleEditableText interface.
+ */
+class CAccEditableText :
+ public CComObjectRoot,
+ public CComCoClass<CAccEditableText,&CLSID_AccEditableText>,
+ public IAccessibleEditableText,
+ public CUNOXWrapper
+{
+public:
+ CAccEditableText()
+ {
+
+ }
+ virtual ~CAccEditableText()
+ {
+
+ }
+
+ BEGIN_COM_MAP(CAccEditableText)
+ COM_INTERFACE_ENTRY(IAccessibleEditableText)
+ COM_INTERFACE_ENTRY(IUNOXWrapper)
+ COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+ END_COM_MAP()
+
+ static HRESULT WINAPI _SmartQI(void* pv,
+ REFIID iid, void** ppvObject, DWORD)
+ {
+ return ((CAccEditableText*)pv)->SmartQI(iid,ppvObject);
+ }
+
+ HRESULT SmartQI(REFIID iid, void** ppvObject)
+ {
+ if( m_pOuterUnknown )
+ return OuterQueryInterface(iid,ppvObject);
+ return E_FAIL;
+ }
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_AccEditableText)
+
+ // IAccessibleEditableText
+public:
+ // IAccessibleEditableText
+
+ // Copys a range of text to the clipboard.
+ STDMETHOD(copyText)(long startOffset, long endOffset);
+
+ // Deletes a range of text.
+ STDMETHOD(deleteText)(long startOffset, long endOffset);
+
+ // Inserts text at a specified offset.
+ STDMETHOD(insertText)(long offset, BSTR * text);
+
+ // Cuts a range of text to the clipboard.
+ STDMETHOD(cutText)(long startOffset, long endOffset);
+
+ // Pastes text from clipboard at specified offset.
+ STDMETHOD(pasteText)(long offset);
+
+ // Replaces range of text with new text.
+ STDMETHOD(replaceText)(long startOffset, long endOffset, BSTR * text);
+
+
+ // Sets attributes of range of text.
+ STDMETHOD(setAttributes)(long startOffset, long endOffset, BSTR * attributes);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEditableText> pRXEdtTxt;
+
+ void get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, com::sun::star::uno::Any &rAny);
+
+ inline com::sun::star::accessibility::XAccessibleEditableText* GetXInterface()
+ {
+ return pRXEdtTxt.get();
+ }
+};
+
+#endif // !defined(AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_)
diff --git a/winaccessibility/source/UAccCOM/AccEditableText.rgs b/winaccessibility/source/UAccCOM/AccEditableText.rgs
new file mode 100644
index 000000000000..03aacb325719
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccEditableText.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccEditableText.1 = s 'AccEditableText Class'
+ {
+ CLSID = s '{79CE1450-1F61-48E2-BF76-C07BD10105E2}'
+ }
+ UAccCOM.AccEditableText = s 'AccEditableText Class'
+ {
+ CLSID = s '{79CE1450-1F61-48E2-BF76-C07BD10105E2}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {79CE1450-1F61-48E2-BF76-C07BD10105E2} = s 'AccEditableText Class'
+ {
+ ProgID = s 'UAccCOM.AccEditableText.1'
+ VersionIndependentProgID = s 'UAccCOM.AccEditableText'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccExtendedComponent.rgs b/winaccessibility/source/UAccCOM/AccExtendedComponent.rgs
new file mode 100644
index 000000000000..6039885b357d
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccExtendedComponent.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccExtendedComponent.1 = s 'AccExtendedComponent Class'
+ {
+ CLSID = s '{D91562E1-BE6C-41F3-A34C-E7AA846561A4}'
+ }
+ UAccCOM.AccExtendedComponent = s 'AccExtendedComponent Class'
+ {
+ CLSID = s '{D91562E1-BE6C-41F3-A34C-E7AA846561A4}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {D91562E1-BE6C-41F3-A34C-E7AA846561A4} = s 'AccExtendedComponent Class'
+ {
+ ProgID = s 'UAccCOM.AccExtendedComponent.1'
+ VersionIndependentProgID = s 'UAccCOM.AccExtendedComponent'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccFont.rgs b/winaccessibility/source/UAccCOM/AccFont.rgs
new file mode 100644
index 000000000000..c229746dbca6
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccFont.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccFont.1 = s 'AccFont Class'
+ {
+ CLSID = s '{185B9AD9-5D31-4793-888F-A21846BBAEDD}'
+ }
+ UAccCOM.AccFont = s 'AccFont Class'
+ {
+ CLSID = s '{185B9AD9-5D31-4793-888F-A21846BBAEDD}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {185B9AD9-5D31-4793-888F-A21846BBAEDD} = s 'AccFont Class'
+ {
+ ProgID = s 'UAccCOM.AccFont.1'
+ VersionIndependentProgID = s 'UAccCOM.AccFont'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccHyperLink.cxx b/winaccessibility/source/UAccCOM/AccHyperLink.cxx
new file mode 100644
index 000000000000..b63ccd09e246
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccHyperLink.cxx
@@ -0,0 +1,296 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccHyperLink.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include "MAccessible.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::awt;
+
+/**
+ * Returns the number of action.
+ *
+ * @param nActions the number of action.
+ */
+STDMETHODIMP CAccHyperLink::nActions(/*[out,retval]*/long* nActions)
+{
+
+ return CAccActionBase::nActions(nActions);
+}
+
+/**
+ * Performs specified action on the object.
+ *
+ * @param actionIndex the index of action.
+ */
+STDMETHODIMP CAccHyperLink::doAction(/* [in] */ long actionIndex)
+{
+
+ return CAccActionBase::doAction(actionIndex);
+}
+
+/**
+ * Gets description of specified action.
+ *
+ * @param actionIndex the index of action.
+ * @param description the description string of the specified action.
+ */
+STDMETHODIMP CAccHyperLink::get_description(long actionIndex,BSTR __RPC_FAR *description)
+{
+
+ return CAccActionBase::get_description(actionIndex, description);
+}
+
+STDMETHODIMP CAccHyperLink::get_name( long actionIndex, BSTR __RPC_FAR *name)
+{
+
+ return CAccActionBase::get_name(actionIndex, name);
+}
+
+STDMETHODIMP CAccHyperLink::get_localizedName( long actionIndex, BSTR __RPC_FAR *localizedName)
+{
+
+ return CAccActionBase::get_name(actionIndex, localizedName);
+}
+
+/**
+ * Returns key binding object (if any) associated with specified action
+ * key binding is string.
+ * e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+ *
+ * @param actionIndex the index of action.
+ * @param nMaxBinding the max number of key binding.
+ * @param keyBinding the key binding array.
+ * @param nBinding the actual number of key binding returned.
+ */
+STDMETHODIMP CAccHyperLink::get_keyBinding(
+ /* [in] */ long actionIndex,
+ /* [in] */ long nMaxBinding,
+ /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+ /* [retval][out] */ long __RPC_FAR *nBinding)
+{
+
+ return CAccActionBase::get_keyBinding(actionIndex, nMaxBinding, keyBinding, nBinding);
+}
+
+/**
+ * get an object
+ * @param
+ * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::get_anchor(/* [in] */ long index,
+ /* [retval][out] */ VARIANT __RPC_FAR *anchor)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(anchor == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ // #CHECK XInterface#
+ if(!pRXLink.is())
+ {
+ return E_FAIL;
+ }
+ // Get Any type value via pRXLink.
+ ::com::sun::star::uno::Any anyVal = GetXInterface()->getAccessibleActionAnchor(index);
+ // Convert Any to VARIANT.
+ CMAccessible::ConvertAnyToVariant(anyVal, anchor);
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * get an object
+ * @param
+ * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::get_anchorTarget(/* [in] */ long index,
+ /* [retval][out] */ VARIANT __RPC_FAR *anchorTarget)
+{
+
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(anchorTarget == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ // #CHECK XInterface#
+ if(!pRXLink.is())
+ {
+ return E_FAIL;
+ }
+ // Get Any type value via pRXLink.
+ ::com::sun::star::uno::Any anyVal = GetXInterface()->getAccessibleActionObject(index);
+ // Convert Any to VARIANT.
+ CMAccessible::ConvertAnyToVariant(anyVal, anchorTarget);
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+
+/**
+ * Get start index.
+ * @param index Variant to get start index.
+ * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR *index)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(index == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ *index = GetXInterface()->getStartIndex();
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get start index.
+ * @param index Variant to get end index.
+ * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR *index)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(index == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ // #CHECK XInterface#
+ if(!pRXLink.is())
+ {
+ return E_FAIL;
+ }
+ *index = GetXInterface()->getEndIndex();
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Judge if the hyperlink is valid.
+ * @param valid Variant to get validity.
+ * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR *valid)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(valid == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ // #CHECK XInterface#
+ if(!pRXLink.is())
+ {
+ return E_FAIL;
+ }
+ *valid = GetXInterface()->isValid();
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Put UNO interface.
+ * @param pXInterface XAccessibleContext interface.
+ * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::put_XInterface(long pXInterface)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ CAccActionBase::put_XInterface(pXInterface);
+ //special query.
+ if(pUNOInterface != NULL)
+ {
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ {
+ return E_FAIL;
+ }
+ Reference<XAccessibleHyperlink> pRXI(pRContext,UNO_QUERY);
+ if( !pRXI.is() )
+ {
+ pRXLink = NULL;
+ }
+ else
+ pRXLink = pRXI.get();
+ }
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Put UNO interface.
+ * @param pXSubInterface XAccessibleHyperlink interface.
+ * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::put_XSubInterface(long pXSubInterface)
+{
+
+ CHECK_ENABLE_INF
+
+ pRXLink = (XAccessibleHyperlink*)pXSubInterface;
+ pRXAct = (XAccessibleAction*)pXSubInterface;
+
+ return S_OK;
+}
diff --git a/winaccessibility/source/UAccCOM/AccHyperLink.h b/winaccessibility/source/UAccCOM/AccHyperLink.h
new file mode 100644
index 000000000000..56415c225ca3
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccHyperLink.h
@@ -0,0 +1,140 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#if !defined(AFX_ACCHYPERLINK_H__59DA79A5_A895_43DB_9495_2B2049CF5C65__INCLUDED_)
+#define AFX_ACCHYPERLINK_H__59DA79A5_A895_43DB_9495_2B2049CF5C65__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h" // main symbols
+
+
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#include "AccActionBase.h"
+#include "UNOXWrapper.h"
+
+/**
+ * CAccHyperLink implements IAccessibleHyperlink interface.
+ */
+class ATL_NO_VTABLE CAccHyperLink :
+ public CComObjectRoot,
+ public CComCoClass<CAccHyperLink,&CLSID_AccHyperLink>,
+ public IAccessibleHyperlink,
+ public CAccActionBase
+{
+public:
+ CAccHyperLink()
+ {
+ }
+ ~CAccHyperLink()
+ {
+ }
+
+ BEGIN_COM_MAP(CAccHyperLink)
+ COM_INTERFACE_ENTRY(IAccessibleAction)
+ COM_INTERFACE_ENTRY(IAccessibleHyperlink)
+ COM_INTERFACE_ENTRY(IUNOXWrapper)
+ END_COM_MAP()
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_AccHyperLink)
+
+ static HRESULT WINAPI _SmartQI(void* pv,
+ REFIID iid, void** ppvObject, DWORD)
+ {
+ return ((CAccHyperLink*)pv)->SmartQI(iid,ppvObject);
+ }
+
+ HRESULT SmartQI(REFIID iid, void** ppvObject)
+ {
+ if( m_pOuterUnknown )
+ return OuterQueryInterface(iid,ppvObject);
+ return E_FAIL;
+ }
+
+ // IAccessibleHyperlink
+public:
+ // IAccessibleAction
+
+ // Returns the number of action.
+ STDMETHOD(nActions)(/*[out,retval]*/long* nActions);
+
+ // Performs specified action on the object.
+ STDMETHOD(doAction)(/* [in] */ long actionIndex);
+
+ // get the action name
+ STDMETHOD(get_name)( long actionIndex, BSTR __RPC_FAR *name);
+
+ // get the localized action name
+ STDMETHOD(get_localizedName)( long actionIndex, BSTR __RPC_FAR *localizedName);
+
+ // Gets description of specified action.
+ STDMETHOD(get_description)(long actionIndex,BSTR __RPC_FAR *description);
+
+ // Returns key binding object (if any) associated with specified action
+ // key binding is string.
+ // e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+ STDMETHOD(get_keyBinding)(
+ /* [in] */ long actionIndex,
+ /* [in] */ long nMaxBinding,
+ /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+ /* [retval][out] */ long __RPC_FAR *nBinding);
+
+ // IAccessibleHyperlink
+
+ // get an object, e.g. BSTR or image object, that is overloaded with link behavior
+ STDMETHOD(get_anchor)(/* [in] */ long index,
+ /* [retval][out] */ VARIANT __RPC_FAR *anchor);
+
+ // get an object representing the target of the link, usually a BSTR of the URI
+ STDMETHOD(get_anchorTarget)(/* [in] */ long index,
+ /* [retval][out] */ VARIANT __RPC_FAR *anchorTarget);
+
+ // Returns the index at which the textual representation of the
+ // hyperlink (group) starts.
+ STDMETHOD(get_startIndex)(/* [retval][out] */ long __RPC_FAR *index);
+
+ // Returns the index at which the textual rerpesentation of the
+ // hyperlink (group) ends.
+ STDMETHOD(get_endIndex)(/* [retval][out] */ long __RPC_FAR *index);
+
+ // Returns whether the document referenced by this links is still valid.
+ STDMETHOD(get_valid)(/* [retval][out] */ boolean __RPC_FAR *valid);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XSubInterface)(long pXSubInterface);
+
+private:
+
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleHyperlink> pRXLink;
+
+ inline com::sun::star::accessibility::XAccessibleHyperlink* GetXInterface()
+ {
+ return pRXLink.get();
+ }
+
+};
+
+#endif // !defined(AFX_ACCHYPERLINK_H__59DA79A5_A895_43DB_9495_2B2049CF5C65__INCLUDED_)
diff --git a/winaccessibility/source/UAccCOM/AccHyperLink.rgs b/winaccessibility/source/UAccCOM/AccHyperLink.rgs
new file mode 100644
index 000000000000..ceb622ee0e95
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccHyperLink.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccHyperLink.1 = s 'AccHyperLink Class'
+ {
+ CLSID = s '{519A64CD-F6A6-4793-BE50-4E36C4C593EF}'
+ }
+ UAccCOM.AccHyperLink = s 'AccHyperLink Class'
+ {
+ CLSID = s '{519A64CD-F6A6-4793-BE50-4E36C4C593EF}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {519A64CD-F6A6-4793-BE50-4E36C4C593EF} = s 'AccHyperLink Class'
+ {
+ ProgID = s 'UAccCOM.AccHyperLink.1'
+ VersionIndependentProgID = s 'UAccCOM.AccHyperLink'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccHypertext.cxx b/winaccessibility/source/UAccCOM/AccHypertext.cxx
new file mode 100644
index 000000000000..5e0e40d82d2c
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccHypertext.cxx
@@ -0,0 +1,409 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccHypertext.h"
+
+#include "act.hxx"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+/**
+ * Get special selection.
+ * @param startOffset Start selection offset.
+ * @param endOffset End selection offset.
+ * @param success Variant to accept the result of if the method call is successful.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::addSelection(long startOffset, long endOffset)
+{
+
+ return CAccTextBase::get_addSelection(startOffset, endOffset);
+}
+
+
+/**
+ * Get special attributes.
+ * @param offset Offset.
+ * @param startOffset Variant to accept start offset.
+ * @param endOffset Variant to accept end offset.
+ * @param textAttributes Variant to accept attributes.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_attributes(long offset, long * startOffset, long * endOffset, BSTR * textAttributes)
+{
+
+ return CAccTextBase::get_attributes(offset, startOffset, endOffset, textAttributes);
+}
+
+/**
+ * Get caret position.
+ * @param offset Variant to accept caret offset.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_caretOffset(long * offset)
+{
+
+ return CAccTextBase::get_caretOffset(offset);
+}
+
+/**
+ * Get character count.
+ * @param nCharacters Variant to accept character count.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_characterCount(long * nCharacters)
+{
+
+ return CAccTextBase::get_characterCount(nCharacters);
+}
+
+/**
+ * Get character extents.
+ * @param offset Offset.
+ * @param x Variant to accpet x position.
+ * @param y Variant to accpet y position.
+ * @param width Variant to accpet width.
+ * @param Height Variant to accpet height.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_characterExtents(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height)
+{
+
+ return CAccTextBase::get_characterExtents(offset, coordType, x, y, width, height);
+}
+
+/**
+ * Get slections count.
+ * @param nSelections Variant to accpet slections count.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_nSelections(long * nSelections)
+{
+
+ return CAccTextBase::get_nSelections(nSelections);
+}
+
+/**
+ * Get offset of some special point.
+ * @param x X position of one point.
+ * @param x Y position of one point.
+ * @param coordType Type.
+ * @param offset Variant to accept offset.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_offsetAtPoint(long x, long y, IA2CoordinateType coordType, long * offset)
+{
+ return CAccTextBase::get_offsetAtPoint(x, y, coordType, offset);
+}
+
+/**
+ * Get selection range.
+ * @param selection selection count.
+ * @param startOffset Variant to accept the start offset of special selection.
+ * @param endOffset Variant to accept the end offset of special selection.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_selection(long selection, long * startOffset, long * endOffset)
+{
+
+ return CAccTextBase::get_selection(selection, startOffset, endOffset);
+}
+
+/**
+ * Get special text.
+ * @param startOffset Start position of special range.
+ * @param endOffset End position of special range.
+ * @param text Variant to accept the text of special range.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_text(long startOffset, long endOffset, BSTR * text)
+{
+
+ return CAccTextBase::get_text(startOffset, endOffset, text);
+}
+
+/**
+ * Get special text before some position.
+ * @param offset Special position.
+ * @param boundaryType Boundary type.
+ * @param startOffset Variant to accept the start offset.
+ * @param endOffset Variant to accept the end offset.
+ * @param text Variant to accept the special text.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+
+ return CAccTextBase::get_textBeforeOffset(offset, boundaryType,
+ startOffset, endOffset, text);
+}
+
+/**
+ * Get special text after some position.
+ * @param offset Special position.
+ * @param boundaryType Boundary type.
+ * @param startOffset Variant to accept the start offset.
+ * @param endOffset Variant to accept the end offset.
+ * @param text Variant to accept the special text.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+
+ return CAccTextBase::get_textAfterOffset(offset, boundaryType,
+ startOffset, endOffset, text);
+}
+
+/**
+ * Get special text at some position.
+ * @param offset Special position.
+ * @param boundaryType Boundary type.
+ * @param startOffset Variant to accept the start offset.
+ * @param endOffset Variant to accept the end offset.
+ * @param text Variant to accept the special text.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+
+ return CAccTextBase::get_textAtOffset(offset, boundaryType,
+ startOffset, endOffset, text);
+}
+
+/**
+ * Remove selection.
+ * @param selectionIndex Special selection index
+ * @param success Variant to accept the memthod called result.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::removeSelection(long selectionIndex)
+{
+
+ return CAccTextBase::removeSelection(selectionIndex);
+}
+
+/**
+ * Set caret position.
+ * @param offset Special position.
+ * @param success Variant to accept the memthod called result.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::setCaretOffset(long offset)
+{
+
+ return CAccTextBase::setCaretOffset(offset);
+}
+
+/**
+ * Set special selection.
+ * @param selectionIndex Special selection index.
+ * @param startOffset start position.
+ * @param endOffset end position.
+ * @param success Variant to accept the memthod called result.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::setSelection(long selectionIndex, long startOffset, long endOffset)
+{
+
+ return CAccTextBase::setSelection(selectionIndex, startOffset,
+ endOffset);
+}
+
+/**
+ * Get characters count.
+ * @param nCharacters Variant to accept the characters count.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_nCharacters(long * nCharacters)
+{
+
+ return CAccTextBase::get_nCharacters(nCharacters);
+}
+
+STDMETHODIMP CAccHypertext::get_newText( IA2TextSegment *newText)
+{
+ return CAccTextBase::get_newText(newText);
+}
+
+STDMETHODIMP CAccHypertext::get_oldText( IA2TextSegment *oldText)
+{
+ return CAccTextBase::get_oldText(oldText);
+}
+
+/**
+ * Scroll to special sub-string .
+ * @param startIndex Start index of sub string.
+ * @param endIndex End index of sub string.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::scrollSubstringToPoint(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y )
+{
+
+ return CAccTextBase::scrollSubstringToPoint(startIndex, endIndex, coordinateType, x, y);
+}
+STDMETHODIMP CAccHypertext::scrollSubstringTo(long startIndex, long endIndex,enum IA2ScrollType scrollType)
+{
+
+ return CAccTextBase::scrollSubstringTo(startIndex, endIndex,scrollType);
+}
+
+/**
+ * Get hyperlink count.
+ * @param hyperlinkCount Variant to accpet hyperlink count.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_nHyperlinks(long *hyperlinkCount)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(hyperlinkCount == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pHyperText.is())
+ {
+ return E_FAIL;
+ }
+
+ *hyperlinkCount = pHyperText->getHyperLinkCount();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get special hyperlink.
+ * @param index Special hyperlink index.
+ * @param hyperlink Variant to accept special hyperlink via index.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_hyperlink(long index,IAccessibleHyperlink **hyperlink)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(hyperlink == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pHyperText.is())
+ {
+ return E_FAIL;
+ }
+
+ Reference<XAccessibleHyperlink> pRLink = pHyperText->getHyperLink(index);
+ if(!pRLink.is())
+ {
+ *hyperlink = NULL;
+ return E_FAIL;
+ }
+
+ IAccessibleHyperlink* plink = NULL;
+ ActivateActContext();
+ HRESULT hr = CoCreateInstance( CLSID_AccHyperLink, NULL, CLSCTX_SERVER ,
+ IID_IAccessibleHyperlink,
+ (void **)&plink);
+ DeactivateActContext();
+ if( SUCCEEDED(hr) )
+ {
+ IUNOXWrapper* wrapper = NULL;
+ plink->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper);
+ if(wrapper)
+ {
+ wrapper->put_XSubInterface((long)pRLink.get()/*pXI*/);
+ wrapper->Release();
+ }
+ *hyperlink = plink;
+ return S_OK;
+ }
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Returns the index of the hyperlink that is associated with this character index.
+ * @param charIndex Special char index.
+ * @param hyperlinkIndex Variant to accept special hyperlink index.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_hyperlinkIndex(long charIndex, long *hyperlinkIndex)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(hyperlinkIndex == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pHyperText.is())
+ {
+ return E_FAIL;
+ }
+
+ *hyperlinkIndex = pHyperText->getHyperLinkIndex(charIndex);
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Put UNO interface.
+ * @param pXInterface UNO interface.
+ * @return Result.
+*/
+STDMETHODIMP CAccHypertext::put_XInterface(long pXInterface)
+{
+
+
+ ENTER_PROTECTED_BLOCK
+
+ CAccTextBase::put_XInterface(pXInterface);
+ //special query.
+ if(pUNOInterface == NULL)
+ return E_FAIL;
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ {
+ return E_FAIL;
+ }
+ Reference<XAccessibleHypertext> pRXI(pRContext,UNO_QUERY);
+ if( !pRXI.is() )
+ pHyperText = NULL;
+ else
+ pHyperText = pRXI.get();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
diff --git a/winaccessibility/source/UAccCOM/AccHypertext.h b/winaccessibility/source/UAccCOM/AccHypertext.h
new file mode 100644
index 000000000000..5a817d20f492
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccHypertext.h
@@ -0,0 +1,161 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#if !defined(AFX_ACCHYPERTEXT_H__6DC133B6_03DB_42C6_A9B7_27AF4FDA00CA__INCLUDED_)
+#define AFX_ACCHYPERTEXT_H__6DC133B6_03DB_42C6_A9B7_27AF4FDA00CA__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h" // main symbols
+
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#include "AccTextBase.h"
+
+/**
+ * CAccHypertext implements IAccessibleHypertext interface.
+ */
+class ATL_NO_VTABLE CAccHypertext :
+ public CComObjectRoot,
+ public CComCoClass<CAccHypertext,&CLSID_AccHypertext>,
+ public IAccessibleHypertext,
+ public CAccTextBase
+{
+public:
+ CAccHypertext()
+ {
+ }
+ ~CAccHypertext()
+ {
+ }
+
+ BEGIN_COM_MAP(CAccHypertext)
+ COM_INTERFACE_ENTRY(IAccessibleText)
+ COM_INTERFACE_ENTRY(IAccessibleHypertext)
+ COM_INTERFACE_ENTRY(IUNOXWrapper)
+ COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+ END_COM_MAP()
+
+ static HRESULT WINAPI _SmartQI(void* pv,
+ REFIID iid, void** ppvObject, DWORD)
+ {
+ return ((CAccHypertext*)pv)->SmartQI(iid,ppvObject);
+ }
+
+ HRESULT SmartQI(REFIID iid, void** ppvObject)
+ {
+ if( m_pOuterUnknown )
+ return OuterQueryInterface(iid,ppvObject);
+ return E_FAIL;
+ }
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_AccHypertext)
+
+ // IAccessibleHypertext
+public:
+ // IAccessibleText
+
+ // Adds a text selection.
+ STDMETHOD(addSelection)(long startOffset, long endOffset);//, unsigned char * success)
+
+ // Gets text attributes.
+ STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes);
+
+ // Gets caret offset.
+ STDMETHOD(get_caretOffset)(long * offset);
+
+ // Gets total number of characters.
+ STDMETHOD(get_characterCount)(long * nCharacters);
+
+ // Gets bounding rect containing the glyph(s) representing the character
+ // at the specified text offset
+ STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height);
+
+ // Gets number of active non-contiguous selections.
+ STDMETHOD(get_nSelections)(long * nSelections);
+
+ // Gets bounding rect for the glyph at a certain point.
+ STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset);
+
+ // Gets character offsets of N-th active text selection.
+ STDMETHOD(get_selection)(long selection, long * startOffset, long * endOffset);
+
+ // Gets a range of text by offset NOTE: returned string may be longer
+ // than endOffset-startOffset bytes if text contains multi-byte characters.
+ STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text);
+
+ // Gets a specified amount of text that ends before a specified offset.
+ STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+ // Gets a specified amount of text that spans the specified offset.
+ STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+ // Gets a specified amount of text that starts after a specified offset.
+ STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+ // Unselects a range of text.
+ STDMETHOD(removeSelection)(long selectionIndex);
+
+ // Moves text caret.
+ STDMETHOD(setCaretOffset)(long offset);
+
+ // Changes the bounds of an existing selection.
+ STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset);
+
+ // Gets total number of characters.
+ // NOTE: this may be different than the total number of bytes required
+ // to store the text, if the text contains multi-byte characters.
+ STDMETHOD(get_nCharacters)(long * nCharacters);
+
+ // Makes specific part of string visible on screen.
+ STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType);
+
+ STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y );
+
+ STDMETHOD(get_newText)( IA2TextSegment *newText);
+
+ STDMETHOD(get_oldText)( IA2TextSegment *oldText);
+
+ //IAccessibleHypertext
+
+ // Gets the number of hyperlink.
+ STDMETHOD(get_nHyperlinks)(long *hyperlinkCount);
+
+ // Gets the hyperlink object via specified index.
+ STDMETHOD(get_hyperlink)(long index,IAccessibleHyperlink **hyperlink);
+
+ // Returns the index of the hyperlink that is associated with this
+ // character index.
+ STDMETHOD(get_hyperlinkIndex)(long charIndex, long *hyperlinkIndex);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleHypertext> pHyperText;
+
+};
+
+#endif // !defined(AFX_ACCHYPERTEXT_H__6DC133B6_03DB_42C6_A9B7_27AF4FDA00CA__INCLUDED_)
diff --git a/winaccessibility/source/UAccCOM/AccHypertext.rgs b/winaccessibility/source/UAccCOM/AccHypertext.rgs
new file mode 100644
index 000000000000..6baf54496e6a
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccHypertext.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccHypertext.1 = s 'AccHypertext Class'
+ {
+ CLSID = s '{CC55D71B-1828-4EE0-89E2-C3749CF9C9AB}'
+ }
+ UAccCOM.AccHypertext = s 'AccHypertext Class'
+ {
+ CLSID = s '{CC55D71B-1828-4EE0-89E2-C3749CF9C9AB}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {CC55D71B-1828-4EE0-89E2-C3749CF9C9AB} = s 'AccHypertext Class'
+ {
+ ProgID = s 'UAccCOM.AccHypertext.1'
+ VersionIndependentProgID = s 'UAccCOM.AccHypertext'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccImage.cxx b/winaccessibility/source/UAccCOM/AccImage.cxx
new file mode 100644
index 000000000000..7e3ba7699443
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccImage.cxx
@@ -0,0 +1,102 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccImage.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+ * Get description.
+ * @param description Variant to get description.
+ * @return Result.
+*/
+STDMETHODIMP CAccImage::get_description(BSTR * description)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if (description == NULL)
+ return E_INVALIDARG;
+ if( !pRXImg.is() )
+ return E_FAIL;
+
+ ::rtl::OUString ouStr = GetXInterface()->getAccessibleImageDescription();
+ SAFE_SYSFREESTRING(*description);
+ *description = SysAllocString((OLECHAR*)ouStr.getStr());
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CAccImage::get_imagePosition(
+ /* [in] */ enum IA2CoordinateType,
+ /* [out] */ long __RPC_FAR *,
+ /* [retval][out] */ long __RPC_FAR *)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CAccImage::get_imageSize(
+ /* [out] */ long __RPC_FAR *,
+ /* [retval][out] */ long __RPC_FAR *)
+{
+ return E_NOTIMPL;
+}
+
+/**
+ * Put UNO interface.
+ * @param pXInterface UNO interface.
+ * @return Result.
+*/
+STDMETHODIMP CAccImage::put_XInterface(long pXInterface)
+{
+
+
+ ENTER_PROTECTED_BLOCK
+
+ CUNOXWrapper::put_XInterface(pXInterface);
+ //special query.
+ if(pUNOInterface == NULL)
+ return E_FAIL;
+
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ {
+ return E_FAIL;
+ }
+ Reference<XAccessibleImage> pRXI(pRContext,UNO_QUERY);
+ if( !pRXI.is() )
+ pRXImg = NULL;
+ else
+ pRXImg = pRXI.get();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
diff --git a/winaccessibility/source/UAccCOM/AccImage.h b/winaccessibility/source/UAccCOM/AccImage.h
new file mode 100644
index 000000000000..41921f9480fe
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccImage.h
@@ -0,0 +1,101 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#if !defined(AFX_ACCIMAGE_H__D5E55275_CCD4_497F_8E77_F9B391D2F4A8__INCLUDED_)
+#define AFX_ACCIMAGE_H__D5E55275_CCD4_497F_8E77_F9B391D2F4A8__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h" // main symbols
+
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleImage.hpp>
+#include "UNOXWrapper.h"
+
+/**
+ * CAccImage implements IAccessibleImage interface.
+ */
+class ATL_NO_VTABLE CAccImage :
+ public CComObjectRoot,
+ public CComCoClass<CAccImage,&CLSID_AccImage>,
+ public IAccessibleImage,
+ public CUNOXWrapper
+{
+public:
+ CAccImage()
+ {
+ }
+ virtual ~CAccImage()
+ {
+ }
+ BEGIN_COM_MAP(CAccImage)
+ COM_INTERFACE_ENTRY(IAccessibleImage)
+ COM_INTERFACE_ENTRY(IUNOXWrapper)
+ COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+ END_COM_MAP()
+
+ static HRESULT WINAPI _SmartQI(void* pv,
+ REFIID iid, void** ppvObject, DWORD)
+ {
+ return ((CAccImage*)pv)->SmartQI(iid,ppvObject);
+ }
+
+ HRESULT SmartQI(REFIID iid, void** ppvObject)
+ {
+ if( m_pOuterUnknown )
+ return OuterQueryInterface(iid,ppvObject);
+ return E_FAIL;
+ }
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_AccImage)
+
+ // IAccessibleImage
+public:
+ // IAccessibleImage
+
+ // Gets the description of the image.
+ STDMETHOD(get_description)(BSTR * description);
+
+ STDMETHOD(get_imagePosition)( enum IA2CoordinateType coordinateType,
+ long __RPC_FAR *x,
+ long __RPC_FAR *y);
+
+ STDMETHOD(get_imageSize)(
+ long __RPC_FAR *height,
+ long __RPC_FAR *width);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleImage> pRXImg;
+
+ inline com::sun::star::accessibility::XAccessibleImage* GetXInterface()
+ {
+ return pRXImg.get();
+ }
+};
+
+#endif // !defined(AFX_ACCIMAGE_H__D5E55275_CCD4_497F_8E77_F9B391D2F4A8__INCLUDED_)
diff --git a/winaccessibility/source/UAccCOM/AccImage.rgs b/winaccessibility/source/UAccCOM/AccImage.rgs
new file mode 100644
index 000000000000..9be96fd3e777
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccImage.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccImage.1 = s 'AccImage Class'
+ {
+ CLSID = s '{73A45800-7A62-432C-A1A6-BF8852994331}'
+ }
+ UAccCOM.AccImage = s 'AccImage Class'
+ {
+ CLSID = s '{73A45800-7A62-432C-A1A6-BF8852994331}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {73A45800-7A62-432C-A1A6-BF8852994331} = s 'AccImage Class'
+ {
+ ProgID = s 'UAccCOM.AccImage.1'
+ VersionIndependentProgID = s 'UAccCOM.AccImage'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccKeyBinding.rgs b/winaccessibility/source/UAccCOM/AccKeyBinding.rgs
new file mode 100644
index 000000000000..6967bf2b6458
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccKeyBinding.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccKeyBinding.1 = s 'AccKeyBinding Class'
+ {
+ CLSID = s '{98AFE6FB-D748-4313-B4D6-E7B273B6255D}'
+ }
+ UAccCOM.AccKeyBinding = s 'AccKeyBinding Class'
+ {
+ CLSID = s '{98AFE6FB-D748-4313-B4D6-E7B273B6255D}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {98AFE6FB-D748-4313-B4D6-E7B273B6255D} = s 'AccKeyBinding Class'
+ {
+ ProgID = s 'UAccCOM.AccKeyBinding.1'
+ VersionIndependentProgID = s 'UAccCOM.AccKeyBinding'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccRelation.cxx b/winaccessibility/source/UAccCOM/AccRelation.cxx
new file mode 100644
index 000000000000..1eb261575be7
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccRelation.cxx
@@ -0,0 +1,214 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccRelation.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include "MAccessible.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+ * Get relation type.
+ * @param relationType Variant to get relation type.
+ * @return Result.
+*/
+STDMETHODIMP CAccRelation::get_relationType(BSTR * relationType)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (relationType == NULL)
+ return E_INVALIDARG;
+
+ int type = relation.RelationType;
+ SAFE_SYSFREESTRING(*relationType);
+
+ *relationType = getRelationTypeBSTR(type);
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+// Gets what the type of localized relation is.
+STDMETHODIMP CAccRelation::get_localizedRelationType(BSTR *)
+{
+
+
+ ENTER_PROTECTED_BLOCK
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get targets length.
+ * @param nTargets Variant to get targets length.
+ * @return Result.
+*/
+STDMETHODIMP CAccRelation::get_nTargets(long * nTargets)
+{
+
+
+ ENTER_PROTECTED_BLOCK
+
+ CHECK_ENABLE_INF
+ if (nTargets == NULL)
+ return E_INVALIDARG;
+
+ Sequence< Reference< XInterface > > xTargets = relation.TargetSet;
+ *nTargets = xTargets.getLength();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get special target.
+ * @param targetIndex target index.
+ * @param target Variant to get special target.
+ * @return Result.
+*/
+STDMETHODIMP CAccRelation::get_target(long targetIndex, IUnknown * * target)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (target == NULL)
+ return E_FAIL;
+
+ Sequence< Reference< XInterface > > xTargets = relation.TargetSet;
+ int nCount = xTargets.getLength();
+ if( targetIndex >= nCount )
+ return E_FAIL;
+
+ Reference<XInterface> pRAcc = xTargets[targetIndex];
+ IAccessible* pRet = NULL;
+
+ BOOL isGet = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet);
+ if(isGet)
+ {
+ *target = /*(IAccessible2 *)*/(IUnknown*)pRet;
+ pRet->AddRef();
+ return S_OK;
+ }
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get special targets.
+ * @param maxTargets Special targets count.
+ * @param target Variant to get special target.
+ * @param nTargets Variant to accept actual target length.
+ * @return Result.
+*/
+STDMETHODIMP CAccRelation::get_targets(long, IUnknown * * target, long * nTargets)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(target == NULL)
+ return E_INVALIDARG;
+ if (nTargets == NULL)
+ return E_INVALIDARG;
+
+ Sequence< Reference< XInterface > > xTargets = relation.TargetSet;
+ int nCount = xTargets.getLength();
+
+ *target = (IUnknown*)::CoTaskMemAlloc(nCount*sizeof(IUnknown));
+
+ // #CHECK Memory Allocation#
+ if(*target == NULL)
+ {
+ return E_FAIL;
+ }
+
+ for(int i=0; i<nCount ; i++)
+ {
+ IUnknown* pAcc = NULL;
+ HRESULT hr = get_target(i,&pAcc);
+ if(SUCCEEDED(hr))
+ target[i] = pAcc;
+ }
+
+ *nTargets = nCount;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Put UNO interface.
+ * @param pXSubInterface AccessibleRelation pointer.
+ * @return Result.
+*/
+STDMETHODIMP CAccRelation::put_XSubInterface(long pXSubInterface)
+{
+
+ relation = *((AccessibleRelation*)pXSubInterface);
+ return S_OK;
+}
+
+/**
+ * Get relation type string by type.
+ * @param type Relation type.
+ * @return relation type string.
+*/
+BSTR CAccRelation::getRelationTypeBSTR(int type)
+{
+ static struct TYPE_BSTR_MAP
+ {
+ LPCTSTR string;
+ int type;
+ }
+ map[] =
+ {
+ {_T("INVALID") , 0},
+ {IA2_RELATION_FLOWS_FROM , 1},
+ {IA2_RELATION_FLOWS_TO , 2},
+ {IA2_RELATION_CONTROLLED_BY , 3},
+ {IA2_RELATION_CONTROLLER_FOR, 4},
+ {IA2_RELATION_LABEL_FOR , 5},
+ {IA2_RELATION_LABELED_BY , 6},
+ {IA2_RELATION_MEMBER_OF , 7},
+ {IA2_RELATION_SUBWINDOW_OF , 8},
+ {IA2_RELATION_NODE_CHILD_OF, 9},
+ {IA2_RELATION_DESCRIBED_BY , 10},
+ };
+
+ USES_CONVERSION;
+
+ return (type >= 0 && type <= 10) ? T2BSTR(map[type].string) : _T("");
+}
diff --git a/winaccessibility/source/UAccCOM/AccRelation.h b/winaccessibility/source/UAccCOM/AccRelation.h
new file mode 100644
index 000000000000..a7903f7dc571
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccRelation.h
@@ -0,0 +1,88 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCRELATION_H_
+#define __ACCRELATION_H_
+
+#include "resource.h" // main symbols
+
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include "UNOXWrapper.h"
+
+/**
+ * CAccRelation implements IAccessibleRelation interface.
+ */
+class ATL_NO_VTABLE CAccRelation :
+ public CComObjectRoot,
+ public CComCoClass<CAccRelation, &CLSID_AccRelation>,
+ public IAccessibleRelation,
+ public CUNOXWrapper
+{
+public:
+ CAccRelation()
+ {
+ }
+ virtual ~CAccRelation()
+ {
+ }
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_ACCRELATION)
+
+ DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+ BEGIN_COM_MAP(CAccRelation)
+ COM_INTERFACE_ENTRY(IAccessibleRelation)
+ COM_INTERFACE_ENTRY(IUNOXWrapper)
+ END_COM_MAP()
+
+ // IAccessibleRelation
+public:
+ // IAccessibleRelation
+
+ // Gets what the type of relation is.
+ STDMETHOD(get_relationType)(BSTR * relationType);
+
+ // Gets what the type of localized relation is.
+ STDMETHOD(get_localizedRelationType)(BSTR * relationType);
+
+ // Gets how many targets this relation have.
+ STDMETHOD(get_nTargets)(long * nTargets);
+
+ // Gets one accessible relation target.
+ STDMETHOD(get_target)(long targetIndex, IUnknown * * target);
+
+ // Gets multiple accessible relation targets.
+ STDMETHOD(get_targets)(long maxTargets, IUnknown * * target, long * nTargets);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XSubInterface)(long pXSubInterface);
+
+ //static OLECHAR* getRelationTypeOLECHAR(int type);
+ static BSTR getRelationTypeBSTR(int type);
+
+private:
+
+ com::sun::star::accessibility::AccessibleRelation relation;
+};
+
+#endif //__ACCRELATION_H_
diff --git a/winaccessibility/source/UAccCOM/AccRelation.rgs b/winaccessibility/source/UAccCOM/AccRelation.rgs
new file mode 100644
index 000000000000..3a7d3d2c6ed1
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccRelation.rgs
@@ -0,0 +1,25 @@
+HKCR
+{
+ UAccCOM.AccRelation.1 = s 'AccRelation Class'
+ {
+ CLSID = s '{8745CF0C-3104-4BAE-B7D0-D7B1717C006E}'
+ }
+ UAccCOM.AccRelation = s 'AccRelation Class'
+ {
+ CLSID = s '{8745CF0C-3104-4BAE-B7D0-D7B1717C006E}'
+ CurVer = s 'UAccCOM.AccRelation.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {8745CF0C-3104-4BAE-B7D0-D7B1717C006E} = s 'AccRelation Class'
+ {
+ ProgID = s 'UAccCOM.AccRelation.1'
+ VersionIndependentProgID = s 'UAccCOM.AccRelation'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Apartment'
+ }
+ 'TypeLib' = s '{19ECB1B0-9376-4FF9-B580-223FC9C200B8}'
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccSelection.rgs b/winaccessibility/source/UAccCOM/AccSelection.rgs
new file mode 100644
index 000000000000..484099086c5d
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccSelection.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccSelection.1 = s 'AccSelection Class'
+ {
+ CLSID = s '{9B83B8C3-3592-4C29-8682-559E37368E95}'
+ }
+ UAccCOM.AccSelection = s 'AccSelection Class'
+ {
+ CLSID = s '{9B83B8C3-3592-4C29-8682-559E37368E95}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {9B83B8C3-3592-4C29-8682-559E37368E95} = s 'AccSelection Class'
+ {
+ ProgID = s 'UAccCOM.AccSelection.1'
+ VersionIndependentProgID = s 'UAccCOM.AccSelection'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccTable.cxx b/winaccessibility/source/UAccCOM/AccTable.cxx
new file mode 100644
index 000000000000..4ad5e22c782e
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccTable.cxx
@@ -0,0 +1,1069 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+/**
+ * AccTable.cpp : Implementation of CAccTable.
+ */
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccTable.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include "MAccessible.h"
+
+#include "act.hxx"
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLETABLEEXTENT_HPP_
+#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
+#endif
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+/**
+ * Gets accessible table cell.
+ *
+ * @param row the row of the specified cell.
+ * @param column the column of the specified cell.
+ * @param accessible the accessible object of the cell.
+ */
+
+STDMETHODIMP CAccTable::get_accessibleAt(long row, long column, IUnknown * * accessible)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(accessible == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Reference<XAccessible> pRAcc = GetXInterface()->getAccessibleCellAt(row,column);
+
+ if(!pRAcc.is())
+ {
+ *accessible = NULL;
+ return E_FAIL;
+ }
+
+ IAccessible* pRet = NULL;
+
+ BOOL isTRUE = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet);
+ if(isTRUE)
+ {
+ *accessible = (IAccessible2 *)pRet;
+ pRet->AddRef();
+ return S_OK;
+ }
+ else if(pRAcc.is())
+ {
+ Reference<XAccessible> pxTable(GetXInterface(),UNO_QUERY);
+
+ CMAccessible::g_pAgent->InsertAccObj(pRAcc.get(),pxTable.get());
+ isTRUE = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet);
+
+ if(isTRUE)
+ {
+ *accessible = (IAccessible2 *)pRet;
+ pRet->AddRef();
+ return S_OK;
+ }
+ }
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets accessible table caption.
+ *
+ * @param accessible the accessible object of table cpation.
+ */
+STDMETHODIMP CAccTable::get_caption(IUnknown * *)
+{
+
+
+ ENTER_PROTECTED_BLOCK
+
+ return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets accessible column description (as string).
+ *
+ * @param column the column index.
+ * @param description the description of the specified column.
+ */
+STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(description == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ const ::rtl::OUString& ouStr = GetXInterface()->getAccessibleColumnDescription(column);
+ // #CHECK#
+
+ SAFE_SYSFREESTRING(*description);//??
+ *description = SysAllocString((OLECHAR*)ouStr.getStr());
+ if(description==NULL)
+ return E_FAIL;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets number of columns spanned by table cell.
+ *
+ * @param row the row of the specified cell.
+ * @param column the column of the specified cell.
+ * @param spanColumns the column span of the specified cell.
+ */
+STDMETHODIMP CAccTable::get_columnExtentAt(long row, long column, long * nColumnsSpanned)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ XAccessibleTable *pXAccTable = GetXInterface();
+
+ // Check pointer.
+ if(nColumnsSpanned == NULL)
+ return E_INVALIDARG;
+
+ // Get Extent.
+ if(pXAccTable)
+ {
+ long lExt = pXAccTable->getAccessibleColumnExtentAt(row,column);
+
+ // Fill Extent struct.
+ *nColumnsSpanned = lExt;
+ return S_OK;
+ }
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets accessible column header.
+ *
+ * @param column the column index.
+ * @param accessible the accessible object of the specified column.
+ */
+STDMETHODIMP CAccTable::get_columnHeader(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingRowIndex)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(accessibleTable == NULL || startingRowIndex == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Reference<XAccessibleTable> pRColumnHeaderTable = GetXInterface()->getAccessibleColumnHeaders();
+ if(!pRColumnHeaderTable.is())
+ {
+ *accessibleTable = NULL;
+ return E_FAIL;
+ }
+
+ Reference<XAccessible> pRXColumnHeader(pRColumnHeaderTable,UNO_QUERY);
+
+ if(!pRXColumnHeader.is())
+ {
+ *accessibleTable = NULL;
+ return E_FAIL;
+ }
+ *startingRowIndex = 0 ;
+
+ IAccessible* m_pIMacc = NULL;
+ ActivateActContext();
+ HRESULT hr = CoCreateInstance( CLSID_MAccessible, NULL, CLSCTX_ALL ,
+ IID_IMAccessible,
+ (void **)&m_pIMacc
+ );
+ DeactivateActContext();
+ ((CMAccessible*)m_pIMacc)->SetXAccessible((long)pRXColumnHeader.get());
+ m_pIMacc->QueryInterface(IID_IAccessibleTable,(void **)accessibleTable);
+ if( SUCCEEDED(hr) )
+ {
+ return S_OK;
+ }
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets total number of columns in table.
+ *
+ * @param columnCount the number of columns in table.
+ */
+STDMETHODIMP CAccTable::get_nColumns(long * columnCount)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(columnCount == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ *columnCount = GetXInterface()->getAccessibleColumnCount();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets total number of rows in table.
+ *
+ * @param rowCount the number of rows in table.
+ */
+STDMETHODIMP CAccTable::get_nRows(long * rowCount)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(rowCount == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ *rowCount = GetXInterface()->getAccessibleRowCount();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets total number of selected columns.
+ *
+ * @param columnCount the number of selected columns.
+ */
+STDMETHODIMP CAccTable::get_nSelectedColumns(long * columnCount)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(columnCount == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleColumns();
+ *columnCount = pSelected.getLength();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets total number of selected rows.
+ *
+ * @param rowCount the number of selected rows.
+ */
+STDMETHODIMP CAccTable::get_nSelectedRows(long * rowCount)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(rowCount == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleRows();
+ *rowCount = pSelected.getLength();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets accessible row description (as string).
+ *
+ * @param row the row index.
+ * @param description the description of the specified row.
+ */
+STDMETHODIMP CAccTable::get_rowDescription(long row, BSTR * description)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(description == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ const ::rtl::OUString& ouStr = GetXInterface()->getAccessibleRowDescription(row);
+ // #CHECK#
+
+ SAFE_SYSFREESTRING(*description);
+ *description = SysAllocString((OLECHAR*)ouStr.getStr());
+ if(description==NULL)
+ return E_FAIL;
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets number of rows spanned by a table cell.
+ *
+ * @param row the row of the specified cell.
+ * @param column the column of the specified cell.
+ * @param spanRows the row span of the specified cell.
+ */
+STDMETHODIMP CAccTable::get_rowExtentAt(long row, long column, long * nRowsSpanned)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ XAccessibleTable *pXAccTable = GetXInterface();
+
+ // Check pointer.
+ if(nRowsSpanned == NULL)
+ return E_INVALIDARG;
+
+ // Get Extent.
+ if(pXAccTable)
+ {
+ long lExt = GetXInterface()->getAccessibleRowExtentAt(row,column);
+
+ // Fill Extent struct.
+ *nRowsSpanned= lExt;
+
+ return S_OK;
+ }
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets accessible row header.
+ *
+ * @param row the row index.
+ * @param accessible the accessible object of the row header.
+ */
+STDMETHODIMP CAccTable::get_rowHeader(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingColumnIndex)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(accessibleTable == NULL || startingColumnIndex == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Reference<XAccessibleTable> pRRowHeaderTable = GetXInterface()->getAccessibleRowHeaders();
+ if(!pRRowHeaderTable.is())
+ {
+ *accessibleTable = NULL;
+ return E_FAIL;
+ }
+
+ Reference<XAccessible> pRXRowHeader(pRRowHeaderTable,UNO_QUERY);
+
+ if(!pRXRowHeader.is())
+ {
+ *accessibleTable = NULL;
+ return E_FAIL;
+ }
+ *startingColumnIndex = 0 ;
+
+ IAccessible* m_pIMacc = NULL;
+ ActivateActContext();
+ HRESULT hr = CoCreateInstance( CLSID_MAccessible, NULL, CLSCTX_ALL ,
+ IID_IMAccessible,
+ (void **)&m_pIMacc
+ );
+ DeactivateActContext();
+ ((CMAccessible*)m_pIMacc)->SetXAccessible((long)pRXRowHeader.get());
+ m_pIMacc->QueryInterface(IID_IAccessibleTable,(void **)accessibleTable);
+ if( SUCCEEDED(hr) )
+ {
+ return S_OK;
+ }
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets list of row indexes currently selected (0-based).
+ *
+ * @param maxRows the max number of the rows.
+ * @param accessible the accessible object array of the selected rows.
+ * @param nRows the actual size of the accessible object array.
+ */
+STDMETHODIMP CAccTable::get_selectedRows(long, long ** rows, long * nRows)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(rows == NULL || nRows == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleRows();
+ long count = pSelected.getLength() ;
+ *nRows = count;
+
+ *rows = reinterpret_cast<long*>(CoTaskMemAlloc((count) * sizeof(long)));
+ // #CHECK Memory Allocation#
+ if(*rows == NULL)
+ {
+ return E_FAIL;
+ }
+ for(int i=0; i<count; i++)
+ (*rows)[i] = pSelected[i];
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets list of column indexes currently selected (0-based).
+ *
+ * @param maxColumns the max number of the columns.
+ * @param accessible the accessible object array of the selected columns.
+ * @param numColumns the actual size of accessible object array.
+ */
+STDMETHODIMP CAccTable::get_selectedColumns(long, long ** columns, long * numColumns)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(columns == NULL || numColumns == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleColumns();
+ long count = pSelected.getLength() ;
+ *numColumns = count;
+
+ *columns = reinterpret_cast<long*>(CoTaskMemAlloc((count) * sizeof(long)));
+ // #CHECK Memory Allocation#
+ if(*columns == NULL)
+ {
+ return E_FAIL;
+ }
+ for(int i=0; i<count; i++)
+ (*columns)[i] = pSelected[i];
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets accessible table summary.
+ *
+ * @param accessible the accessible object of the summary.
+ */
+STDMETHODIMP CAccTable::get_summary(IUnknown * * accessible)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(accessible == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ {
+ return E_FAIL;
+ }
+ Reference<XAccessible> pRAcc = GetXInterface()->getAccessibleSummary();
+
+ IAccessible* pRet = NULL;
+ BOOL isTRUE = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet);
+
+ if(pRet)
+ {
+ *accessible = (IAccessible2 *)pRet;
+ pRet->AddRef();
+ return S_OK;
+ }
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Determines if table column is selected.
+ *
+ * @param column the column index.
+ * @param isSelected the result.
+ */
+STDMETHODIMP CAccTable::get_isColumnSelected(long column, unsigned char * isSelected)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(isSelected == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ *isSelected = GetXInterface()->isAccessibleColumnSelected(column);
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Determines if table row is selected.
+ *
+ * @param row the row index.
+ * @param isSelected the result.
+ */
+STDMETHODIMP CAccTable::get_isRowSelected(long row, unsigned char * isSelected)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(isSelected == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ {
+ return E_FAIL;
+ }
+ *isSelected = GetXInterface()->isAccessibleRowSelected(row);
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Determines if table cell is selected.
+ *
+ * @param row the row index.
+ * @param column the column index.
+ * @param isSelected the result.
+ */
+STDMETHODIMP CAccTable::get_isSelected(long row, long column, unsigned char * isSelected)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(isSelected == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ *isSelected = GetXInterface()->isAccessibleSelected(row,column);
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Selects a row and unselect all previously selected rows.
+ *
+ * @param row the row index.
+ * @param success the result.
+ */
+STDMETHODIMP CAccTable::selectRow(long row)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // Check XAccessibleTable reference.
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Reference<XAccessibleTableSelection> pRTableExtent(pRXTable, UNO_QUERY);
+ if(pRTableExtent.is())
+ {
+ pRTableExtent.get()->selectRow(row);
+ return S_OK;
+ }
+ else
+ {
+ // Get XAccessibleSelection.
+ Reference<XAccessibleSelection> pRSelection(GetXInterface(), UNO_QUERY);
+ if(!pRSelection.is())
+ return E_FAIL;
+
+ // Select row.
+ long lCol, lColumnCount, lChildIndex;
+ lColumnCount = GetXInterface()->getAccessibleColumnCount();
+ for(lCol = 0; lCol < lColumnCount; lCol ++)
+ {
+ lChildIndex = GetXInterface()->getAccessibleIndex(row, lCol);
+ pRSelection.get()->selectAccessibleChild(lChildIndex);
+ }
+
+ return S_OK;
+ }
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Selects a column and unselect all previously selected columns.
+ *
+ * @param column the column index.
+ * @param success the result.
+ */
+STDMETHODIMP CAccTable::selectColumn(long column)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // Check XAccessibleTable reference.
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Reference<XAccessibleTableSelection> pRTableExtent(GetXInterface(), UNO_QUERY);
+ if(pRTableExtent.is())
+ {
+ pRTableExtent.get()->selectColumn(column);
+ return S_OK;
+ }
+ else
+ {
+ // Get XAccessibleSelection.
+ Reference<XAccessibleSelection> pRSelection(pRXTable, UNO_QUERY);
+ if(!pRSelection.is())
+ return E_FAIL;
+
+ // Select column.
+ long lRow, lRowCount, lChildIndex;
+ lRowCount = GetXInterface()->getAccessibleRowCount();
+ for(lRow = 0; lRow < lRowCount; lRow ++)
+ {
+ lChildIndex = GetXInterface()->getAccessibleIndex(lRow, column);
+ pRSelection.get()->selectAccessibleChild(lChildIndex);
+ }
+
+ return S_OK;
+ }
+ return S_OK;
+ // End of added.
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Unselects one row, leaving other selected rows selected (if any).
+ *
+ * @param row the row index.
+ * @param success the result.
+ */
+STDMETHODIMP CAccTable::unselectRow(long row)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // Check XAccessibleTable reference.
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Reference<XAccessibleTableSelection> pRTableExtent(GetXInterface(), UNO_QUERY);
+ if(pRTableExtent.is())
+ {
+ if(pRTableExtent.get()->unselectRow(row))
+ return S_OK;
+ else
+ return E_FAIL;
+ }
+ else
+ {
+ // Get XAccessibleSelection.
+ Reference<XAccessibleSelection> pRSelection(pRXTable, UNO_QUERY);
+ if(!pRSelection.is())
+ return E_FAIL;
+
+ // Select column.
+ long lColumn, lColumnCount, lChildIndex;
+ lColumnCount = GetXInterface()->getAccessibleColumnCount();
+ for(lColumn = 0; lColumn < lColumnCount; lColumn ++)
+ {
+ lChildIndex = GetXInterface()->getAccessibleIndex(row,lColumn);
+ pRSelection.get()->deselectAccessibleChild(lChildIndex);
+ }
+
+ return S_OK;
+ }
+ return S_OK;
+ // End of added.
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Unselects one column, leaving other selected columns selected (if any).
+ *
+ * @param column the column index.
+ * @param success the result.
+ */
+STDMETHODIMP CAccTable::unselectColumn(long column)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // Check XAccessibleTable reference.
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Reference<XAccessibleTableSelection> pRTableExtent(GetXInterface(), UNO_QUERY);
+ if(pRTableExtent.is())
+ {
+ if(pRTableExtent.get()->unselectColumn(column))
+ return S_OK;
+ else
+ return E_FAIL;
+ }
+ else
+ {
+ // Get XAccessibleSelection.
+ Reference<XAccessibleSelection> pRSelection(pRXTable, UNO_QUERY);
+ if(!pRSelection.is())
+ return E_FAIL;
+
+ // Unselect columns.
+ long lRow, lRowCount, lChildIndex;
+ lRowCount = GetXInterface()->getAccessibleRowCount();
+
+ for(lRow = 0; lRow < lRowCount; lRow ++)
+ {
+ lChildIndex = GetXInterface()->getAccessibleIndex(lRow, column);
+ pRSelection.get()->deselectAccessibleChild(lChildIndex);
+ }
+ return S_OK;
+ }
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param pXInterface the pointer of UNO interface.
+ */
+STDMETHODIMP CAccTable::put_XInterface(long pXInterface)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ CUNOXWrapper::put_XInterface(pXInterface);
+ //special query.
+ if(pUNOInterface == NULL)
+ return E_INVALIDARG;
+
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ return E_FAIL;
+
+ Reference<XAccessibleTable> pRXI(pRContext,UNO_QUERY);
+ if( !pRXI.is() )
+ pRXTable = NULL;
+ else
+ pRXTable = pRXI.get();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets columnIndex of childIndex.
+ *
+ * @param childIndex childIndex
+ */
+STDMETHODIMP CAccTable::get_columnIndex(long childIndex, long * columnIndex)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(columnIndex == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ *columnIndex = GetXInterface()->getAccessibleColumn(childIndex);
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+/**
+ * Gets rowIndex of childIndex.
+ *
+ * @param childIndex childIndex
+ */
+STDMETHODIMP CAccTable::get_rowIndex(long childIndex, long * rowIndex)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(rowIndex == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ *rowIndex = GetXInterface()->getAccessibleRow(childIndex);
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+/**
+ * Gets childIndex of childIndex.
+ *
+ * @param childIndex childIndex
+ */
+STDMETHODIMP CAccTable::get_childIndex(long RowIndex , long columnIndex, long * childIndex )
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(childIndex == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ *childIndex = GetXInterface()->getAccessibleIndex(RowIndex, columnIndex);
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CAccTable::get_rowColumnExtentsAtIndex(long,
+ long *,
+ long *,
+ long *,
+ long *,
+ boolean *)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CAccTable::get_modelChange(IA2TableModelChange *)
+{
+
+ return E_NOTIMPL;
+}
+
+// @brief Returns the total number of selected children
+// @param [out] childCount
+// Number of children currently selected
+STDMETHODIMP CAccTable::get_nSelectedChildren(long *childCount)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(childCount == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Reference<XAccessibleSelection> pRSelection(GetXInterface(), UNO_QUERY);
+ if(!pRSelection.is())
+ return E_FAIL;
+
+ *childCount = pRSelection->getSelectedAccessibleChildCount();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+// @brief Returns a list of child indexes currently selected (0-based).
+// @param [in] maxChildren
+// Max children requested (possibly from IAccessibleTable::nSelectedChildren)
+// @param [out] children
+// array of indexes of selected children (each index is 0-based)
+// @param [out] nChildren
+// Length of array (not more than maxChildren)
+STDMETHODIMP CAccTable::get_selectedChildren(long, long **children, long *nChildren)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(children == NULL || nChildren == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if(!pRXTable.is())
+ return E_FAIL;
+
+ Reference<XAccessibleSelection> pRSelection(GetXInterface(), UNO_QUERY);
+ if(!pRSelection.is())
+ return E_FAIL;
+
+ long childCount = pRSelection->getSelectedAccessibleChildCount() ;
+
+ *nChildren = childCount;
+
+ *children = reinterpret_cast<long*>(CoTaskMemAlloc((childCount) * sizeof(long)));
+
+ for( long i = 0; i< childCount; i++)
+ {
+ Reference<XAccessible> pRAcc = pRSelection->getSelectedAccessibleChild(i);
+ if(pRAcc.is())
+ {
+ Reference<XAccessibleContext> pRContext(pRAcc, UNO_QUERY);
+ if( !pRContext.is() )
+ return E_FAIL;
+
+ long childIndex = pRContext->getAccessibleIndexInParent();
+ (*children)[i] = childIndex;
+ }
+ }
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+
+}
diff --git a/winaccessibility/source/UAccCOM/AccTable.h b/winaccessibility/source/UAccCOM/AccTable.h
new file mode 100644
index 000000000000..245c54720550
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccTable.h
@@ -0,0 +1,175 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCTABLE_H_
+#define __ACCTABLE_H_
+
+#include "resource.h" // main symbols
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include "UNOXWrapper.h"
+
+/**
+ * CAccTable implements IAccessibleTable interface.
+ */
+class ATL_NO_VTABLE CAccTable :
+ public CComObjectRoot,
+ public CComCoClass<CAccTable, &CLSID_AccTable>,
+ public IAccessibleTable,
+ public CUNOXWrapper
+
+{
+public:
+ CAccTable()
+ {
+ }
+ virtual ~CAccTable()
+ {
+ }
+
+ BEGIN_COM_MAP(CAccTable)
+ COM_INTERFACE_ENTRY(IAccessibleTable)
+ COM_INTERFACE_ENTRY(IUNOXWrapper)
+ COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+ END_COM_MAP()
+
+ static HRESULT WINAPI _SmartQI(void* pv,
+ REFIID iid, void** ppvObject, DWORD)
+ {
+ return ((CAccTable*)pv)->SmartQI(iid,ppvObject);
+ }
+
+ HRESULT SmartQI(REFIID iid, void** ppvObject)
+ {
+ if( m_pOuterUnknown )
+ return OuterQueryInterface(iid,ppvObject);
+ return E_FAIL;
+ }
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_ACCTABLE)
+
+ // IAccessibleTable
+public:
+ // IAccessibleTable
+
+ // Gets accessible table cell.
+ STDMETHOD(get_accessibleAt)(long row, long column, IUnknown * * accessible);
+
+ // Gets accessible table caption.
+ STDMETHOD(get_caption)(IUnknown * * accessible);
+
+ // Gets accessible column description (as string).
+ STDMETHOD(get_columnDescription)(long column, BSTR * description);
+
+ // Gets number of columns spanned by table cell.
+ STDMETHOD(get_columnExtentAt)(long row, long column, long * nColumnsSpanned);
+
+ // Gets accessible column header.
+ STDMETHOD(get_columnHeader)(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingRowIndex);
+
+ // Gets total number of columns in table.
+ STDMETHOD(get_nColumns)(long * columnCount);
+
+ // Gets total number of rows in table.
+ STDMETHOD(get_nRows)(long * rowCount);
+
+ // Gets total number of selected columns.
+ STDMETHOD(get_nSelectedColumns)(long * columnCount);
+
+ // Gets total number of selected rows.
+ STDMETHOD(get_nSelectedRows)(long * rowCount);
+
+ // Gets accessible row description (as string).
+ STDMETHOD(get_rowDescription)(long row, BSTR * description);
+
+ // Gets number of rows spanned by a table cell.
+ STDMETHOD(get_rowExtentAt)(long row, long column, long * nRowsSpanned);
+
+ // Gets accessible row header.
+ STDMETHOD(get_rowHeader)(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingColumnIndex);
+
+ // Gets list of row indexes currently selected (0-based).
+ STDMETHOD(get_selectedRows)(long maxRows, long **rows, long * nRows);
+
+ // Gets list of column indexes currently selected (0-based).
+ STDMETHOD(get_selectedColumns)(long maxColumns, long **columns, long * numColumns);
+
+ // Gets accessible table summary.
+ STDMETHOD(get_summary)(IUnknown * * accessible);
+
+ // Determines if table column is selected.
+ STDMETHOD(get_isColumnSelected)(long column, unsigned char * isSelected);
+
+ // Determines if table row is selected.
+ STDMETHOD(get_isRowSelected)(long row, unsigned char * isSelected);
+
+ // Determines if table cell is selected.
+ STDMETHOD(get_isSelected)(long row, long column, unsigned char * isSelected);
+
+ // Selects a row and unselect all previously selected rows.
+ STDMETHOD(selectRow)(long row );
+
+
+ // Selects a column and unselect all previously selected columns.
+
+ STDMETHOD(selectColumn)(long column);
+
+ // Unselects one row, leaving other selected rows selected (if any).
+ STDMETHOD(unselectRow)(long row);
+
+ // Unselects one column, leaving other selected columns selected (if any).
+ STDMETHOD(unselectColumn)(long column);
+
+ //get Column index
+ STDMETHOD(get_columnIndex)(long childIndex, long * columnIndex);
+
+ STDMETHOD(get_rowIndex)(long childIndex, long * rowIndex);
+
+ STDMETHOD(get_childIndex)(long rowIndex,long columnIndex, long * childIndex);
+
+ STDMETHOD(get_nSelectedChildren)(long *childCount);
+
+ STDMETHOD(get_selectedChildren)(long maxChildren, long **children, long *nChildren);
+
+ STDMETHOD(get_rowColumnExtentsAtIndex)( long index,
+ long *row,
+ long *column,
+ long *rowExtents,
+ long *columnExtents,
+ boolean *isSelected) ;
+
+ STDMETHOD(get_modelChange)(IA2TableModelChange *modelChange);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleTable> pRXTable;
+
+ inline com::sun::star::accessibility::XAccessibleTable* GetXInterface()
+ {
+ return pRXTable.get();
+ }
+};
+
+#endif //__ACCTABLE_H_
diff --git a/winaccessibility/source/UAccCOM/AccTable.rgs b/winaccessibility/source/UAccCOM/AccTable.rgs
new file mode 100644
index 000000000000..7117fe698934
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccTable.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccTable.1 = s 'AccTable Class'
+ {
+ CLSID = s '{92BAA62D-535A-4EAB-9ABB-BFA60B7A6DB6}'
+ }
+ UAccCOM.AccTable = s 'AccTable Class'
+ {
+ CLSID = s '{92BAA62D-535A-4EAB-9ABB-BFA60B7A6DB6}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {92BAA62D-535A-4EAB-9ABB-BFA60B7A6DB6} = s 'AccTable Class'
+ {
+ ProgID = s 'UAccCOM.AccTable.1'
+ VersionIndependentProgID = s 'UAccCOM.AccTable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccText.cxx b/winaccessibility/source/UAccCOM/AccText.cxx
new file mode 100644
index 000000000000..ab0702993615
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccText.cxx
@@ -0,0 +1,282 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccText.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+ * Get special selection.
+ * @param startOffset Start selection offset.
+ * @param endOffset End selection offset.
+ * @param success Variant to accept the result of if the method call is successful.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::addSelection(long startOffset, long endOffset)//, unsigned char * success)
+{
+
+ return CAccTextBase::get_addSelection(startOffset, endOffset);//, success);
+}
+
+/**
+ * Get special attributes.
+ * @param offset Offset.
+ * @param startOffset Variant to accept start offset.
+ * @param endOffset Variant to accept end offset.
+ * @param textAttributes Variant to accept attributes.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_attributes(long offset, long * startOffset, long * endOffset, BSTR * textAttributes)
+{
+
+ return CAccTextBase::get_attributes(offset, startOffset, endOffset, textAttributes);
+}
+
+/**
+ * Get caret position.
+ * @param offset Variant to accept caret offset.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_caretOffset(long * offset)
+{
+
+ return CAccTextBase::get_caretOffset(offset);
+}
+
+/**
+ * Get character count.
+ * @param nCharacters Variant to accept character count.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_characterCount(long * nCharacters)
+{
+
+ return CAccTextBase::get_characterCount(nCharacters);
+}
+
+/**
+ * Get character extents.
+ * @param offset Offset.
+ * @param x Variant to accpet x position.
+ * @param y Variant to accpet y position.
+ * @param width Variant to accpet width.
+ * @param Height Variant to accpet height.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_characterExtents(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height)
+{
+
+ return CAccTextBase::get_characterExtents(offset, coordType, x, y, width, height);
+}
+
+/**
+ * Get slections count.
+ * @param nSelections Variant to accpet slections count.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_nSelections(long * nSelections)
+{
+
+ return CAccTextBase::get_nSelections(nSelections);
+}
+
+/**
+ * Get offset of some special point.
+ * @param x X position of one point.
+ * @param x Y position of one point.
+ * @param coordType Type.
+ * @param offset Variant to accept offset.
+ * @return Result.
+*/
+
+STDMETHODIMP CAccText::get_offsetAtPoint(long x, long y, IA2CoordinateType coordType, long * offset)
+{
+
+ return CAccTextBase::get_offsetAtPoint(x, y, coordType, offset);
+}
+
+/**
+ * Get selection range.
+ * @param selection selection count.
+ * @param startOffset Variant to accept the start offset of special selection.
+ * @param endOffset Variant to accept the end offset of special selection.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_selection(long selection, long * startOffset, long * endOffset)
+{
+
+ return CAccTextBase::get_selection(selection, startOffset, endOffset);
+}
+
+/**
+ * Get special text.
+ * @param startOffset Start position of special range.
+ * @param endOffset End position of special range.
+ * @param text Variant to accept the text of special range.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_text(long startOffset, long endOffset, BSTR * text)
+{
+
+ return CAccTextBase::get_text(startOffset, endOffset, text);
+}
+
+/**
+ * Get special text before some position.
+ * @param offset Special position.
+ * @param boundaryType Boundary type.
+ * @param startOffset Variant to accept the start offset.
+ * @param endOffset Variant to accept the end offset.
+ * @param text Variant to accept the special text.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+
+ return CAccTextBase::get_textBeforeOffset(offset, boundaryType,
+ startOffset, endOffset, text);
+}
+
+/**
+ * Get special text after some position.
+ * @param offset Special position.
+ * @param boundaryType Boundary type.
+ * @param startOffset Variant to accept the start offset.
+ * @param endOffset Variant to accept the end offset.
+ * @param text Variant to accept the special text.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+
+ return CAccTextBase::get_textAfterOffset(offset, boundaryType,
+ startOffset, endOffset, text);
+}
+
+/**
+ * Get special text at some position.
+ * @param offset Special position.
+ * @param boundaryType Boundary type.
+ * @param startOffset Variant to accept the start offset.
+ * @param endOffset Variant to accept the end offset.
+ * @param text Variant to accept the special text.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+
+ return CAccTextBase::get_textAtOffset(offset, boundaryType,
+ startOffset, endOffset, text);
+}
+
+/**
+ * Remove selection.
+ * @param selectionIndex Special selection index
+ * @param success Variant to accept the memthod called result.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::removeSelection(long selectionIndex)//, unsigned char * success)
+{
+
+ return CAccTextBase::removeSelection(selectionIndex);//, success);
+}
+
+/**
+ * Set caret position.
+ * @param offset Special position.
+ * @param success Variant to accept the memthod called result.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::setCaretOffset(long offset)
+{
+
+ return CAccTextBase::setCaretOffset(offset);
+}
+
+/**
+ * Set special selection.
+ * @param selectionIndex Special selection index.
+ * @param startOffset start position.
+ * @param endOffset end position.
+ * @param success Variant to accept the memthod called result.
+ * @return Result.
+*/
+
+STDMETHODIMP CAccText::setSelection(long selectionIndex, long startOffset, long endOffset)
+{
+
+ return CAccTextBase::setSelection(selectionIndex, startOffset,
+ endOffset);
+}
+
+/**
+ * Get characters count.
+ * @param nCharacters Variant to accept the characters count.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::get_nCharacters(long * nCharacters)
+{
+
+ return CAccTextBase::get_nCharacters(nCharacters);
+}
+
+STDMETHODIMP CAccText::get_newText( IA2TextSegment *newText)
+{
+ return CAccTextBase::get_newText(newText);
+}
+
+STDMETHODIMP CAccText::get_oldText( IA2TextSegment *oldText)
+{
+ return CAccTextBase::get_oldText(oldText);
+}
+
+/**
+ * Scroll to special sub-string .
+ * @param startIndex Start index of sub string.
+ * @param endIndex End index of sub string.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::scrollSubstringToPoint(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y )
+{
+
+ return CAccTextBase::scrollSubstringToPoint(startIndex, endIndex, coordinateType, x, y);
+}
+
+STDMETHODIMP CAccText::scrollSubstringTo(long startIndex, long endIndex,enum IA2ScrollType scrollType)
+{
+
+ return CAccTextBase::scrollSubstringTo(startIndex, endIndex,scrollType);
+}
+
+/**
+ * Put UNO interface.
+ * @param pXInterface UNO interface.
+ * @return Result.
+*/
+STDMETHODIMP CAccText::put_XInterface(long pXInterface)
+{
+
+ return CAccTextBase::put_XInterface(pXInterface);
+}
+
diff --git a/winaccessibility/source/UAccCOM/AccText.h b/winaccessibility/source/UAccCOM/AccText.h
new file mode 100644
index 000000000000..7eb1c33f5086
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccText.h
@@ -0,0 +1,140 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#if !defined(AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_)
+#define AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h" // main symbols
+
+#include "AccTextBase.h"
+
+/**
+ * CAccText implements IAccessibleText interface.
+ */
+class ATL_NO_VTABLE CAccText :
+ public CComObjectRoot,
+ public CComCoClass<CAccText,&CLSID_AccText>,
+ public IAccessibleText,
+ public CAccTextBase
+{
+public:
+ CAccText()
+ {
+ }
+ ~CAccText()
+ {
+ }
+
+ BEGIN_COM_MAP(CAccText)
+ COM_INTERFACE_ENTRY(IAccessibleText)
+ COM_INTERFACE_ENTRY(IUNOXWrapper)
+ COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+ END_COM_MAP()
+
+ static HRESULT WINAPI _SmartQI(void* pv,
+ REFIID iid, void** ppvObject, DWORD)
+ {
+ return ((CAccText*)pv)->SmartQI(iid,ppvObject);
+ }
+
+ HRESULT SmartQI(REFIID iid, void** ppvObject)
+ {
+ if( m_pOuterUnknown )
+ return OuterQueryInterface(iid,ppvObject);
+ return E_FAIL;
+ }
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_AccText)
+
+ // IAccessibleText
+public:
+ // IAccessibleText
+
+ // Adds a text selection.
+ STDMETHOD(addSelection)(long startOffset, long endOffset);//, unsigned char * success);
+
+ // Gets text attributes.
+ STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes);
+
+ // Gets caret offset.
+ STDMETHOD(get_caretOffset)(long * offset);
+
+ // Gets total number of characters.
+ STDMETHOD(get_characterCount)(long * nCharacters);
+
+ // Gets bounding rect containing the glyph(s) representing the character
+ // at the specified text offset
+ STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height);
+
+ // Gets number of active non-contiguous selections.
+ STDMETHOD(get_nSelections)(long * nSelections);
+
+ // Gets bounding rect for the glyph at a certain point.
+ STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset);
+
+ // Gets character offsets of N-th active text selection.
+ STDMETHOD(get_selection)(long selection, long * startOffset, long * endOffset);
+
+ // Gets a range of text by offset NOTE: returned string may be longer
+ // than endOffset-startOffset bytes if text contains multi-byte characters.
+ STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text);
+
+ // Gets a specified amount of text that ends before a specified offset.
+ STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+ // Gets a specified amount of text that spans the specified offset.
+ STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+ // Gets a specified amount of text that starts after a specified offset.
+ STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+ // Unselects a range of text.
+ STDMETHOD(removeSelection)(long selectionIndex);//, unsigned char * success);
+
+ // Moves text caret.
+ STDMETHOD(setCaretOffset)(long offset);//, unsigned char * success);
+
+ // Changes the bounds of an existing selection.
+ STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset);//, unsigned char * success);
+
+ // Gets total number of characters.
+ // NOTE: this may be different than the total number of bytes required
+ // to store the text, if the text contains multi-byte characters.
+ STDMETHOD(get_nCharacters)(long * nCharacters);
+
+ // Makes specific part of string visible on screen.
+ STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType);
+ STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y );
+
+ STDMETHOD(get_newText)( IA2TextSegment *newText);
+
+ STDMETHOD(get_oldText)( IA2TextSegment *oldText);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+};
+
+#endif // !defined(AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_)
diff --git a/winaccessibility/source/UAccCOM/AccText.rgs b/winaccessibility/source/UAccCOM/AccText.rgs
new file mode 100644
index 000000000000..6cb3ebdcfa0a
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccText.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccText.1 = s 'AccText Class'
+ {
+ CLSID = s '{6D8AB08B-CCE9-471E-8A41-35773D5263F5}'
+ }
+ UAccCOM.AccText = s 'AccText Class'
+ {
+ CLSID = s '{6D8AB08B-CCE9-471E-8A41-35773D5263F5}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {6D8AB08B-CCE9-471E-8A41-35773D5263F5} = s 'AccText Class'
+ {
+ ProgID = s 'UAccCOM.AccText.1'
+ VersionIndependentProgID = s 'UAccCOM.AccText'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccTextBase.cxx b/winaccessibility/source/UAccCOM/AccTextBase.cxx
new file mode 100644
index 000000000000..6b7a38fba7aa
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccTextBase.cxx
@@ -0,0 +1,995 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+//////////////////////////////////////////////////////////////////////
+// AccTextBase.cpp: implementation of the CAccTextBase class.
+//////////////////////////////////////////////////////////////////////
+#include "stdafx.h"
+#include <string>
+#define WNT
+
+#include <com/sun/star/accessibility/AccessibleTextType.hpp>
+#include "AccTextBase.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextSelection.hpp>
+#include "MAccessible.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+OUString ReplaceFourChar(OUString oldOUString);
+
+CAccTextBase::CAccTextBase()
+{}
+
+CAccTextBase::~CAccTextBase()
+{}
+
+
+/**
+ * Get special selection.
+ * @param startOffset Start selection offset.
+ * @param endOffset End selection offset.
+ * @param success Variant to accept the result of if the method call is successful.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_addSelection(long startOffset, long endOffset)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK XInterface#
+ if(pUNOInterface == NULL)
+ return E_FAIL;
+
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+
+ Reference< XAccessibleTextSelection > pRExtension(pRContext,UNO_QUERY);
+
+ if( pRExtension.is() )
+ {
+ pRExtension->addSelection(0, startOffset, endOffset);
+ return S_OK;
+ }
+ else
+ {
+ GetXInterface()->setSelection(startOffset, endOffset);
+ return S_OK;
+ }
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get special attributes.
+ * @param offset Offset.
+ * @param startOffset Variant to accept start offset.
+ * @param endOffset Variant to accept end offset.
+ * @param textAttributes Variant to accept attributes.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long * endOffset, BSTR * textAttributes)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (startOffset == NULL || endOffset == NULL || textAttributes == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ {
+ return E_FAIL;
+ }
+
+ if( offset < 0 || offset > GetXInterface()->getCharacterCount() )
+ return E_FAIL;
+
+ std::wstring strAttrs;
+
+ strAttrs += L"Version:1;";
+
+ Sequence< ::com::sun::star::beans::PropertyValue > pValues = GetXInterface()->getCharacterAttributes(offset, Sequence< rtl::OUString >());
+ int nCount = pValues.getLength();
+
+ short numberingLevel = 0;
+ OUString numberingPrefix;
+ Any anyNumRule;
+ bool bHaveNumberingPrefixAttr = false;
+ bool bHaveNumberingLevel = false;
+ bool bHaveNumberingRules = false;
+ for(int i =0; i<nCount; i++)
+ {
+
+ ::com::sun::star::beans::PropertyValue &pValue = pValues[i];
+ if(pValue.Name.compareTo(OUString::createFromAscii("NumberingLevel"))==0)
+ {
+ if (pValue.Value != Any())
+ pValue.Value >>= numberingLevel;
+ else
+ numberingLevel = -1;
+ bHaveNumberingLevel = true;
+ continue;
+ }
+ if(pValue.Name.compareTo(OUString::createFromAscii("NumberingPrefix"))==0)
+ {
+ pValue.Value >>=numberingPrefix;
+ bHaveNumberingPrefixAttr = true;
+ continue;
+ }
+ if(pValue.Name.compareTo(OUString::createFromAscii("NumberingRules"))==0)
+ {
+ bHaveNumberingRules = true;
+ anyNumRule = pValue.Value;
+ continue;
+ }
+ if (bHaveNumberingLevel && bHaveNumberingRules && bHaveNumberingPrefixAttr)
+ {
+ OLECHAR numProps[512] = {0};
+ strAttrs+=L";";
+ numberingPrefix = ReplaceFourChar(numberingPrefix);
+ CMAccessible::get_OLECHAR4Numbering(anyNumRule,numberingLevel,numberingPrefix,numProps);
+ strAttrs += numProps;
+ bHaveNumberingLevel = 0;
+ bHaveNumberingRules = 0;
+ }
+ if( (bHaveNumberingPrefixAttr && i > 1 ) ||
+ (!bHaveNumberingPrefixAttr && i > 0 ) ) //element 0 is NumberingPrefix, not write alone
+ {
+ strAttrs+=L";";
+ }
+ strAttrs += pValue.Name.getStr();
+ strAttrs += L":";
+
+ OLECHAR pTemp[2048] = {0};
+
+ if (pValue.Name.compareTo(OUString::createFromAscii("CharBackColor"))==0 ||
+ pValue.Name.compareTo(OUString::createFromAscii("CharColor"))==0 ||
+ pValue.Name.compareTo(OUString::createFromAscii("CharUnderlineColor"))==0 )
+ {
+ unsigned long nColor;
+ pValue.Value >>= nColor;
+ OLECHAR pBuf[64];
+ swprintf( pBuf, L"%08X", nColor );
+ pTemp[0]=L'#';
+ wcscat( pTemp, pBuf );
+
+ }
+ else
+ {
+ CMAccessible::get_OLECHARFromAny(pValue.Value,pTemp);
+ }
+
+ strAttrs +=pTemp;
+ }
+ strAttrs +=L";";
+ // #CHECK#
+ if(*textAttributes)
+ SysFreeString(*textAttributes);
+ *textAttributes = SysAllocString(strAttrs.c_str());
+
+ if( offset < GetXInterface()->getCharacterCount() )
+ {
+ TextSegment textSeg = GetXInterface()->getTextAtIndex(offset, AccessibleTextType::ATTRIBUTE_RUN);
+ *startOffset = textSeg.SegmentStart;
+ *endOffset = textSeg.SegmentEnd;
+ }
+ else
+ {
+ *startOffset = offset;
+ *endOffset = offset;
+ }
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get caret position.
+ * @param offset Variant to accept caret offset.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_caretOffset(long * offset)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (offset == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ {
+ *offset = 0;
+ return S_OK;
+ }
+
+ *offset = GetXInterface()->getCaretPosition();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get character count.
+ * @param nCharacters Variant to accept character count.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_characterCount(long * nCharacters)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (nCharacters == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ {
+ *nCharacters = 0;
+ return S_OK;
+ }
+
+ *nCharacters = GetXInterface()->getCharacterCount();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get character extents.
+ * @param offset Offset.
+ * @param x Variant to accept x position.
+ * @param y Variant to accept y position.
+ * @param width Variant to accept width.
+ * @param Height Variant to accept height.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_characterExtents(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (x == NULL || height == NULL || y == NULL || width == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ return E_FAIL;
+
+ if(offset < 0 || offset > GetXInterface()->getCharacterCount() )
+ return E_FAIL;
+
+ com::sun::star::awt::Rectangle rectangle;
+ rectangle = GetXInterface()->getCharacterBounds(offset);
+
+ //IA2Point aPoint;
+ com::sun::star::awt::Point aPoint;
+
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ {
+ return E_FAIL;
+ }
+ Reference<XAccessibleComponent> pRComp(pRContext,UNO_QUERY);
+ if( pRComp.is() )
+ {
+ if(coordType == IA2_COORDTYPE_SCREEN_RELATIVE)
+ {
+ ::com::sun::star::awt::Point pt = pRComp->getLocationOnScreen();
+ aPoint.X = pt.X;
+ aPoint.Y = pt.Y;
+ }
+ else if(coordType == IA2_COORDTYPE_PARENT_RELATIVE)
+ {
+ ::com::sun::star::awt::Point pt = pRComp->getLocation();
+ aPoint.X = pt.X;
+ aPoint.Y = pt.Y;
+ }
+ }
+ rectangle.X = rectangle.X + aPoint.X;
+ rectangle.Y = rectangle.Y + aPoint.Y;
+
+ *x = rectangle.X;
+ *y = rectangle.Y;
+
+ // GetXInterface()->getCharacterBounds() have different implement in different acc component
+ // But we need return the width/height == 1 for every component when offset == text length.
+ // So we ignore the return result of GetXInterface()->getCharacterBounds() when offset == text length.
+ if( offset == GetXInterface()->getCharacterCount() )
+ {
+ *width = 1;
+ *height = 1;
+ }
+ else
+ {
+ *width = rectangle.Width;
+ *height = rectangle.Height;
+ }
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get selections count.
+ * @param nSelections Variant to accept selections count.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_nSelections(long * nSelections)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (nSelections == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(pUNOInterface == NULL)
+ {
+ *nSelections = 0;
+ return S_OK;
+ }
+
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+
+ Reference< XAccessibleTextSelection > pRExtension(pRContext,UNO_QUERY);
+
+ if( pRExtension.is() )
+ {
+ *nSelections = pRExtension->getSelectedPortionCount();
+ return S_OK;
+ }
+
+ long iLength = GetXInterface()->getSelectedText().getLength();
+ if( iLength> 0)
+ {
+ *nSelections = 1;
+ return S_OK;
+ }
+
+ *nSelections = 0;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get offset of some special point.
+ * @param x X position of one point.
+ * @param x Y position of one point.
+ * @param coordType Type.
+ * @param offset Variant to accept offset.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_offsetAtPoint(long x, long y, IA2CoordinateType, long * offset)
+{
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+
+ if (offset == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ return E_FAIL;
+
+ com::sun::star::awt::Point point;
+ point.X = x;
+ point.Y = y;
+ *offset = GetXInterface()->getIndexAtPoint(point);
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get selection range.
+ * @param selection selection count.
+ * @param startOffset Variant to accept the start offset of special selection.
+ * @param endOffset Variant to accept the end offset of special selection.
+ * @return Result.
+*/
+
+STDMETHODIMP CAccTextBase::get_selection(long selectionIndex, long * startOffset, long * endOffset)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (startOffset == NULL || endOffset == NULL )
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(pUNOInterface == NULL )
+ return E_FAIL;
+
+ long nSelection = 0;
+ get_nSelections(&nSelection);
+
+ if(selectionIndex >= nSelection || selectionIndex < 0 )
+ return E_FAIL;
+
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+
+ Reference< XAccessibleTextSelection > pRExtension(pRContext,UNO_QUERY);
+
+ if( pRExtension.is() )
+ {
+ *startOffset = pRExtension->getSeletedPositionStart(selectionIndex);
+ *endOffset = pRExtension->getSeletedPositionEnd(selectionIndex);
+ return S_OK;
+ }
+ else if(GetXInterface()->getSelectionEnd() > -1)
+ {
+ *startOffset = GetXInterface()->getSelectionStart();
+ *endOffset = GetXInterface()->getSelectionEnd();
+ return S_OK;
+ }
+
+ *startOffset = 0;
+ *endOffset = 0;
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get special text.
+ * @param startOffset Start position of special range.
+ * @param endOffset End position of special range.
+ * @param text Variant to accept the text of special range.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_text(long startOffset, long endOffset, BSTR * text)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (text == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ return E_FAIL;
+
+ if (endOffset < -1 || endOffset < startOffset )
+ {
+ return E_FAIL;
+ }
+
+ ::rtl::OUString ouStr;
+ if (endOffset == -1 )
+ {
+ long nLen=0;
+ if(SUCCEEDED(get_characterCount(&nLen)))
+ {
+ ouStr = GetXInterface()->getTextRange( 0, nLen );
+ }
+ }
+ else
+ {
+ ouStr = GetXInterface()->getTextRange( startOffset, endOffset );
+ }
+
+ SysFreeString(*text);
+ *text = SysAllocString((OLECHAR*)ouStr.getStr());
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get special text before some position.
+ * @param offset Special position.
+ * @param boundaryType Boundary type.
+ * @param startOffset Variant to accept the start offset.
+ * @param endOffset Variant to accept the end offset.
+ * @param text Variant to accept the special text.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if (startOffset == NULL || endOffset == NULL || text == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ return E_FAIL;
+
+ // In New UNO IAccessibleText.idl these constant values are defined as follows:
+ //
+ // const long TEXT_BOUNDARY_CHAR = -1;
+ // const long TEXT_BOUNDARY_TO_CURSOR_POS = -2;
+ // const long TEXT_BOUNDARY_START_OF_WORD = -3;
+ // const long TEXT_BOUNDARY_END_OF_WORD = -4;
+ // const long TEXT_BOUNDARY_START_OF_SENTENCE = -5;
+ // const long TEXT_BOUNDARY_END_OF_SENTENCE = -6;
+ // const long TEXT_BOUNDARY_START_OF_LINE = -7;
+ // const long TEXT_BOUNDARY_END_OF_LINE = -8;
+ //
+ // In UNO, the corresponding values are as follows:
+ //
+ // const short CHARACTER = 1;
+ // const short WORD = 2;
+ // const short SENTENCE = 3;
+ // const short PARAGRAPH = 4;
+ // const short LINE = 5;
+ // const short GLYPH = 6;
+ // const short ATTRIBUTE_RUN = 7;
+ //
+
+ long lUnoBoundaryType;
+
+ switch(boundaryType)
+ {
+ case IA2_TEXT_BOUNDARY_CHAR:
+ lUnoBoundaryType = 1; // CHARACTER;
+ break;
+ case IA2_TEXT_BOUNDARY_WORD:
+ lUnoBoundaryType = 2; // WORD;
+ break;
+ case IA2_TEXT_BOUNDARY_SENTENCE:
+ lUnoBoundaryType = 3; // SENTENCE;
+ break;
+ case IA2_TEXT_BOUNDARY_LINE:
+ lUnoBoundaryType = 5; // LINE;
+ break;
+ case IA2_TEXT_BOUNDARY_PARAGRAPH:
+ lUnoBoundaryType = 4;
+ break;
+ case IA2_TEXT_BOUNDARY_ALL:
+ {
+ long nChar;
+ get_nCharacters( &nChar );
+ *startOffset = 0;
+ *endOffset = nChar;
+ return get_text(0, nChar, text);
+ }
+ break;
+ default:
+ return E_FAIL;
+ }
+
+ TextSegment segment = GetXInterface()->getTextBeforeIndex( offset, sal_Int16(lUnoBoundaryType));
+ ::rtl::OUString ouStr = segment.SegmentText;
+ SysFreeString(*text);
+ *text = SysAllocString((OLECHAR*)ouStr.getStr());
+ *startOffset = segment.SegmentStart;
+ *endOffset = segment.SegmentEnd;
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get special text after some position.
+ * @param offset Special position.
+ * @param boundaryType Boundary type.
+ * @param startOffset Variant to accept the start offset.
+ * @param endOffset Variant to accept the end offset.
+ * @param text Variant to accept the special text.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (startOffset == NULL || endOffset == NULL || text == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ return E_FAIL;
+
+ // In New UNO IAccessibleText.idl these constant values are defined as follows:
+ //
+ // const long TEXT_BOUNDARY_CHAR = -1;
+ // const long TEXT_BOUNDARY_TO_CURSOR_POS = -2;
+ // const long TEXT_BOUNDARY_START_OF_WORD = -3;
+ // const long TEXT_BOUNDARY_END_OF_WORD = -4;
+ // const long TEXT_BOUNDARY_START_OF_SENTENCE = -5;
+ // const long TEXT_BOUNDARY_END_OF_SENTENCE = -6;
+ // const long TEXT_BOUNDARY_START_OF_LINE = -7;
+ // const long TEXT_BOUNDARY_END_OF_LINE = -8;
+ //
+ // In UNO, the corresponding values are as follows:
+ //
+ // const short CHARACTER = 1;
+ // const short WORD = 2;
+ // const short SENTENCE = 3;
+ // const short PARAGRAPH = 4;
+ // const short LINE = 5;
+ // const short GLYPH = 6;
+ // const short ATTRIBUTE_RUN = 7;
+ //
+
+ long lUnoBoundaryType;
+ switch(boundaryType)
+ {
+ case IA2_TEXT_BOUNDARY_CHAR:
+ lUnoBoundaryType = 1; // CHARACTER;
+ break;
+ case IA2_TEXT_BOUNDARY_WORD:
+ lUnoBoundaryType = 2; // WORD;
+ break;
+ case IA2_TEXT_BOUNDARY_SENTENCE:
+ lUnoBoundaryType = 3; // SENTENCE;
+ break;
+ case IA2_TEXT_BOUNDARY_LINE:
+ lUnoBoundaryType = 5; // LINE;
+ break;
+ case IA2_TEXT_BOUNDARY_PARAGRAPH:
+ lUnoBoundaryType = 4;
+ break;
+ case IA2_TEXT_BOUNDARY_ALL:
+ {
+ long nChar;
+ get_nCharacters( &nChar );
+ *startOffset = 0;
+ *endOffset = nChar;
+ return get_text(0, nChar, text);
+ }
+ break;
+ default:
+ return E_FAIL;
+ }
+
+ TextSegment segment = GetXInterface()->getTextBehindIndex( offset, sal_Int16(lUnoBoundaryType));
+ ::rtl::OUString ouStr = segment.SegmentText;
+ SysFreeString(*text);
+ *text = SysAllocString((OLECHAR*)ouStr.getStr());
+ *startOffset = segment.SegmentStart;
+ *endOffset = segment.SegmentEnd;
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get special text at some position.
+ * @param offset Special position.
+ * @param boundaryType Boundary type.
+ * @param startOffset Variant to accept the start offset.
+ * @param endOffset Variant to accept the end offset.
+ * @param text Variant to accept the special text.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (startOffset == NULL || text == NULL ||endOffset == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ return E_FAIL;
+
+ // In New UNO IAccessibleText.idl these constant values are defined as follows:
+ //
+ // const long TEXT_BOUNDARY_CHAR = -1;
+ // const long TEXT_BOUNDARY_TO_CURSOR_POS = -2;
+ // const long TEXT_BOUNDARY_START_OF_WORD = -3;
+ // const long TEXT_BOUNDARY_END_OF_WORD = -4;
+ // const long TEXT_BOUNDARY_START_OF_SENTENCE = -5;
+ // const long TEXT_BOUNDARY_END_OF_SENTENCE = -6;
+ // const long TEXT_BOUNDARY_START_OF_LINE = -7;
+ // const long TEXT_BOUNDARY_END_OF_LINE = -8;
+ //
+ // In UNO, the corresponding values are as follows:
+ //
+ // const short CHARACTER = 1;
+ // const short WORD = 2;
+ // const short SENTENCE = 3;
+ // const short PARAGRAPH = 4;
+ // const short LINE = 5;
+ // const short GLYPH = 6;
+ // const short ATTRIBUTE_RUN = 7;
+ //
+
+ long lUnoBoundaryType;
+
+ switch(boundaryType)
+ {
+ case IA2_TEXT_BOUNDARY_CHAR:
+ lUnoBoundaryType = 1; // CHARACTER;
+ break;
+ case IA2_TEXT_BOUNDARY_WORD:
+ lUnoBoundaryType = 2; // WORD;
+ break;
+ case IA2_TEXT_BOUNDARY_SENTENCE:
+ lUnoBoundaryType = 3; // SENTENCE;
+ break;
+ case IA2_TEXT_BOUNDARY_LINE:
+ lUnoBoundaryType = 5; // LINE;
+ break;
+ case IA2_TEXT_BOUNDARY_PARAGRAPH:
+ lUnoBoundaryType = 4;
+ break;
+ case IA2_TEXT_BOUNDARY_ALL:
+ {
+ long nChar;
+ get_nCharacters( &nChar );
+ *startOffset = 0;
+ *endOffset = nChar;
+ return get_text(0, nChar, text);
+ }
+ break;
+ default:
+ return E_FAIL;
+ }
+
+ TextSegment segment = GetXInterface()->getTextAtIndex( offset, sal_Int16(lUnoBoundaryType));
+ ::rtl::OUString ouStr = segment.SegmentText;
+ SysFreeString(*text);
+ *text = SysAllocString((OLECHAR*)ouStr.getStr());
+ *startOffset = segment.SegmentStart;
+ *endOffset = segment.SegmentEnd;
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Remove selection.
+ * @param selectionIndex Special selection index
+ * @param success Variant to accept the memthod called result.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::removeSelection(long selectionIndex)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK XInterface#
+ if(pUNOInterface == NULL)
+ {
+ return E_FAIL;
+ }
+
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+
+ Reference< XAccessibleTextSelection > pRExtension(pRContext,UNO_QUERY);
+
+ if( pRExtension.is() )
+ {
+ pRExtension->removeSelection(selectionIndex);
+ return S_OK;
+ }
+ else
+ {
+ GetXInterface()->setSelection(0, 0);
+ return S_OK;
+ }
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Set caret position.
+ * @param offset Special position.
+ * @param success Variant to accept the memthod called result.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::setCaretOffset(long offset)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ return E_FAIL;
+
+ GetXInterface()->setCaretPosition( offset);
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Set special selection.
+ * @param selectionIndex Special selection index.
+ * @param startOffset start position.
+ * @param endOffset end position.
+ * @param success Variant to accept the memthod called result.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::setSelection(long, long startOffset, long endOffset)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ {
+ return E_FAIL;
+ }
+
+ GetXInterface()->setSelection( startOffset, endOffset );
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get characters count.
+ * @param nCharacters Variant to accept the characters count.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_nCharacters(long * nCharacters)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (nCharacters == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+ if(!pRXText.is())
+ {
+ *nCharacters = 0;
+ return S_OK;
+ }
+
+ *nCharacters = GetXInterface()->getCharacterCount();
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+// added by qiuhd, 2006/07/03, for direver 07/11
+STDMETHODIMP CAccTextBase::get_newText( IA2TextSegment *)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CAccTextBase::get_oldText( IA2TextSegment *)
+{
+ return E_NOTIMPL;
+}
+
+/**
+ * Scroll to special sub-string .
+ * @param startIndex Start index of sub string.
+ * @param endIndex End index of sub string.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::scrollSubstringToPoint(long, long, IA2CoordinateType, long, long )
+{
+
+
+ ENTER_PROTECTED_BLOCK
+
+ return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CAccTextBase::scrollSubstringTo(long, long, IA2ScrollType)
+{
+
+
+ ENTER_PROTECTED_BLOCK
+
+ return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Put UNO interface.
+ * @param pXInterface UNO interface.
+ * @return Result.
+*/
+STDMETHODIMP CAccTextBase::put_XInterface(long pXInterface)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ CUNOXWrapper::put_XInterface(pXInterface);
+ //special query.
+ if(pUNOInterface == NULL)
+ return E_FAIL;
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ {
+ return E_FAIL;
+ }
+ Reference<XAccessibleText> pRXI(pRContext,UNO_QUERY);
+ if( !pRXI.is() )
+ pRXText = NULL;
+ else
+ pRXText = pRXI;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+OUString ReplaceOneChar(OUString oldOUString, OUString replacedChar, OUString replaceStr)
+{
+ int iReplace = -1;
+ iReplace = oldOUString.lastIndexOf(replacedChar);
+ if (iReplace > -1)
+ {
+ for(;iReplace>-1;)
+ {
+ oldOUString = oldOUString.replaceAt(iReplace,1, replaceStr);
+ iReplace=oldOUString.lastIndexOf(replacedChar,iReplace);
+ }
+ }
+ return oldOUString;
+
+}
+OUString ReplaceFourChar(OUString oldOUString)
+{
+ oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii("\\"),OUString::createFromAscii("\\\\"));
+ oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii(";"),OUString::createFromAscii("\\;"));
+ oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii("="),OUString::createFromAscii("\\="));
+ oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii(","),OUString::createFromAscii("\\,"));
+ oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii(":"),OUString::createFromAscii("\\:"));
+ return oldOUString;
+}
diff --git a/winaccessibility/source/UAccCOM/AccTextBase.h b/winaccessibility/source/UAccCOM/AccTextBase.h
new file mode 100644
index 000000000000..3e22ba013eaf
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccTextBase.h
@@ -0,0 +1,122 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// AccTextBase.h: interface for the CAccTextBase class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_ACCTEXTBASE_H__B9AE05F6_E28B_4CF3_A8F2_EEE5D2E00B82__INCLUDED_)
+#define AFX_ACCTEXTBASE_H__B9AE05F6_E28B_4CF3_A8F2_EEE5D2E00B82__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define WNT
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include "UNOXWrapper.h"
+
+class ATL_NO_VTABLE CAccTextBase : public CUNOXWrapper
+{
+public:
+ CAccTextBase();
+ virtual ~CAccTextBase();
+
+ // IAccessibleText
+public:
+ // IAccessibleText
+
+ // Adds a text selection.
+ STDMETHOD(get_addSelection)(long startOffset, long endOffset);
+
+ // Gets text attributes.
+ STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes);
+
+ // Gets caret offset.
+ STDMETHOD(get_caretOffset)(long * offset);
+
+ // Gets total number of characters.
+ STDMETHOD(get_characterCount)(long * nCharacters);
+
+ // Gets bounding rect containing the glyph(s) representing the character
+ // at the specified text offset
+ STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height);
+
+ // Gets number of active non-contiguous selections.
+ STDMETHOD(get_nSelections)(long * nSelections);
+
+ // Gets bounding rect for the glyph at a certain point.
+ STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset);
+
+ // Gets character offsets of N-th active text selection.
+ STDMETHOD(get_selection)(long selectionIndex, long * startOffset, long * endOffset);
+
+ // Gets a range of text by offset NOTE: returned string may be longer
+ // than endOffset-startOffset bytes if text contains multi-byte characters.
+ STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text);
+
+ // Gets a specified amount of text that ends before a specified offset.
+ STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+ // Gets a specified amount of text that spans the specified offset.
+ STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+ // Gets a specified amount of text that starts after a specified offset.
+ STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+ // Unselects a range of text.
+ STDMETHOD(removeSelection)(long selectionIndex);
+
+ // Moves text caret.
+ STDMETHOD(setCaretOffset)(long offset);
+
+ // Changes the bounds of an existing selection.
+ STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset);
+
+ // Gets total number of characters.
+ // NOTE: this may be different than the total number of bytes required
+ // to store the text, if the text contains multi-byte characters.
+ STDMETHOD(get_nCharacters)(long * nCharacters);
+
+ STDMETHOD(get_newText)( IA2TextSegment *newText);
+
+ STDMETHOD(get_oldText)( IA2TextSegment *oldText);
+
+ // Makes specific part of string visible on screen.
+ STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType);
+ STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y );
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleText> pRXText;
+
+ inline com::sun::star::accessibility::XAccessibleText* GetXInterface()
+ {
+ return pRXText.get();
+ }
+};
+
+#endif // !defined(AFX_ACCTEXTBASE_H__B9AE05F6_E28B_4CF3_A8F2_EEE5D2E00B82__INCLUDED_)
diff --git a/winaccessibility/source/UAccCOM/AccValue.cxx b/winaccessibility/source/UAccCOM/AccValue.cxx
new file mode 100644
index 000000000000..60c7af88cf20
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccValue.cxx
@@ -0,0 +1,224 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccValue.h"
+#include "MAccessible.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+ * Get current value.
+ * @param currentValue Variant that accepts current value.
+ * @return Result.
+ */
+
+STDMETHODIMP CAccValue::get_currentValue(VARIANT * currentValue)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (currentValue == NULL)
+ return E_INVALIDARG;
+ if ( !pRXVal.is() )
+ return E_FAIL;
+
+ // Get Any type value from UNO.
+ ::com::sun::star::uno::Any anyVal = GetXInterface()->getCurrentValue();
+ // Convert Any to VARIANT.
+ CMAccessible::ConvertAnyToVariant(anyVal, currentValue);
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Set current value.
+ * @param Value New value should be set.
+ * @param success If the method is successfully called.
+ * @return Result.
+ */
+STDMETHODIMP CAccValue::setCurrentValue(VARIANT value)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if ( !pRXVal.is() )
+ return E_FAIL;
+
+ HRESULT hRet = S_OK;
+ ::com::sun::star::uno::Any anyVal;
+
+ // Set value according to value type.
+ switch(value.vt)
+ {
+ case VT_UI1:
+ {
+ ::com::sun::star::uno::Type typeInfo(TypeClass_CHAR, (sal_Char *)"char");
+ anyVal.setValue(&value.bVal, typeInfo);
+ }
+ break;
+
+ case VT_BOOL:
+ {
+ ::com::sun::star::uno::Type typeInfo(TypeClass_BOOLEAN, (sal_Char *)"bool");
+ anyVal.setValue(&value.boolVal, typeInfo);
+ }
+ break;
+
+ case VT_I2:
+ {
+ ::com::sun::star::uno::Type typeInfo(TypeClass_SHORT, (sal_Char *)"short");
+ anyVal.setValue(&value.iVal, typeInfo);
+ }
+ break;
+
+ case VT_I4:
+ {
+ ::com::sun::star::uno::Type typeInfo(TypeClass_LONG, (sal_Char *)"long");
+ anyVal.setValue(&value.lVal, typeInfo);
+ }
+ break;
+
+ case VT_R4:
+ {
+ ::com::sun::star::uno::Type typeInfo(TypeClass_FLOAT, (sal_Char *)"float");
+ anyVal.setValue(&value.fltVal, typeInfo);
+ }
+ break;
+
+ case VT_R8:
+ {
+ ::com::sun::star::uno::Type typeInfo(TypeClass_DOUBLE, (sal_Char *)"double");
+ anyVal.setValue(&value.dblVal, typeInfo);
+ }
+ break;
+
+ default:
+ {
+ // Unsupport type conversion.
+ hRet = E_FAIL;
+ }
+ break;
+ }
+
+ if(hRet == S_OK)
+ {
+ hRet = pRXVal->setCurrentValue(anyVal) ? S_OK : E_FAIL ;
+ }
+
+ return hRet;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get maximum value.
+ * @param maximumValue Variant that accepts maximum value.
+ * @return Result.
+ */
+STDMETHODIMP CAccValue::get_maximumValue(VARIANT *maximumValue)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (maximumValue == NULL)
+ return E_INVALIDARG;
+ if ( !pRXVal.is() )
+ return E_FAIL;
+
+ // Get Any type value from UNO.
+ ::com::sun::star::uno::Any anyVal = GetXInterface()->getMaximumValue();
+ // Convert Any to VARIANT.
+ CMAccessible::ConvertAnyToVariant(anyVal, maximumValue);
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Get minimum value.
+ * @param mininumValue Variant that accepts minimum value.
+ * @return Result.
+ */
+STDMETHODIMP CAccValue::get_minimumValue(VARIANT *mininumValue)
+{
+
+ CHECK_ENABLE_INF
+
+ ENTER_PROTECTED_BLOCK
+
+ if (mininumValue == NULL)
+ return E_FAIL;
+ if ( !pRXVal.is() )
+ return E_FAIL;
+
+ // Get Any type value from UNO.
+ ::com::sun::star::uno::Any anyVal = GetXInterface()->getMinimumValue();
+ // Convert Any to VARIANT.
+ CMAccessible::ConvertAnyToVariant(anyVal, mininumValue);
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Put valid UNO interface into com class.
+ * @param pXInterface UNO interface.
+ * @return Result.
+ */
+STDMETHODIMP CAccValue::put_XInterface(long pXInterface)
+{
+
+
+ ENTER_PROTECTED_BLOCK
+
+ CUNOXWrapper::put_XInterface(pXInterface);
+ //special query.
+ if(pUNOInterface == NULL)
+ return E_FAIL;
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ {
+ return E_FAIL;
+ }
+ Reference<XAccessibleValue> pRXI(pRContext,UNO_QUERY);
+ if( !pRXI.is() )
+ pRXVal = NULL;
+ else
+ pRXVal = pRXI.get();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
diff --git a/winaccessibility/source/UAccCOM/AccValue.h b/winaccessibility/source/UAccCOM/AccValue.h
new file mode 100644
index 000000000000..674f1e70d1e3
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccValue.h
@@ -0,0 +1,104 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#if !defined(AFX_ACCVALUE_H__CBA4972C_4188_4A18_A3CD_4A1FA3DDED38__INCLUDED_)
+#define AFX_ACCVALUE_H__CBA4972C_4188_4A18_A3CD_4A1FA3DDED38__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h" // main symbols
+
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include "UNOXWrapper.h"
+
+/**
+ * CAccValue implements IAccessibleValue interface.
+ */
+class CAccValue :
+ public CComObjectRoot,
+ public CComCoClass<CAccValue,&CLSID_AccValue>,
+ public IAccessibleValue,
+ public CUNOXWrapper
+{
+public:
+ CAccValue()
+ {
+ }
+ virtual ~CAccValue()
+ {
+ }
+
+ BEGIN_COM_MAP(CAccValue)
+ COM_INTERFACE_ENTRY(IAccessibleValue)
+ COM_INTERFACE_ENTRY(IUNOXWrapper)
+ COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+ END_COM_MAP()
+
+ static HRESULT WINAPI _SmartQI(void* pv,
+ REFIID iid, void** ppvObject, DWORD)
+ {
+ return ((CAccValue*)pv)->SmartQI(iid,ppvObject);
+ }
+
+ HRESULT SmartQI(REFIID iid, void** ppvObject)
+ {
+ if( m_pOuterUnknown )
+ return OuterQueryInterface(iid,ppvObject);
+ return E_FAIL;
+ }
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_AccValue)
+
+ // IAccessibleValue
+public:
+ // IAccessibleValue
+
+ // Returns the value of this object as a number.
+ STDMETHOD(get_currentValue)(VARIANT *currentValue);
+
+ // Sets the value of this object to the given number.
+ STDMETHOD(setCurrentValue)(VARIANT value);
+
+ // Returns the maximal value that can be represented by this object.
+ STDMETHOD(get_maximumValue)(VARIANT *maximumValue);
+
+ // Returns the minimal value that can be represented by this object.
+ STDMETHOD(get_minimumValue)(VARIANT *mininumValue);
+
+ // Overide of IUNOXWrapper.
+ STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleValue> pRXVal;
+
+ inline com::sun::star::accessibility::XAccessibleValue* GetXInterface()
+ {
+ return pRXVal.get();
+ }
+
+};
+
+#endif // !defined(AFX_ACCVALUE_H__CBA4972C_4188_4A18_A3CD_4A1FA3DDED38__INCLUDED_)
diff --git a/winaccessibility/source/UAccCOM/AccValue.rgs b/winaccessibility/source/UAccCOM/AccValue.rgs
new file mode 100644
index 000000000000..f57f318379ec
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccValue.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+ UAccCOM.AccValue.1 = s 'AccValue Class'
+ {
+ CLSID = s '{730A561B-1AF6-49E1-9C04-9A2F48CD8512}'
+ }
+ UAccCOM.AccValue = s 'AccValue Class'
+ {
+ CLSID = s '{730A561B-1AF6-49E1-9C04-9A2F48CD8512}'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {730A561B-1AF6-49E1-9C04-9A2F48CD8512} = s 'AccValue Class'
+ {
+ ProgID = s 'UAccCOM.AccValue.1'
+ VersionIndependentProgID = s 'UAccCOM.AccValue'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'both'
+ }
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/AccessibleKeyStroke.h b/winaccessibility/source/UAccCOM/AccessibleKeyStroke.h
new file mode 100644
index 000000000000..f29b116571f1
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/AccessibleKeyStroke.h
@@ -0,0 +1,157 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCESSIBLEKEYSTROKE_H_
+#define __ACCESSIBLEKEYSTROKE_H_
+
+#pragma once
+
+typedef struct _ACCESSIBLE_KEYSTROKE {
+ short modifiers;
+ short keyCode;
+ char keyChar;
+ short keyFunc;
+} ACCESSIBLE_KEYSTROKE;
+
+const short MODIFIER_SHIFT = 1;
+const short MODIFIER_CTRL = 2;
+const short MODIFIER_ALT = 4;
+
+const short KEYCODE_NUM0 = 256;
+const short KEYCODE_NUM1 = 257;
+const short KEYCODE_NUM2 = 258;
+const short KEYCODE_NUM3 = 259;
+const short KEYCODE_NUM4 = 260;
+const short KEYCODE_NUM5 = 261;
+const short KEYCODE_NUM6 = 262;
+const short KEYCODE_NUM7 = 263;
+const short KEYCODE_NUM8 = 264;
+const short KEYCODE_NUM9 = 265;
+const short KEYCODE_A = 512;
+const short KEYCODE_B = 513;
+const short KEYCODE_C = 514;
+const short KEYCODE_D = 515;
+const short KEYCODE_E = 516;
+const short KEYCODE_F = 517;
+const short KEYCODE_G = 518;
+const short KEYCODE_H = 519;
+const short KEYCODE_I = 520;
+const short KEYCODE_J = 521;
+const short KEYCODE_K = 522;
+const short KEYCODE_L = 523;
+const short KEYCODE_M = 524;
+const short KEYCODE_N = 525;
+const short KEYCODE_O = 526;
+const short KEYCODE_P = 527;
+const short KEYCODE_Q = 528;
+const short KEYCODE_R = 529;
+const short KEYCODE_S = 530;
+const short KEYCODE_T = 531;
+const short KEYCODE_U = 532;
+const short KEYCODE_V = 533;
+const short KEYCODE_W = 534;
+const short KEYCODE_X = 535;
+const short KEYCODE_Y = 536;
+const short KEYCODE_Z = 537;
+const short KEYCODE_F1 = 768;
+const short KEYCODE_F2 = 769;
+const short KEYCODE_F3 = 770;
+const short KEYCODE_F4 = 771;
+const short KEYCODE_F5 = 772;
+const short KEYCODE_F6 = 773;
+const short KEYCODE_F7 = 774;
+const short KEYCODE_F8 = 775;
+const short KEYCODE_F9 = 776;
+const short KEYCODE_F10 = 777;
+const short KEYCODE_F11 = 778;
+const short KEYCODE_F12 = 779;
+const short KEYCODE_F13 = 780;
+const short KEYCODE_F14 = 781;
+const short KEYCODE_F15 = 782;
+const short KEYCODE_F16 = 783;
+const short KEYCODE_F17 = 784;
+const short KEYCODE_F18 = 785;
+const short KEYCODE_F19 = 786;
+const short KEYCODE_F20 = 787;
+const short KEYCODE_F21 = 788;
+const short KEYCODE_F22 = 789;
+const short KEYCODE_F23 = 790;
+const short KEYCODE_F24 = 791;
+const short KEYCODE_F25 = 792;
+const short KEYCODE_F26 = 793;
+const short KEYCODE_DOWN = 1024;
+const short KEYCODE_UP = 1025;
+const short KEYCODE_LEFT = 1026;
+const short KEYCODE_RIGHT = 1027;
+const short KEYCODE_HOME = 1028;
+const short KEYCODE_END = 1029;
+const short KEYCODE_PAGEUP = 1030;
+const short KEYCODE_PAGEDOWN = 1031;
+const short KEYCODE_RETURN = 1280;
+const short KEYCODE_ESCAPE = 1281;
+const short KEYCODE_TAB = 1282;
+const short KEYCODE_BACKSPACE = 1283;
+const short KEYCODE_SPACE = 1284;
+const short KEYCODE_INSERT = 1285;
+const short KEYCODE_DELETE = 1286;
+const short KEYCODE_ADD = 1287;
+const short KEYCODE_SUBTRACT = 1288;
+const short KEYCODE_MULTIPLY = 1289;
+const short KEYCODE_DIVIDE = 1290;
+const short KEYCODE_POINT = 1291;
+const short KEYCODE_COMMA = 1292;
+const short KEYCODE_LESS = 1293;
+const short KEYCODE_GREATER = 1294;
+const short KEYCODE_EQUAL = 1295;
+const short KEYCODE_OPEN = 1296;
+const short KEYCODE_CUT = 1297;
+const short KEYCODE_COPY = 1298;
+const short KEYCODE_PASTE = 1299;
+const short KEYCODE_UNDO = 1300;
+const short KEYCODE_REPEAT = 1301;
+const short KEYCODE_FIND = 1302;
+const short KEYCODE_PROPERTIES = 1303;
+const short KEYCODE_FRONT = 1304;
+const short KEYCODE_CONTEXTMENU = 1305;
+const short KEYCODE_HELP = 1306;
+
+const short SHORTCUT_DONTKNOW = 0;
+const short NEW = 1;
+const short OPEN = 2;
+const short SAVE = 3;
+const short SAVEAS = 4;
+const short PRINT = 5;
+const short CLOSE = 6;
+const short QUIT = 7;
+const short CUT = 8;
+const short COPY = 9;
+const short PASTE = 10;
+const short UNDO = 11;
+const short REDO = 12;
+const short UNODELETE = 13;
+const short REPEAT = 14;
+const short FIND = 15;
+const short FINDBACKWARD = 16;
+const short PROPERTIES = 17;
+const short FRONT = 18;
+
+
+#endif //#define __ACCESSIBLEKEYSTROKE_H_
diff --git a/winaccessibility/source/UAccCOM/CheckEnableAccessible.cxx b/winaccessibility/source/UAccCOM/CheckEnableAccessible.cxx
new file mode 100644
index 000000000000..fa61021c388c
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/CheckEnableAccessible.cxx
@@ -0,0 +1,35 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#define WNT
+#define _USE_NAMESPACE
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#include "CheckEnableAccessible.h"
+
+
+bool IsEnableAccessibleInterface()
+{
+ return Application::IsEnableAccessInterface();
+}
diff --git a/winaccessibility/source/UAccCOM/CheckEnableAccessible.h b/winaccessibility/source/UAccCOM/CheckEnableAccessible.h
new file mode 100644
index 000000000000..729817dc6f86
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/CheckEnableAccessible.h
@@ -0,0 +1,30 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef _CHECKENABLEACCESSIBLE_HXX
+#define _CHECKENABLEACCESSIBLE_HXX
+
+bool IsEnableAccessibleInterface();
+
+#define CHECK_ENABLE_INF if(!IsEnableAccessibleInterface()){ return S_FALSE; }
+#define CHECK_ENABLE_INF_ZERO if(!IsEnableAccessibleInterface()){ return 0; }
+
+#endif //_CHECKENABLEACCESSIBLE_HXX
diff --git a/winaccessibility/source/UAccCOM/EnumVariant.cxx b/winaccessibility/source/UAccCOM/EnumVariant.cxx
new file mode 100644
index 000000000000..271b288df42b
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/EnumVariant.cxx
@@ -0,0 +1,227 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "EnumVariant.h"
+#include "MAccessible.h"
+
+#include "act.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// CEnumVariant
+
+
+
+/**
+ * enumarate method,get next element
+ * @param cElements The number of elements to be returned.
+ * @param pvar An array of at least size celt in which the elements are to be returned.
+ * @param pcElementFetched Pointer to the number of elements returned in rgVar, or Null¡£
+ * @return Result.
+ */
+HRESULT STDMETHODCALLTYPE CEnumVariant::Next(ULONG cElements,VARIANT __RPC_FAR *pvar,ULONG __RPC_FAR *pcElementFetched)
+{
+ long l1;
+ ULONG l2;
+
+ if (pvar == NULL)
+ return E_INVALIDARG;
+
+ CHECK_ENABLE_INF
+ if (pcElementFetched != NULL)
+ *pcElementFetched = 0;
+
+ // Retrieve the next cElements.
+ for (l1=m_lCurrent, l2=0; l1<m_pXAccessibleSelection->getSelectedAccessibleChildCount() &&
+ l2<cElements; l1++, l2++)
+ {
+ Reference< XAccessible > pRXAcc = m_pXAccessibleSelection->getSelectedAccessibleChild(l1);
+ IAccessible* pChild = NULL;
+ BOOL isGet = CMAccessible::get_IAccessibleFromXAccessible((long)pRXAcc.get(),&pChild);
+ if(isGet)
+ {
+ pvar[l2].vt = VT_I4;
+ ((IMAccessible*)pChild)->Get_XAccChildID(&pvar[l2].lVal);
+ }
+ else if(pRXAcc.is())
+ {
+ if(CMAccessible::g_pAgent)
+ CMAccessible::g_pAgent->InsertAccObj(pRXAcc.get(),pUNOInterface,NULL);
+ BOOL isGet = CMAccessible::get_IAccessibleFromXAccessible((long)pRXAcc.get(),&pChild);
+ if(isGet)
+ {
+ pvar[l2].vt = VT_I4;
+ ((IMAccessible*)pChild)->Get_XAccChildID(&pvar[l2].lVal);
+ }
+ }
+ }
+ // Set count of elements retrieved.
+ if (pcElementFetched != NULL)
+ *pcElementFetched = l2;
+ m_lCurrent = l1;
+
+ return (l2 < cElements) ? S_FALSE : NOERROR;
+}
+
+/**
+ * skip the elements in the given range when enumarate elements
+ * @param cElements The number of elements to skip.
+ * @return Result.
+ */
+HRESULT STDMETHODCALLTYPE CEnumVariant::Skip(ULONG cElements)
+{
+ CHECK_ENABLE_INF
+ m_lCurrent += cElements;
+ if (m_lCurrent > (long)(m_lLBound+m_pXAccessibleSelection->getSelectedAccessibleChildCount()))
+ {
+ m_lCurrent = m_lLBound+m_pXAccessibleSelection->getSelectedAccessibleChildCount();
+ return E_FAIL;
+ }
+ else
+ return NOERROR;
+}
+
+
+/**
+ * reset the enumaration position to initial value
+ * @param
+ * @return Result.
+ */
+HRESULT STDMETHODCALLTYPE CEnumVariant::Reset( void)
+{
+ m_lCurrent = m_lLBound;
+ return NOERROR;
+}
+
+
+/**
+ *create a new IEnumVariant object,
+ *copy current enumaration container and its state to
+ *the new object
+ *AT will use the copy object to get elements
+ * @param ppenum On return, pointer to the location of the clone enumerator¡£
+ * @return Result.
+ */
+HRESULT STDMETHODCALLTYPE CEnumVariant::Clone(IEnumVARIANT __RPC_FAR *__RPC_FAR *ppenum)
+{
+ CEnumVariant * penum = NULL;
+ HRESULT hr;
+ if (ppenum == NULL)
+ return E_INVALIDARG;
+
+ *ppenum = NULL;
+
+ hr = Create(&penum);
+ if( hr == S_OK )
+ {
+ penum->PutSelection((long)pUNOInterface);
+ *ppenum = penum;
+ }
+ else
+ {
+ if (penum)
+ penum->Release();
+ }
+ return hr;
+}
+
+/**
+ *Static public method to create a CLSID_EnumVariant com object.
+ * @param ppenum Pointer to accept com object.
+ * @return Result.
+ */
+HRESULT STDMETHODCALLTYPE CEnumVariant::Create(CEnumVariant __RPC_FAR *__RPC_FAR *ppenum)
+{
+ ActivateActContext();
+ HRESULT hr = CoCreateInstance(CLSID_EnumVariant,NULL,
+ CLSCTX_SERVER,IID_IEnumVariant,(void **)ppenum);
+ DeactivateActContext();
+ if (S_OK != hr)
+ {
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+
+/**
+ *Return count of elements in current container
+ * @param.
+ * @return count of elements in current container.
+ */
+long CEnumVariant::GetCountOfElements()
+{
+ CHECK_ENABLE_INF_ZERO
+
+ if(m_pXAccessibleSelection.is())
+ return m_pXAccessibleSelection->getSelectedAccessibleChildCount();
+ return 0;
+}
+
+/**
+ * Set memeber m_pXAccessibleSelection to NULL and m_lCurrent to m_lLBound.
+ * @param.
+ * @return Result
+ */
+STDMETHODIMP CEnumVariant::ClearEnumeration()
+{
+ pUNOInterface = NULL;
+ m_pXAccessibleSelection = NULL;
+ m_lCurrent = m_lLBound;
+ return S_OK;
+}
+
+/**
+ *Static method to fetch XAccessibleSelection
+ * @param pXAcc XAccessible interface.
+ * @return XAccessibleSelection interface.
+ */
+static Reference<XAccessibleSelection> GetXAccessibleSelection(XAccessible* pXAcc)
+{
+ XAccessibleSelection* pSelection = NULL;
+ Reference< XAccessibleContext > pRContext;
+
+ if( pXAcc == NULL)
+ return NULL;
+
+ pRContext = pXAcc->getAccessibleContext();
+ if( !pRContext.is() )
+ return NULL;
+
+ Reference< XAccessibleSelection > pRSelection(pRContext,UNO_QUERY);
+ if( !pRSelection.is() )
+ return NULL;
+
+ return pRSelection;
+}
+
+/**
+ * Put valid UNO XAccessible interface.
+ * @param pXSelection XAccessible interface.
+ * @return Result..
+ */
+STDMETHODIMP CEnumVariant::PutSelection(long pXSelection)
+{
+ pUNOInterface = (XAccessible*)pXSelection;
+ m_pXAccessibleSelection = GetXAccessibleSelection(pUNOInterface);
+ return S_OK;
+}
diff --git a/winaccessibility/source/UAccCOM/EnumVariant.h b/winaccessibility/source/UAccCOM/EnumVariant.h
new file mode 100644
index 000000000000..1089abdf6415
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/EnumVariant.h
@@ -0,0 +1,106 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ENUMVARIANT_H_
+#define __ENUMVARIANT_H_
+
+#define WNT
+
+#include "resource.h" // main symbols
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include "UAccCOM2.h"
+#include <AccObjectManagerAgent.hxx>
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+#include <vector>
+#include <algorithm>
+using namespace std;
+
+/**
+ * CEnumVariant implements IEnumVARIANT interface.
+ */
+class ATL_NO_VTABLE CEnumVariant :
+ public CComObjectRootEx<CComMultiThreadModel>,
+ public CComCoClass<CEnumVariant, &CLSID_EnumVariant>,
+ public IDispatchImpl<IEnumVariant, &IID_IEnumVariant, &LIBID_UACCCOMLib>
+{
+public:
+ CEnumVariant()
+ :m_lLBound(0),
+ pUNOInterface(NULL),
+ m_pXAccessibleSelection(NULL)
+ {
+ m_lCurrent = m_lLBound;
+ }
+
+ virtual ~CEnumVariant() {};
+
+ DECLARE_REGISTRY_RESOURCEID(IDR_ENUMVARIANT)
+
+ DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+ BEGIN_COM_MAP(CEnumVariant)
+ COM_INTERFACE_ENTRY(IEnumVariant)
+ COM_INTERFACE_ENTRY(IEnumVARIANT)
+ END_COM_MAP()
+
+ // IEnumVariant
+public:
+
+ STDMETHOD(ClearEnumeration)();
+
+ // IEnumVARIANT
+
+ //
+ HRESULT STDMETHODCALLTYPE Next(ULONG cElements,VARIANT __RPC_FAR *pvar,ULONG __RPC_FAR *pcElementFetched);
+
+ //
+ HRESULT STDMETHODCALLTYPE Skip(ULONG cElements);
+
+ //
+ HRESULT STDMETHODCALLTYPE Reset( void);
+
+ //
+ HRESULT STDMETHODCALLTYPE Clone(IEnumVARIANT __RPC_FAR *__RPC_FAR *ppenum);
+
+ // IEnumVariant
+
+ //
+ HRESULT STDMETHODCALLTYPE PutSelection(long pXSelection);
+
+ //
+ static HRESULT STDMETHODCALLTYPE Create(CEnumVariant __RPC_FAR *__RPC_FAR *ppenum);
+
+ //
+ long GetCountOfElements();
+
+private:
+
+ long m_lCurrent;
+ long m_lLBound;
+ XAccessible* pUNOInterface; // XAccessible.
+ Reference<XAccessibleSelection> m_pXAccessibleSelection; // Selection.
+};
+
+#endif //__ENUMVARIANT_H_
diff --git a/winaccessibility/source/UAccCOM/EnumVariant.rgs b/winaccessibility/source/UAccCOM/EnumVariant.rgs
new file mode 100644
index 000000000000..c5decdc4728f
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/EnumVariant.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+ UAccCOM.EnumVariant.1 = s 'EnumVariant Class'
+ {
+ CLSID = s '{152884E0-268B-4481-9AE7-1B372D3AA97F}'
+ }
+ UAccCOM.EnumVariant = s 'EnumVariant Class'
+ {
+ CLSID = s '{152884E0-268B-4481-9AE7-1B372D3AA97F}'
+ CurVer = s 'UAccCOM.EnumVariant.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {152884E0-268B-4481-9AE7-1B372D3AA97F} = s 'EnumVariant Class'
+ {
+ ProgID = s 'UAccCOM.EnumVariant.1'
+ VersionIndependentProgID = s 'UAccCOM.EnumVariant'
+ ForceRemove 'Programmable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Both'
+ }
+ 'TypeLib' = s '{19ECB1B0-9376-4FF9-B580-223FC9C200B8}'
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
new file mode 100644
index 000000000000..155c3afe70d8
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -0,0 +1,3267 @@
+/**************************************************************
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*************************************************************/
+
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "MAccessible.h"
+
+#include <algorithm>
+#include "AccAction.h"
+
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#include <com/sun/star/accessibility/XAccessibleImage.hpp>
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
+#include <com/sun/star/accessibility/XAccessibleHyperText.hpp>
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleGroupPosition.hpp>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/TabStop.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+
+#include "act.hxx"
+
+using namespace com::sun::star::accessibility::AccessibleStateType;
+
+// IA2 states mapping, and name
+// maintenance the consistency, change one array, change the three all
+long IA2_STATES[] =
+{
+ IA2_STATE_ACTIVE, // = 0x1;
+ IA2_STATE_ARMED, // = 0x2;
+ IA2_STATE_DEFUNCT, // = 0x4;
+ IA2_STATE_EDITABLE, // = 0x8;
+ IA2_STATE_HORIZONTAL, // = 0x10;
+ IA2_STATE_ICONIFIED, // = 0x20;
+ IA2_STATE_INVALID_ENTRY, // = 0x80;
+ IA2_STATE_MANAGES_DESCENDANTS, // = 0x100;
+ IA2_STATE_MODAL, // = 0x200;
+ IA2_STATE_MULTI_LINE, // = 0x400;
+ IA2_STATE_OPAQUE, // = 0x800;
+ IA2_STATE_REQUIRED, // = 0x2000;
+ IA2_STATE_SELECTABLE_TEXT, // = 0x3000;
+ IA2_STATE_SINGLE_LINE, // = 0x4000;
+ IA2_STATE_STALE, // = 0x8000;
+ IA2_STATE_SUPPORTS_AUTOCOMPLETION, // = 0x10000;
+ IA2_STATE_TRANSIENT, //= 0x20000;
+ IA2_STATE_VERTICAL // = 0x40000;
+};
+/*
+
+<=== map ===>
+
+*/
+short UNO_STATES[] =
+{
+ ACTIVE, // = (sal_Int16)1;
+ ARMED, // = (sal_Int16)2;
+ DEFUNC, // = (sal_Int16)5;
+ EDITABLE, // = (sal_Int16)6;
+ HORIZONTAL, // = (sal_Int16)12;
+ ICONIFIED, // = (sal_Int16)13;
+ -1, //IA2_STATE_INVALID_ENTRY
+ MANAGES_DESCENDANTS, // = (sal_Int16)15;
+ MODAL, // = (sal_Int16)16;
+ MULTI_LINE, // = (sal_Int16)17;
+ OPAQUE, // = (sal_Int16)19;
+ -1, //IA2_STATE_REQUIRED
+ -1, //IA2_STATE_SELECTABLE_TEXT
+ SINGLE_LINE, // = (sal_Int16)26;
+ STALE, // = (sal_Int16)27;
+ -1, //IA2_STATE_SUPPORTS_AUTOCOMPLETION
+ TRANSIENT, //IA2_STATE_TRANSIENT
+ VERTICAL // = (sal_Int16)29;
+};
+
+// <=== map ===>
+
+BSTR IA2_STATES_NAME[] =
+{
+ _T("Active"),
+ _T("Armed"),
+ _T("Defunct"),
+ _T("Editable"),
+ _T("Horizontal"),
+ _T("Iconified"),
+ _T("Invalid Entry"),
+ _T("Manages Decendents"),
+ _T("Modal"),
+ _T("Multi Line"),
+ _T("Opaque"),
+ _T("Required"),
+ _T("Selectable Text"),
+ _T("Single Line"),
+ _T("Stale"),
+ _T("Supports Autocompletion"),
+ _T("Transient"),
+ _T("Vertical")
+};
+
+// IA2 states mapping, and name
+// maintenance the consistency. change one, change them all
+
+BSTR UNO_ALL_STATES[] =
+{
+ _T("INVALID"), // INVALID ( 0 )
+ _T("ACTIVE"), // ACTIVE ( 1 )
+ _T("ARMED"), // ARMED ( 2 )
+ _T("BUSY"), // BUSY ( 3 )
+ _T("CHECKED"), // CHECKED ( 4 )
+ _T("DEFUNC"), // DEFUNC ( 5 )
+ _T("EDITABLE"), // EDITABLE ( 6 )
+ _T("ENABLED"), // ENABLED ( 7 )
+ _T("EXPANDABLE"), // EXPANDABLE ( 8 )
+ _T("EXPANDED"), // EXPANDED ( 9 )
+ _T("FOCUSABLE"), // FOCUSABLE ( 10 )
+ _T("FOCUSED"), // FOCUSED ( 11 )
+ _T("HORIZONTAL"), // HORIZONTAL ( 12 )
+ _T("ICONIFIED"), // ICONIFIED ( 13 )
+ _T("INDETERMINATE"), // INDETERMINATE ( 14 )
+ _T("MANAGES_DESCENDANTS"),// MANAGES_DESCENDANTS ( 15 )
+ _T("MODAL"), // MODAL ( 16 )
+ _T("MULTI_LINE"), // MULTI_LINE ( 17 )
+ _T("MULTI_SELECTABLE"), // MULTI_SELECTABLE ( 18 )
+ _T("OPAQUE"), // OPAQUE ( 19 )
+ _T("PRESSED"), // PRESSED ( 20 )
+ _T("RESIZABLE"), // RESIZABLE ( 21 )
+ _T("SELECTABLE"), // SELECTABLE ( 22 )
+ _T("SELECTED"), // SELECTED ( 23 )
+ _T("SENSITIVE"), // SENSITIVE ( 24 )
+ _T("SHOWING"), // SHOWING ( 25 )
+ _T("SINGLE_LINE"), // SINGLE_LINE ( 26 )
+ _T("STALE"), // STALE ( 27 )
+ _T("TRANSIENT"), // TRANSIENT ( 28 )
+ _T("VERTICAL"), // VERTICAL ( 29 )
+ _T("VISIBLE"), // VISIBLE ( 30 )
+ _T("MOVEABLE"), // MOVEABLE ( 31 )
+ _T("OFFSCREEN"), // OFFSCREEN ( 32 )
+ _T("COLLAPSE"), // COLLAPSE ( 33 )
+ _T("DEFAULT") // DEFAULT ( 34 )
+};
+
+
+using namespace com::sun::star::accessibility::AccessibleRole;
+
+
+
+#define QUERYXINTERFACE(ainterface) \
+{ \
+ if(pXAcc == NULL) \
+ return FALSE; \
+ pRContext = pXAcc->getAccessibleContext(); \
+ if( !pRContext.is() ) \
+{ \
+ return FALSE; \
+} \
+ Reference<X##ainterface> pRXI(pRContext,UNO_QUERY);\
+ if( !pRXI.is() ) \
+{ \
+ return FALSE; \
+} \
+ *ppXI = (XInterface*)pRXI.get(); \
+ return TRUE; \
+}
+
+#define ISDESTROY() \
+ if(m_isDestroy) \
+ return S_FALSE;
+
+
+AccObjectManagerAgent* CMAccessible::g_pAgent = NULL;
+
+CMAccessible::CMAccessible():
+m_iRole(0x00),
+m_dState(0x00),
+m_dChildID(0x00),
+m_dFocusChildID(UACC_NO_FOCUS),
+m_hwnd(NULL),
+m_pIParent(NULL),
+m_pszName(NULL),
+m_pszValue(NULL),
+m_pszDescription(NULL),
+m_isDestroy(FALSE),
+m_pszActionDescription(NULL),
+m_pXAction(NULL),
+m_bRequiresSave(FALSE),
+pUNOInterface(NULL)
+{
+ m_sLocation.m_dLeft=0;
+ m_sLocation.m_dTop = 0;
+ m_sLocation.m_dWidth=0;
+ m_sLocation.m_dHeight=0;
+ CEnumVariant::Create(&m_pEnumVar);
+}
+
+CMAccessible::~CMAccessible()
+{
+ if(m_pszName!=NULL)
+ {
+ SAFE_SYSFREESTRING(m_pszName);
+ m_pszName=NULL;
+ }
+ if(m_pszValue!=NULL)
+ {
+ SAFE_SYSFREESTRING(m_pszValue);
+ m_pszValue=NULL;
+ }
+ if(m_pszDescription!=NULL)
+ {
+ SAFE_SYSFREESTRING(m_pszDescription);
+ m_pszDescription=NULL;
+ }
+
+ if(m_pszActionDescription!=NULL)
+ {
+ SAFE_SYSFREESTRING(m_pszActionDescription);
+ m_pszActionDescription=NULL;
+ }
+
+ if(m_pIParent)
+ {
+ m_pIParent->Release();
+ m_pIParent=NULL;
+ }
+ pRef = NULL;
+ m_pEnumVar->Release();
+ m_containedObjects.clear();
+ pRContext = NULL;
+}
+
+/**
+* Returns the Parent IAccessible interface pointer to AT.
+* It should add reference, and the client should release the component.
+* It should return E_FAIL when the parent point is null.
+* @param ppdispParent [in,out] used to return the parent interface point.
+* when the point is null, should return null.
+* @return S_OK if successful and E_FAIL if the m_pIParent is NULL.
+*/
+STDMETHODIMP CMAccessible::get_accParent(IDispatch **ppdispParent)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(ppdispParent == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ if(m_pIParent)
+ {
+ *ppdispParent = m_pIParent;
+ (*ppdispParent)->AddRef();
+ return S_OK;
+ }
+ else if(m_hwnd)
+ {
+ HRESULT hr = AccessibleObjectFromWindow(m_hwnd, OBJID_WINDOW, IID_IAccessible, (void**)ppdispParent);
+ if( ! SUCCEEDED( hr ) || ! ppdispParent )
+ {
+ return S_FALSE;
+ }
+ return S_OK;
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns child count of current COM object.
+* @param pcountChildren [in,out] used to return the children count.
+* @return S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::get_accChildCount(long *pcountChildren)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pcountChildren == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ if(!pUNOInterface)
+ return S_FALSE;
+
+ Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext();
+ if( pRContext.is() )
+ {
+ *pcountChildren = pRContext->getAccessibleChildCount();
+ }
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns child interface pointer for AT according to input child ID.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param ppdispChild, [in,out] use to return the child interface point.
+* @return S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accChild(VARIANT varChild, IDispatch **ppdispChild)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(ppdispChild == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ if(varChild.vt==VT_I4)
+ {
+ //get child interface pointer due to child ID
+ if(varChild.lVal==CHILDID_SELF)
+ {
+ AddRef();
+ *ppdispChild = this;
+ return S_OK;
+ }
+ *ppdispChild = GetChildInterface(varChild.lVal);
+ (*ppdispChild)->AddRef();
+ return (*ppdispChild)?S_OK:S_FALSE;
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible name of the current COM object self or its one child to AT.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param pszName, [in,out] use to return the name of the proper object.
+* @return S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accName(VARIANT varChild, BSTR *pszName)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pszName == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ if(varChild.vt==VT_I4)
+ {
+ if(varChild.lVal==CHILDID_SELF)
+ {
+ SAFE_SYSFREESTRING(*pszName);
+ *pszName = SysAllocString(m_pszName);
+ return S_OK;
+ }
+
+ long lVal = varChild.lVal;
+ varChild.lVal = CHILDID_SELF;
+ IMAccessible *pChild = this->GetChildInterface(lVal);
+ if(!pChild)
+ return E_FAIL;
+ return pChild->get_accName(varChild,pszName);
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible value of the current COM object self or its one child to AT.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param pszValue, [in,out] use to return the value of the proper object.
+* @return S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accValue(VARIANT varChild, BSTR *pszValue)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if( pszValue == NULL )
+ {
+ return E_INVALIDARG;
+ }
+ if( varChild.vt==VT_I4 )
+ {
+ if(varChild.lVal==CHILDID_SELF)
+ {
+ if(m_dState & STATE_SYSTEM_PROTECTED)
+ return E_ACCESSDENIED;
+
+ if ( m_pszValue !=NULL && wcslen(m_pszValue) == 0 )
+ return S_OK;
+
+ SAFE_SYSFREESTRING(*pszValue);
+ *pszValue = SysAllocString(m_pszValue);
+ return S_OK;
+ }
+
+ long lVal = varChild.lVal;
+ varChild.lVal = CHILDID_SELF;
+ IMAccessible *pChild = this->GetChildInterface(lVal);
+ if(!pChild)
+ return E_FAIL;
+ return pChild->get_accValue(varChild,pszValue);
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible description of the current COM object self or its one child to AT.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param pszDescription, [in,out] use to return the description of the proper object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::get_accDescription(VARIANT varChild, BSTR *pszDescription)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pszDescription == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ if(varChild.vt==VT_I4)
+ {
+ if(varChild.lVal==CHILDID_SELF)
+ {
+ SAFE_SYSFREESTRING(*pszDescription);
+ *pszDescription = SysAllocString(m_pszDescription);
+ return S_OK;
+ }
+
+ long lVal = varChild.lVal;
+ varChild.lVal = CHILDID_SELF;
+ IMAccessible *pChild = this->GetChildInterface(lVal);
+ if(!pChild)
+ return E_FAIL;
+ return pChild->get_accDescription(varChild,pszDescription);
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible role of the current COM object self or its one child to AT.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param pvarRole, [in,out] use to return the role of the proper object.
+* @return S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accRole(VARIANT varChild, VARIANT *pvarRole)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pvarRole == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ if(varChild.vt == VT_I4)
+ {
+
+ if(varChild.lVal == CHILDID_SELF)
+ {
+ if( m_iRole < IA2_ROLE_CAPTION )
+ {
+ VariantInit(pvarRole);
+ pvarRole->vt = VT_I4;
+ pvarRole->lVal = m_iRole;
+ }
+ else
+ {
+ VariantInit(pvarRole);
+ pvarRole->vt = VT_I4;
+ pvarRole->lVal = ROLE_SYSTEM_CLIENT;
+ }
+ return S_OK;
+ }
+
+
+ long lVal = varChild.lVal;
+ varChild.lVal = CHILDID_SELF;
+ IMAccessible *pChild = this->GetChildInterface(lVal);
+ if(!pChild)
+ return E_FAIL;
+ return pChild->get_accRole(varChild,pvarRole);
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible state of the current COM object self or its one child to AT.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param pvarState, [in,out] use to return the state of the proper object.
+* @return S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accState(VARIANT varChild, VARIANT *pvarState)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pvarState == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ if(varChild.vt==VT_I4)
+ {
+ if(varChild.lVal == CHILDID_SELF)
+ {
+ if(pUNOInterface)
+ {
+ Reference< XAccessibleContext > pContext = pUNOInterface->getAccessibleContext();
+ if(pContext.is())
+ {
+ // add the STATE_SYSTEM_LINKED state
+ Reference< XAccessibleHypertext > pRHypertext(pContext,UNO_QUERY);
+ if(pRHypertext.is())
+ {
+ if( pRHypertext->getHyperLinkCount() > 0 )
+ m_dState |= STATE_SYSTEM_LINKED;
+ else
+ m_dState &= ~STATE_SYSTEM_LINKED;
+ }
+ else
+ m_dState &= ~STATE_SYSTEM_LINKED;
+ }
+ }
+
+ VariantInit(pvarState);
+ pvarState->vt = VT_I4;
+ pvarState->lVal = m_dState;
+ return S_OK;
+ }
+
+ long lVal = varChild.lVal;
+ varChild.lVal = CHILDID_SELF;
+ IMAccessible *pChild = this->GetChildInterface(lVal);
+ if(!pChild)
+ return E_FAIL;
+ return pChild->get_accState(varChild,pvarState);
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible helpString of the current COM object self or its one child to AT.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param pszHelp, [in,out] use to return the helpString of the proper object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::get_accHelp(VARIANT, BSTR *)
+{
+ return E_NOTIMPL;
+}
+
+/**
+* Returns the accessible HelpTopic of the current COM object self or its one child to AT.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param pszHelpFile, [in,out] use to return the HelpTopic of the proper object.
+* @param pidTopic, use to return the HelpTopic ID of the proper object.
+* @return S_OK if successful and E_FAIL if failure.
+* Not implemented yet
+*/
+STDMETHODIMP CMAccessible::get_accHelpTopic(BSTR *, VARIANT, long *)
+{
+ return E_NOTIMPL;
+}
+
+static void GetMnemonicChar( const ::rtl::OUString& aStr, WCHAR* wStr)
+{
+ int nLen = aStr.pData->length;
+ int i = 0;
+ WCHAR* text = aStr.pData->buffer;
+
+ while ( i < nLen )
+ {
+ if ( text[i] == L'~' )
+ if ( text[i+1] != L'~' )
+ {
+ wStr[0] = text[i+1];
+ break;
+ }
+ i++;
+ }
+}
+
+/**
+* Returns the accessible keyboard shortcut of the current COM object self or its one child to AT.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param pszKeyboardShortcut, [in,out] use to return the kbshortcut of the proper object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT varChild, BSTR *pszKeyboardShortcut)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+
+ ISDESTROY()
+ // #CHECK#
+ if(pszKeyboardShortcut == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ if(varChild.vt==VT_I4)
+ {
+ if(varChild.lVal == CHILDID_SELF)
+ {
+ if( pUNOInterface )
+ {
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ return S_FALSE;
+
+ Reference<XAccessibleAction> pRXI(pRContext,UNO_QUERY);
+
+ OLECHAR wString[64]={0};
+
+ if( pRXI.is() && pRXI->getAccessibleActionCount() >= 1)
+ {
+ Reference< XAccessibleKeyBinding > binding = pRXI->getAccessibleActionKeyBinding(0);
+ if( binding.is() )
+ {
+ long nCount = binding->getAccessibleKeyBindingCount();
+ if(nCount >= 1)
+ {
+ CAccAction::GetkeyBindingStrByXkeyBinding( binding->getAccessibleKeyBinding(0),wString );
+ }
+ }
+ }
+ if(wString[0] == 0)
+ {
+ Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet();
+ if(!pRrelationSet.is())
+ {
+ return S_FALSE;
+ }
+
+ long nRelCount = pRrelationSet->getRelationCount();
+
+ // Modified by Steve Yin, for SODC_1552
+ if( /*nRelCount <= 0 &&*/ m_iRole == ROLE_SYSTEM_TEXT )
+ {
+ VARIANT varParentRole;
+ VariantInit( &varParentRole );
+
+ m_pIParent->get_accRole(varChild, &varParentRole);
+
+ if( m_pIParent && varParentRole.lVal == ROLE_SYSTEM_COMBOBOX ) // edit in comoboBox
+ {
+ m_pIParent->get_accKeyboardShortcut(varChild, pszKeyboardShortcut);
+ return S_OK;
+ }
+ }
+
+ AccessibleRelation *paccRelation = NULL;
+ AccessibleRelation accRelation;
+ for(int i=0; i<nRelCount ; i++)
+ {
+ if( pRrelationSet->getRelation(i).RelationType == 6 )
+ {
+ accRelation = pRrelationSet->getRelation(i);
+ paccRelation = &accRelation;
+ }
+ }
+
+ if(paccRelation == NULL)
+ return S_FALSE;
+
+ Sequence< Reference< XInterface > > xTargets = paccRelation->TargetSet;
+ Reference<XInterface> pRAcc = xTargets[0];
+
+ XAccessible* pXAcc = (XAccessible*)pRAcc.get();
+
+ Reference<XAccessibleContext> pRLebelContext = pXAcc->getAccessibleContext();
+ if(!pRLebelContext.is())
+ return S_FALSE;
+
+ pRrelationSet = pRLebelContext->getAccessibleRelationSet();
+ nRelCount = pRrelationSet->getRelationCount();
+
+ paccRelation = NULL;
+ for(int j=0; j<nRelCount ; j++)
+ {
+ if( pRrelationSet->getRelation(j).RelationType == 5 )
+ {
+ accRelation = pRrelationSet->getRelation(j);
+ paccRelation = &accRelation;
+ }
+ }
+
+ if(paccRelation)
+ {
+ xTargets = paccRelation->TargetSet;
+ pRAcc = xTargets[0];
+ if(pUNOInterface != (XAccessible*)pRAcc.get())
+ return S_FALSE;
+ }
+
+ Reference<XAccessibleExtendedComponent> pRXIE(pRLebelContext,UNO_QUERY);
+ if(!pRXIE.is())
+ return S_FALSE;
+
+ ::rtl::OUString ouStr = pRXIE->getTitledBorderText();
+ WCHAR key[2] = {NULL};
+ GetMnemonicChar(ouStr, key);
+ if(key[0] != 0)
+ {
+ wcscat(wString, L"Alt+");
+ wcscat(wString, key);
+ }
+ else
+ return S_FALSE;
+ }
+
+ SAFE_SYSFREESTRING(*pszKeyboardShortcut);
+ *pszKeyboardShortcut = SysAllocString(wString);
+
+ return S_OK;
+ }
+ else
+ {
+ return S_FALSE;
+ }
+ }
+
+ long lVal = varChild.lVal;
+ varChild.lVal = CHILDID_SELF;
+ IMAccessible *pChild = this->GetChildInterface(lVal);
+ if(!pChild)
+ return E_FAIL;
+
+ return pChild->get_accKeyboardShortcut(varChild,pszKeyboardShortcut);
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the current focused child to AT.
+* @param pvarChild, [in,out] vt member of pvarChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::get_accFocus(VARIANT *pvarChild)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pvarChild == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ if( m_dFocusChildID==UACC_NO_FOCUS )
+ {
+ pvarChild->vt = VT_EMPTY;//no focus on the object and its children
+ return S_OK;
+ }
+ //if the descendant of current object has focus indicated by m_dFocusChildID, return the IDispatch of this focused object
+ else
+ {
+ IMAccessible* pIMAcc = NULL;
+ g_pAgent->GetIAccessibleFromResID(m_dFocusChildID,&pIMAcc);
+ pIMAcc->AddRef();
+ pvarChild->vt = VT_DISPATCH;
+ pvarChild->pdispVal = pIMAcc;
+
+ }
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the selection of the current COM object to AT.
+* @param pvarChildren,[in,out]
+* if selection num is 0,return VT_EMPTY for vt,
+* if selection num is 1,return VT_I4 for vt,and child index for lVal
+* if selection num >1,return VT_UNKNOWN for vt, and IEnumVariant* for punkVal
+* @return S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accSelection(VARIANT *pvarChildren)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pvarChildren == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ switch(m_pEnumVar->GetCountOfElements())
+ {
+ case 0:
+ pvarChildren->vt = VT_EMPTY;
+ break;
+ case 1:
+ VARIANT varTmp[1];
+ ULONG count;
+ VariantInit(&varTmp[0]);
+ m_pEnumVar->Next(1,varTmp,&count);
+ if(count!=1)
+ return S_FALSE;
+ pvarChildren->vt = VT_I4;
+ pvarChildren->lVal = varTmp[0].lVal;
+ VariantClear(&varTmp[0]);
+ m_pEnumVar->Reset();
+ break;
+ default:
+ pvarChildren->vt = VT_UNKNOWN;
+ m_pEnumVar->AddRef();
+ pvarChildren->punkVal = m_pEnumVar;
+ break;
+ }
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the location of the current COM object self or its one child to AT.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param pxLeft, [in,out] use to return the x-coordination of the proper object.
+* @param pyTop, [in,out] use to return the y-coordination of the proper object.
+* @param pcxWidth, [in,out] use to return the x-coordination width of the proper object.
+* @param pcyHeight, [in,out] use to return the y-coordination height of the proper object.
+* @return S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varChild)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pxLeft == NULL || pyTop == NULL || pcxWidth == NULL || pcyHeight == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ if(varChild.vt==VT_I4)
+ {
+ if(varChild.lVal==CHILDID_SELF)
+ {
+
+ if(pUNOInterface)
+ {
+ Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ return S_FALSE;
+ Reference< XAccessibleComponent > pRComponent(pRContext,UNO_QUERY);
+ if( !pRComponent.is() )
+ return S_FALSE;
+
+ ::com::sun::star::awt::Point pCPoint = pRComponent->getLocationOnScreen();
+ ::com::sun::star::awt::Size pCSize = pRComponent->getSize();
+ *pxLeft = pCPoint.X;
+ *pyTop = pCPoint.Y;
+ *pcxWidth = pCSize.Width;
+ *pcyHeight = pCSize.Height;
+ return S_OK;
+ }
+ else
+ {
+ *pxLeft = m_sLocation.m_dLeft;
+ *pyTop = m_sLocation.m_dTop;
+ *pcxWidth = m_sLocation.m_dWidth;
+ *pcyHeight = m_sLocation.m_dHeight;
+ return S_OK;
+ }
+ }
+
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the current focused child to AT.
+* @param navDir, the direction flag of the navigation.
+* @param varStart, the start child id of this navigation action.
+* @param pvarEndUpAt, [in,out] the end up child of this navigation action.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEndUpAt)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pvarEndUpAt == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ HRESULT ret = E_FAIL;
+ switch (navDir)
+ {
+ case NAVDIR_FIRSTCHILD:
+ ret = GetFirstChild(varStart,pvarEndUpAt);
+ break;
+ case NAVDIR_LASTCHILD:
+ ret = GetLastChild(varStart,pvarEndUpAt);
+ break;
+ case NAVDIR_NEXT:
+ ret = GetNextSibling(varStart,pvarEndUpAt);
+ break;
+ case NAVDIR_PREVIOUS:
+ ret = GetPreSibling(varStart,pvarEndUpAt);
+ break;
+ case NAVDIR_DOWN://do not implement temporarily
+ break;
+ case NAVDIR_UP://do not implement temporarily
+ break;
+ case NAVDIR_LEFT://do not implement temporarily
+ break;
+ case NAVDIR_RIGHT://do not implement temporarily
+ break;
+ default:
+ break;
+ };
+ return ret;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarChild)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pvarChild == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ long x, y, w, h;
+ VARIANT varSelf;
+ VariantInit(&varSelf);
+ varSelf.vt = VT_I4;
+ varSelf.lVal = CHILDID_SELF;
+ accLocation(&x,&y,&w,&h,varSelf);
+ if( (x < xLeft && (x + w) >xLeft) && (y < yTop && (y + h) >yTop) )
+ {
+ int i, nCount;
+ pvarChild->vt = VT_EMPTY;
+ Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface);
+ nCount = pRContext->getAccessibleChildCount();
+ if(nCount > 256)
+ return E_FAIL;
+ IMAccessible* child = NULL;
+ for( i = 0; i<nCount; i++)
+ {
+
+ child = GetChildInterface(i + 1);
+ if(child && child->accHitTest(xLeft,yTop,pvarChild) == S_OK)
+ break;
+ }
+
+ if(pvarChild->vt == VT_DISPATCH)
+ return S_OK;
+
+ if( i < nCount)
+ {
+ pvarChild->vt = VT_DISPATCH;
+ pvarChild->pdispVal = child;
+ child->AddRef();
+ }
+ else
+ {
+ pvarChild->vt = VT_I4;
+ pvarChild->lVal = CHILDID_SELF;
+ }
+ return S_OK;
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Get The other Interface from CMAccessible.
+* @param guidService, must be IID_IAccessible here.
+* @param riid, the IID interface .
+* @return S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::QueryService(REFGUID guidService, REFIID riid, void** ppvObject)
+{
+ if( InlineIsEqualGUID(guidService, IID_IAccessible) )
+ return QueryInterface(riid, ppvObject);
+ return S_FALSE;
+}
+
+/**
+* Set the accessible name of the current COM object self or its one child from UNO.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param szName, the name used to set the name of the proper object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::put_accName(VARIANT varChild, BSTR szName)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if(varChild.vt==VT_I4)
+ {
+ if(varChild.lVal==CHILDID_SELF)
+ {
+ SAFE_SYSFREESTRING(m_pszName);
+ m_pszName=SysAllocString(szName);
+ return S_OK;
+ }
+
+ long lVal = varChild.lVal;
+ varChild.lVal = CHILDID_SELF;
+ IMAccessible *pChild = this->GetChildInterface(lVal);
+ if(!pChild)
+ return E_FAIL;
+ return pChild->put_accName(varChild,szName);
+ }
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set the accessible value of the current COM object self or its one child from UNO.
+* @param varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param szValue, the value used to set the value of the proper object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::put_accValue(VARIANT varChild, BSTR szValue)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if(varChild.vt==VT_I4)
+ {
+ if(varChild.lVal==CHILDID_SELF)
+ {
+ SysAllocString(m_pszValue);
+ m_pszValue=SysAllocString(szValue);
+ return S_OK;
+ }
+
+ long lVal = varChild.lVal;
+ varChild.lVal = CHILDID_SELF;
+ IMAccessible *pChild = this->GetChildInterface(lVal);
+ if(!pChild)
+ return E_FAIL;
+ return pChild->put_accValue(varChild,szValue);
+ }
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set the accessible name of the current COM object self from UNO.
+* @param pszName, the name value used to set the name of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccName(const OLECHAR __RPC_FAR *pszName)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pszName == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ SAFE_SYSFREESTRING(m_pszName);//??
+ m_pszName = SysAllocString(pszName);
+ if(m_pszName==NULL)
+ return E_FAIL;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set the accessible role of the current COM object self from UNO.
+* @param pRole, the role value used to set the role of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccRole(unsigned short pRole)
+{
+ m_iRole = pRole;
+ return S_OK;
+}
+
+/**
+* Add one state into the current state set for the current COM object from UNO.
+* @param pXSate, the state used to set the name of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::DecreaseState(DWORD pXSate)
+{
+ m_dState &= (~pXSate);
+ return S_OK;
+}
+
+/**
+* Delete one state into the current state set for the current COM object from UNO.
+* @param pXSate, the state used to set the name of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::IncreaseState(DWORD pXSate)
+{
+ m_dState |= pXSate;
+ return S_OK;
+}
+
+/**
+* Set state into the current state set for the current COM object from UNO.
+* @param pXSate, the state used to set the name of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::SetState(DWORD pXSate)
+{
+ m_dState = pXSate;
+ return S_OK;
+}
+
+
+
+/**
+* Set the accessible description of the current COM object self from UNO.
+* @param pszDescription, the name used to set the description of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccDescription(const OLECHAR __RPC_FAR *pszDescription)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pszDescription == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ SAFE_SYSFREESTRING(m_pszDescription);
+ m_pszDescription = SysAllocString(pszDescription);
+
+ if(m_pszDescription==NULL)
+ return E_FAIL;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set the accessible value of the current COM object self from UNO.
+* @param pszAccValue, the name used to set the value of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccValue(const OLECHAR __RPC_FAR *pszAccValue)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pszAccValue == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ SAFE_SYSFREESTRING(m_pszValue);
+ m_pszValue = SysAllocString(pszAccValue);
+ if(m_pszValue==NULL)
+ return E_FAIL;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set the HWND value of the current COM object self from UNO. It should set the parent IAccessible
+* Object through the method AccessibleObjectFromWindow(...).
+* @param hwnd, the HWND used to set the value of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccWindowHandle(HWND hwnd)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ m_hwnd = hwnd;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set accessible focus by specifying child ID
+* @param dChildID, the child id identifies the focus child.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccFocus(long dChildID)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+
+ if(dChildID==CHILDID_SELF)
+ {
+ if(m_pIParent)
+ {
+ m_pIParent->Put_XAccFocus(m_dChildID);
+ }
+ }
+ else
+ {
+ m_dFocusChildID = dChildID;
+ //traverse all ancestors to set the focused child ID so that when the get_accFocus is called on
+ //any of the ancestors, this id can be used to get the IAccessible of focused object.
+ if(m_pIParent)
+ {
+ m_pIParent->Put_XAccFocus(dChildID);
+ }
+ }
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+*Set accessible object location for the current COM object
+* @param sLocation, the location of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccLocation(const Location sLocation)
+{
+
+ this->m_sLocation = sLocation;
+ return S_OK;
+}
+
+/**
+* Set accessible parent object for the current COM object if
+* the current object is a child of some COM object
+* @param pIParent, the parent of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccParent(IMAccessible __RPC_FAR *pIParent)
+{
+ this->m_pIParent = pIParent;
+
+ if(pIParent)
+ m_pIParent->AddRef();
+
+ return S_OK;
+}
+
+/**
+* Set unique child id to COM
+* @param dChildID, the id of the current object.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccChildID(long dChildID)
+{
+
+ this->m_dChildID = dChildID;
+ return S_OK;
+}
+
+/**
+* Set AccObjectManagerAgent object pointer to COM
+* @param pAgent, the AccObjectManagerAgent point.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccAgent(long pAgent)
+{
+ g_pAgent = (AccObjectManagerAgent*)pAgent;
+ return S_OK;
+}
+
+/**
+* When a UNO control disposing, it disposes its listeners,
+* then notify AccObject in bridge management, then notify
+* COM that the XAccessible is invalid,so set pUNOInterface as NULL
+* @param isDestroy, true is it need to be destroyed.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::NotifyDestroy(BOOL isDestroy)
+{
+
+ m_isDestroy = isDestroy;
+ pUNOInterface = NULL;
+ return S_OK;
+}
+
+/**
+*private methods that help implement public functions
+*/
+
+/**
+* Return child interface pointer by child ID,note: need to call AddRef()
+* @param lChildID, specify child index,which AT(such as Inspect32) gives.
+* @return IMAccessible*, pointer to the corresponding child object.
+*/
+IMAccessible* CMAccessible::GetChildInterface(long dChildID)//for test
+{
+
+ long dChildIndex = 0;
+ if(dChildID<0)
+ {
+ if(g_pAgent)
+ {
+ IMAccessible* pIMAcc = NULL;
+ g_pAgent->GetIAccessibleFromResID(dChildID,&pIMAcc);
+ return pIMAcc;
+ }
+ return NULL;
+ }
+ else
+ {
+ Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ return NULL;
+
+ if(dChildID<1 || dChildID>pRContext->getAccessibleChildCount())
+ return NULL;
+
+ IAccessible* pChild = NULL;
+ Reference< XAccessible > pXChild = pRContext->getAccessibleChild(dChildID-1);
+ BOOL isGet = get_IAccessibleFromXAccessible((long)pXChild.get(),&pChild);
+
+ if(!isGet)
+ {
+ g_pAgent->InsertAccObj(pXChild.get(),pUNOInterface,(long)m_hwnd);
+ isGet = get_IAccessibleFromXAccessible((long)pXChild.get(),&pChild);
+ }
+
+ if(isGet)
+ {
+ IMAccessible* pIMAcc = (IMAccessible*)pChild;
+ return pIMAcc;
+ }
+ }
+
+ return NULL;
+}
+
+/**
+* For List, tree and table,these roles belong to manage_decendant in UNO,
+* need to process specifically when navigate
+* @return BOOL, if it is decendantmanager, return true.
+*/
+BOOL CMAccessible::IsDecendantManage()
+{
+
+ return (m_iRole==ROLE_SYSTEM_LIST)||(m_iRole==ROLE_SYSTEM_OUTLINE)||(m_iRole==ROLE_SYSTEM_TABLE);
+}
+
+/**
+* for decendantmanager circumstance,provide child interface when navigate
+* @param varCur, the current child.
+* @param flags, the navigation direction.
+* @return IMAccessible*, the child of the end up node.
+*/
+IMAccessible* CMAccessible::GetNavigateChildForDM(VARIANT varCur, short flags)
+{
+
+ XAccessibleContext* pXContext = GetContextByXAcc(pUNOInterface);
+ if(pXContext==NULL)
+ {
+ return NULL;
+ }
+
+ int count = pXContext->getAccessibleChildCount();
+ if(count<1)
+ {
+ return NULL;
+ }
+
+ IMAccessible* pCurChild = NULL;
+ XAccessible* pChildXAcc = NULL;
+ Reference<XAccessible> pRChildXAcc;
+ XAccessibleContext* pChildContext = NULL;
+ int index = 0,delta=0;
+ switch(flags)
+ {
+ case DM_FIRSTCHILD:
+ pRChildXAcc = pXContext->getAccessibleChild(0);
+ break;
+ case DM_LASTCHILD:
+ pRChildXAcc = pXContext->getAccessibleChild(count-1);
+ break;
+ case DM_NEXTCHILD:
+ case DM_PREVCHILD:
+ pCurChild = GetChildInterface(varCur.lVal);
+ if(pCurChild==NULL)
+ {
+ return NULL;
+ }
+ pCurChild->GetUNOInterface((long*)&pChildXAcc);
+ if(pChildXAcc==NULL)
+ {
+ return NULL;
+ }
+ pChildContext = GetContextByXAcc(pChildXAcc);
+ if(pChildContext == NULL)
+ {
+ return NULL;
+ }
+ delta = (flags==DM_NEXTCHILD)?1:-1;
+ //currently, getAccessibleIndexInParent is error in UNO for
+ //some kind of List,such as ValueSet, the index will be less 1 than
+ //what should be, need to fix UNO code
+ index = pChildContext->getAccessibleIndexInParent()+delta;
+ if((index>=0)&&(index<=count-1))
+ {
+ pRChildXAcc = pXContext->getAccessibleChild(index);
+ }
+ break;
+ default:
+ break;
+ }
+
+ if(!pRChildXAcc.is())
+ {
+ return NULL;
+ }
+ pChildXAcc = pRChildXAcc.get();
+ g_pAgent->InsertAccObj(pChildXAcc,pUNOInterface);
+ return g_pAgent->GetIMAccByXAcc(pChildXAcc);
+}
+
+/**
+*the following 4 private methods are for accNavigate implementation
+*/
+
+/**
+* Return first child for parent container, process differently according
+* to whether it is decendant manage
+* @param varStart, the start child id of this navigation action.
+* @param pvarEndUpAt, [in,out] the end up child of this navigation action.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+HRESULT CMAccessible::GetFirstChild(VARIANT varStart,VARIANT* pvarEndUpAt)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pvarEndUpAt == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ if(varStart.vt != VT_I4)
+ {
+ pvarEndUpAt->vt = VT_EMPTY;
+ return E_INVALIDARG;
+ }
+
+ pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, DM_FIRSTCHILD);
+ if(pvarEndUpAt->pdispVal)
+ {
+ pvarEndUpAt->pdispVal->AddRef();
+ pvarEndUpAt->vt = VT_DISPATCH;
+ return S_OK;
+ }
+
+ pvarEndUpAt->vt = VT_EMPTY;
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Return last child for parent container, process differently according
+* to whether it is decendant manage
+* @param varStart, the start child id of this navigation action.
+* @param pvarEndUpAt, [in,out] the end up child of this navigation action.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+HRESULT CMAccessible::GetLastChild(VARIANT varStart,VARIANT* pvarEndUpAt)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pvarEndUpAt == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ if(varStart.vt != VT_I4)
+ {
+ pvarEndUpAt->vt = VT_EMPTY;
+ return E_INVALIDARG;
+ }
+
+ pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, DM_LASTCHILD);
+ if(pvarEndUpAt->pdispVal)
+ {
+ pvarEndUpAt->pdispVal->AddRef();
+ pvarEndUpAt->vt = VT_DISPATCH;
+ return S_OK;
+ }
+ pvarEndUpAt->vt = VT_EMPTY;
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* The method GetNextSibling is general, whatever it is decendant manage or not
+* Get the next sibling object.
+* @param varStart, the start child id of this navigation action.
+* @param pvarEndUpAt, [in,out] the end up child of this navigation action.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+HRESULT CMAccessible::GetNextSibling(VARIANT varStart,VARIANT* pvarEndUpAt)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if(varStart.vt != VT_I4)
+ {
+ pvarEndUpAt->vt = VT_EMPTY;
+ return E_INVALIDARG;
+ }
+
+ Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface);
+ if(pRContext.is())
+ {
+ varStart.iVal = sal_Int16(pRContext->getAccessibleIndexInParent() + 2);
+ if(m_pIParent)
+ if( m_pIParent->get_accChild(varStart,&pvarEndUpAt->pdispVal) == S_OK)
+ {
+ pvarEndUpAt->vt = VT_DISPATCH;
+ return S_OK;
+ }
+ }
+ pvarEndUpAt->vt = VT_EMPTY;
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+*the method GetPreSibling is general, whatever it is decendant manage or not
+* @param varStart, the start child id of this navigation action.
+* @param pvarEndUpAt, [in,out] the end up child of this navigation action.
+* @return S_OK if successful and E_FAIL if failure.
+*/
+HRESULT CMAccessible::GetPreSibling(VARIANT varStart,VARIANT* pvarEndUpAt)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pvarEndUpAt == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ if(varStart.vt != VT_I4)
+ {
+ pvarEndUpAt->vt = VT_EMPTY;
+ return E_INVALIDARG;
+ }
+
+ Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface);
+ if(pRContext.is())
+ {
+ varStart.iVal = sal_Int16(pRContext->getAccessibleIndexInParent());
+ if(m_pIParent && varStart.iVal > 0)
+ if( m_pIParent->get_accChild(varStart,&pvarEndUpAt->pdispVal) == S_OK)
+ {
+ pvarEndUpAt->vt = VT_DISPATCH;
+ return S_OK;
+ }
+ }
+ pvarEndUpAt->vt = VT_EMPTY;
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* For IAccessible2 implementation methods
+*/
+STDMETHODIMP CMAccessible::get_nRelations( long __RPC_FAR *nRelations)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(nRelations == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ *nRelations = 0;
+
+ if( !pRContext.is() )
+ return E_FAIL;
+ Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet();
+ if(!pRrelationSet.is())
+ {
+ *nRelations = 0;
+ return S_OK;
+ }
+
+ *nRelations = pRrelationSet->getRelationCount();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible::get_relation( long relationIndex, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(relation == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ if( !pRContext.is() )
+ return E_FAIL;
+
+
+ long nMax = 0;
+ long nReal = 0;
+ get_nRelations(&nMax);
+
+ *relation = (IAccessibleRelation*)::CoTaskMemAlloc(sizeof(IAccessibleRelation));
+
+ // #CHECK Memory Allocation#
+ if(*relation == NULL)
+ {
+ return E_FAIL;
+ }
+
+ if( relationIndex < nMax )
+ {
+
+
+ Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet();
+ if(!pRrelationSet.is())
+ {
+
+ return E_FAIL;
+ }
+
+ IAccessibleRelation* pRelation = NULL;
+ ActivateActContext();
+ HRESULT hr = CoCreateInstance( CLSID_AccRelation, NULL, CLSCTX_SERVER ,
+ IID_IAccessibleRelation,
+ (void **)&pRelation);
+ DeactivateActContext();
+ if(SUCCEEDED(hr))
+ {
+ IUNOXWrapper* wrapper = NULL;
+ hr = pRelation->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper);
+ if(SUCCEEDED(hr))
+ {
+ AccessibleRelation accRelation = pRrelationSet->getRelation(relationIndex);
+ wrapper->put_XSubInterface((long)&accRelation);
+ wrapper->Release();
+ *relation = pRelation;
+ return S_OK;
+ }
+
+ }
+ }
+
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible::get_relations( long, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation, long __RPC_FAR *nRelations)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(relation == NULL || nRelations == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ // #CHECK XInterface#
+
+ if( !pRContext.is() )
+ return E_FAIL;
+
+ Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet();
+ if(!pRrelationSet.is())
+ {
+ *nRelations = 0;
+ return S_OK;
+ }
+
+ long nCount = pRrelationSet->getRelationCount();
+
+ *relation = (IAccessibleRelation*)::CoTaskMemAlloc(nCount*sizeof(IAccessibleRelation));
+
+ // #CHECK Memory Allocation#
+ if(*relation == NULL)
+ {
+ return E_FAIL;
+ }
+
+ for(int i=0; i<nCount ; i++)
+ {
+ IAccessibleRelation* pRelation = NULL;
+ ActivateActContext();
+ HRESULT hr = CoCreateInstance( CLSID_AccRelation, NULL, CLSCTX_SERVER ,
+ IID_IAccessibleRelation,
+ (void **)&pRelation);
+ DeactivateActContext();
+ if(SUCCEEDED(hr))
+ {
+ IUNOXWrapper* wrapper = NULL;
+ hr = pRelation->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper);
+ if(SUCCEEDED(hr))
+ {
+ AccessibleRelation accRelation = pRrelationSet->getRelation(i);
+ wrapper->put_XSubInterface((long)&accRelation);
+ wrapper->Release();
+ }
+ (relation)[i] = pRelation;
+ }
+ }
+
+ *nRelations = nCount;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible::role(long __RPC_FAR *role)
+{
+ ENTER_PROTECTED_BLOCK
+
+ (*role) = m_iRole;
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+
+STDMETHODIMP CMAccessible:: get_nActions(long __RPC_FAR *nActions)
+{
+
+ try
+ {
+ ISDESTROY()
+ // #CHECK#
+ if(nActions == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ *nActions = 0L;
+ IAccessibleAction* pAcc = NULL;
+ HRESULT hr = QueryInterface(IID_IAccessibleAction, (void**)&pAcc);
+ if( hr == S_OK )
+ {
+ pAcc->nActions(nActions);
+ pAcc->Release();
+ }
+
+ return S_OK;
+ }
+ catch(...)
+ {
+ *nActions = 0L;
+ return S_OK;
+ }
+}
+
+
+STDMETHODIMP CMAccessible:: scrollToPoint(enum IA2CoordinateType, long, long)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ return E_NOTIMPL;
+ LEAVE_PROTECTED_BLOCK
+
+}
+STDMETHODIMP CMAccessible:: scrollTo(enum IA2ScrollType)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+
+ return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+static XAccessible* getTheParentOfMember(XAccessible* pXAcc)
+{
+ // #CHECK#
+ if(pXAcc == NULL)
+ {
+ return NULL;
+ }
+ Reference<XAccessibleContext> pRContext = pXAcc->getAccessibleContext();
+ Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet();
+ long nRelations = pRrelationSet->getRelationCount();
+ for(int i=0 ; i<nRelations ; i++)
+ {
+ AccessibleRelation accRelation = pRrelationSet->getRelation(i);
+ if(accRelation.RelationType == 7)
+ {
+ Sequence< Reference< XInterface > > xTargets = accRelation.TargetSet;
+ return (XAccessible*)xTargets[0].get();
+ }
+ }
+ return NULL;
+}
+
+STDMETHODIMP CMAccessible:: get_groupPosition(long __RPC_FAR *groupLevel,long __RPC_FAR *similarItemsInGroup,long __RPC_FAR *positionInGroup)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(groupLevel == NULL || similarItemsInGroup == NULL || positionInGroup == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if(!pRContext.is())
+ return E_FAIL;
+ long Role = pRContext->getAccessibleRole();
+
+ *groupLevel = 0;
+ *similarItemsInGroup = 0;
+ *positionInGroup = 0;
+
+ if (Role != AccessibleRole::DOCUMENT)
+ {
+ Reference< XAccessibleGroupPosition > xGroupPosition( pRContext, UNO_QUERY );
+ if ( xGroupPosition.is() )
+ {
+ Sequence< sal_Int32 > rSeq = xGroupPosition->getGroupPosition( makeAny( pRContext ) );
+ sal_Int32* pSeq = rSeq.getArray();
+ if ( pSeq )
+ {
+ *groupLevel = pSeq[0];
+ *similarItemsInGroup = pSeq[1];
+ *positionInGroup = pSeq[2];
+ return S_OK;
+ }
+ return S_OK;
+ }
+ }
+
+ Reference< XAccessible> pParentAcc = pRContext->getAccessibleParent();
+ if( !pParentAcc.is() )
+ {
+ return S_OK;
+ }
+
+ Reference<XAccessibleContext> pRParentContext = pParentAcc->getAccessibleContext();
+
+ int level = 0;
+ int index = 0;
+ int number = 0;
+
+ if( Role == RADIO_BUTTON )
+ {
+ Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet();
+ long nRel = pRrelationSet->getRelationCount();
+ for(int i=0 ; i<nRel ; i++)
+ {
+ AccessibleRelation accRelation = pRrelationSet->getRelation(i);
+ if(accRelation.RelationType == 7)
+ {
+ Sequence< Reference< XInterface > > xTargets = accRelation.TargetSet;
+ int nCount = xTargets.getLength();
+
+ Reference<XInterface> pRAcc = xTargets[0];
+ for(int j=0; j<pRParentContext->getAccessibleChildCount(); j++)
+ {
+ if( getTheParentOfMember(pRParentContext->getAccessibleChild(j).get())
+ == (XAccessible*)pRAcc.get() &&
+ pRParentContext->getAccessibleChild(j)->getAccessibleContext()->getAccessibleRole() == RADIO_BUTTON)
+ number++;
+ if(pRParentContext->getAccessibleChild(j).get() == pUNOInterface)
+ index = number;
+ }
+ }
+ }
+ *groupLevel = 1;
+ *similarItemsInGroup = number;
+ *positionInGroup = index;
+ return S_OK;
+ }
+
+ else if ( COMBO_BOX == Role )
+ {
+ *groupLevel = 1;
+ *similarItemsInGroup = 0;
+ *positionInGroup = -1;
+
+ long nCount = pRContext->getAccessibleChildCount();
+ if( 2 != nCount)
+ {
+ return S_OK;
+ }
+ Reference<XAccessible> xList=pRContext->getAccessibleChild(1);
+ if (!xList.is())
+ {
+ return S_OK;
+ }
+ Reference<XAccessibleContext> xListContext(xList,UNO_QUERY);
+ if (!xListContext.is())
+ {
+ return S_OK;
+ }
+ Reference<XAccessibleSelection> xListSel(xList,UNO_QUERY);
+ if (!xListSel.is())
+ {
+ return S_OK;
+ }
+ *similarItemsInGroup = xListContext->getAccessibleChildCount();
+ if (*similarItemsInGroup > 0 )
+ {
+ try
+ {
+ Reference<XAccessible> xChild = xListSel->getSelectedAccessibleChild(0);
+ if (xChild.is())
+ {
+ Reference<XAccessibleContext> xChildContext(xChild,UNO_QUERY);
+ if (xChildContext.is())
+ {
+ *positionInGroup=xChildContext->getAccessibleIndexInParent() + 1 ;
+ return S_OK;
+ }
+ }
+ }
+ catch(...)
+ {}
+ }
+ return S_OK;
+ }
+ else if ( PAGE_TAB == Role )
+ {
+ *groupLevel = 1;
+ *similarItemsInGroup = pRParentContext->getAccessibleChildCount();
+
+ if (*similarItemsInGroup > 0 )
+ {
+ *positionInGroup=pRContext->getAccessibleIndexInParent() + 1 ;
+ }
+ else
+ {
+ *positionInGroup = -1;
+ }
+ return S_OK;
+ }
+
+
+ BOOL isFound = FALSE;
+ while( pParentAcc.is() && !isFound)
+ {
+ level++;
+ pRParentContext = pParentAcc->getAccessibleContext();
+ Role = pRParentContext->getAccessibleRole();
+ if( (Role == TREE) || (Role == LIST) )
+ isFound = TRUE;
+ pParentAcc = pRParentContext->getAccessibleParent();
+ }
+
+ if( isFound )
+ {
+ Reference< XAccessible> pTempAcc = pRContext->getAccessibleParent();
+ pRParentContext = pTempAcc->getAccessibleContext();
+ *groupLevel = level;
+ *similarItemsInGroup = pRParentContext->getAccessibleChildCount();
+ *positionInGroup = pRContext->getAccessibleIndexInParent() + 1;
+ }
+ else
+ {
+ *groupLevel = 0;
+ *similarItemsInGroup = 0;
+ *positionInGroup = 0;
+ }
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible:: get_extendedStates( long, BSTR __RPC_FAR *__RPC_FAR *, long __RPC_FAR *)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+
+ return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+
+STDMETHODIMP CMAccessible:: get_uniqueID(long __RPC_FAR *uniqueID)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(uniqueID == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ *uniqueID = m_dChildID;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible:: get_windowHandle(HWND __RPC_FAR *windowHandle)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(windowHandle == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ HWND nHwnd = m_hwnd;
+ IAccessible* pParent = m_pIParent;
+ CMAccessible* pChild = this;
+ while((nHwnd==0) && pParent)
+ {
+ pChild = (CMAccessible*)pParent;
+ if(pChild)
+ {
+ pParent = (IAccessible*)pChild->m_pIParent;
+ nHwnd = (HWND)pChild->m_hwnd;
+ }
+ else
+ pParent = NULL;
+ }
+
+ *windowHandle = nHwnd;
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Get XAccessibleContext directly from UNO by the stored XAccessible pointer
+* @param pXAcc, UNO XAccessible object point.
+* @return XAccessibleContext*, the context of the pXAcc.
+*/
+XAccessibleContext* CMAccessible::GetContextByXAcc( XAccessible* pXAcc )
+{
+ Reference< XAccessibleContext > pRContext;
+ if( pXAcc == NULL)
+ return NULL;
+
+ pRContext = pXAcc->getAccessibleContext();
+ if( !pRContext.is() )
+ return NULL;
+ return pRContext.get();
+}
+
+/**
+* Return the member variable m_pXAccessibleSelection, instead of
+* get XAccessibleSelection according to XAccessibleContext because if so,it will
+* depend on the UNO implementation code,so when COM is created, put XAccessibleSelection
+* by bridge management system
+* @return XAccessibleSelection*, the selection of the current object.
+*/
+Reference< XAccessibleSelection > CMAccessible::GetSelection()
+{
+ if( pUNOInterface == NULL )
+ return NULL;
+ Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext();
+ if(pRContext.is())
+ {
+ Reference< XAccessibleSelection > pRSelection(pRContext,UNO_QUERY);
+ return pRSelection;
+ }
+ return NULL;
+}
+
+/**
+* Select one XAccessible item, for accSelect implementation
+* @param pItem, the item should be selected.
+* @return S_OK if successful.
+*/
+HRESULT CMAccessible::SelectChild(XAccessible* pItem)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ XAccessibleContext* pParentContext = GetContextByXAcc( pUNOInterface );
+ XAccessibleContext* pContext = GetContextByXAcc( pItem );
+ if( pParentContext == NULL || pContext == NULL )
+ return E_FAIL;
+
+ Reference< XAccessibleSelection > pRSelection = GetSelection();
+ if( !pRSelection.is() )
+ return E_FAIL;
+ long Index = pContext->getAccessibleIndexInParent();
+ pRSelection->selectAccessibleChild( Index );
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Deselect one XAccessible item, for accSelect implimentation
+* @param pItem, the item should be deselected.
+* @return S_OK if successful.
+*/
+HRESULT CMAccessible::DeSelectChild(XAccessible* pItem)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ XAccessibleContext* pParentContext = GetContextByXAcc( pUNOInterface );
+ ;
+ XAccessibleContext* pContext = GetContextByXAcc( pItem );
+ if( pParentContext == NULL || pContext == NULL )
+ return E_INVALIDARG;
+
+ Reference< XAccessibleSelection > pRSelection = GetSelection();
+ if( !pRSelection.is() )
+ return E_FAIL;
+ long Index = pContext->getAccessibleIndexInParent();
+ pRSelection->deselectAccessibleChild( Index );
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Select multiple XAccessible items,for implementation of accSelect
+* @param pItem, the items should be selected.
+* @param size, the size of the items.
+* @return S_OK if successful.
+*/
+HRESULT CMAccessible::SelectMutipleChidren( XAccessible** pItem,int size )
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pItem == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ for(int index = 0;index < size;index++)
+ {
+ SelectChild( pItem[index] );
+ }
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Deselect multiple XAccessible items,for implementation of accSelect
+* @param pItem, the items should be selected.
+* @param size, the size of the items.
+* @return S_OK if successful.
+*/
+HRESULT CMAccessible::DeSelectMutipleChildren( XAccessible** pItem,int size )
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pItem == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ for(int index = 0;index < size;index++)
+ {
+ DeSelectChild( pItem[index] );
+ }
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* When COM is created, UNO set XAccessible pointer to it
+* in order to COM can operate UNO information
+* @param pXAcc, the XAccessible object of current object.
+* @return S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::SetXAccessible(long pXAcc)
+{
+ pUNOInterface = (XAccessible*)pXAcc;
+ pRef = pUNOInterface;
+ m_pEnumVar->PutSelection(/*XAccessibleSelection*/(long)pUNOInterface);
+
+ pRContext = pUNOInterface->getAccessibleContext();
+ pRContextInterface = (XAccessibleContext*)pRContext.is();
+
+ return S_OK;
+}
+
+/**
+* accSelect method has many optional flags, needs to process comprehensively
+* Mozilla and Microsoft do not implement SELFLAG_EXTENDSELECTION flag.
+* The implementation of this flag is a little trouble-shooting,so we also
+* do not implement it now
+* @param flagsSelect, the selection flag of the select action.
+* @param varChild, the child object pointer of current action.
+* @return S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::accSelect(long flagsSelect, VARIANT varChild)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if( (flagsSelect&SELFLAG_ADDSELECTION) &&
+ (SELFLAG_REMOVESELECTION&flagsSelect) )
+ return E_INVALIDARG;
+
+ if ( (flagsSelect&SELFLAG_TAKESELECTION) &&
+ (
+ (flagsSelect&SELFLAG_ADDSELECTION) ||
+ (flagsSelect&SELFLAG_REMOVESELECTION) ||
+ (flagsSelect&SELFLAG_EXTENDSELECTION )
+ )
+ )
+ return E_INVALIDARG;
+
+ if ( varChild.vt != VT_I4 )
+ return E_INVALIDARG;
+
+ IMAccessible* pSelectAcc;
+ if( varChild.lVal == CHILDID_SELF )
+ {
+ pSelectAcc = this;
+ pSelectAcc->AddRef();
+ }
+ else
+ {
+ pSelectAcc = GetChildInterface(varChild.lVal);
+ }
+
+ if( pSelectAcc == NULL )
+ return E_INVALIDARG;
+
+ if( flagsSelect&SELFLAG_TAKEFOCUS )
+ {
+ long pTempUNO = 0;
+ pSelectAcc->GetUNOInterface( &pTempUNO);
+
+ if( pTempUNO == NULL )
+ return NULL;
+
+ Reference< XAccessibleContext > pRContext = ( (XAccessible*)pTempUNO)->getAccessibleContext();
+ Reference< XAccessibleComponent > pRComponent(pRContext,UNO_QUERY);
+ Reference< XAccessible > pRParentXAcc = pRContext->getAccessibleParent();
+ Reference< XAccessibleContext > pRParentContext = pRParentXAcc->getAccessibleContext();
+ Reference< XAccessibleComponent > pRParentComponent(pRParentContext,UNO_QUERY);
+ Reference< XAccessibleSelection > pRParentSelection(pRParentContext,UNO_QUERY);
+
+
+ pRComponent->grabFocus();
+
+ if( flagsSelect & SELFLAG_TAKESELECTION )
+ {
+ pRParentSelection->clearAccessibleSelection();
+ pRParentSelection->selectAccessibleChild( pRContext->getAccessibleIndexInParent() );
+ }
+
+ if( flagsSelect & SELFLAG_ADDSELECTION )
+ {
+ pRParentSelection->selectAccessibleChild( pRContext->getAccessibleIndexInParent() );
+ }
+
+ if( flagsSelect & SELFLAG_REMOVESELECTION )
+ {
+ pRParentSelection->deselectAccessibleChild( pRContext->getAccessibleIndexInParent() );
+ }
+
+ if( flagsSelect & SELFLAG_EXTENDSELECTION )
+ {
+ long indexInParrent = pRContext->getAccessibleIndexInParent();
+
+ if( pRParentSelection->isAccessibleChildSelected( indexInParrent + 1 ) ||
+ pRParentSelection->isAccessibleChildSelected( indexInParrent - 1 ) )
+ {
+ pRParentSelection->selectAccessibleChild( indexInParrent );
+ }
+ }
+
+ }
+
+ pSelectAcc->Release();
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Return XAccessible interface pointer when needed
+* @param pXAcc, [in, out] the Uno interface of the current object.
+* @return S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::GetUNOInterface(long* pXAcc)
+{
+ // #CHECK#
+ if(pXAcc == NULL)
+ return E_INVALIDARG;
+
+ *pXAcc = (long)pUNOInterface;
+ return S_OK;
+}
+
+/**
+* Helper method for Implementation of get_accDefaultAction
+* @param pAction, the default action point of the current object.
+* @return S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::SetDefaultAction(long pAction)
+{
+ m_pXAction = (XAccessibleAction*)pAction;
+ return S_OK;
+}
+
+/**
+* This method is called when AT open some UI elements initially
+* the UI element takes the default action defined here
+* @param varChild, the child id of the defaultaction.
+* @param pszDefaultAction,[in/out] the description of the current action.
+* @return S_OK if successful.
+*/
+HRESULT STDMETHODCALLTYPE CMAccessible::get_accDefaultAction(VARIANT varChild, BSTR *pszDefaultAction)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(pszDefaultAction == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ if(varChild.vt==VT_I4)
+ {
+ if(varChild.lVal==CHILDID_SELF)
+ {
+ if( m_pXAction == NULL )
+ return DISP_E_MEMBERNOTFOUND;
+ SAFE_SYSFREESTRING(*pszDefaultAction);
+ *pszDefaultAction = SysAllocString(m_pszActionDescription);
+ return S_OK;
+ }
+
+ long lVal = varChild.lVal;
+ varChild.lVal = CHILDID_SELF;
+ IMAccessible *pChild = this->GetChildInterface(lVal);
+ if(!pChild)
+ return E_FAIL;
+ return pChild->get_accDefaultAction(varChild,pszDefaultAction);
+ }
+ return S_FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* AT call this method to operate application
+* @param varChild, the child id of the action object.
+* @return S_OK if successful.
+*/
+HRESULT STDMETHODCALLTYPE CMAccessible::accDoDefaultAction(VARIANT varChild)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if( varChild.vt != VT_I4 )
+ return E_INVALIDARG;
+ if( m_pXAction == NULL )
+ return E_FAIL;
+ if( m_pXAction->getAccessibleActionCount() == 0 )
+ return E_FAIL;
+
+ if(varChild.lVal==CHILDID_SELF)
+ {
+ if(m_pXAction->getAccessibleActionCount() > 0)
+ m_pXAction->doAccessibleAction(0);
+ return S_OK;
+ }
+
+ long lVal = varChild.lVal;
+ varChild.lVal = CHILDID_SELF;
+ IMAccessible *pChild = this->GetChildInterface(lVal);
+ if(!pChild)
+ return E_FAIL;
+ return pChild->accDoDefaultAction( varChild );
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* UNO set description information for action to COM.
+* @param szAction, the action description of the current object.
+* @return S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::Put_ActionDescription( const OLECHAR* szAction)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(szAction == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ SAFE_SYSFREESTRING(m_pszActionDescription );
+ m_pszActionDescription = SysAllocString( szAction );
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+BOOL CMAccessible::GetXInterfaceFromXAccessible(XAccessible* pXAcc, XInterface** ppXI, int index)
+{
+ Reference< XAccessibleContext > pRContext;
+
+ switch(index)
+ {
+ case XI_COMPONENT:
+ QUERYXINTERFACE(AccessibleComponent)
+ break;
+ case XI_TEXT:
+ QUERYXINTERFACE(AccessibleText)
+ break;
+ case XI_EDITABLETEXT:
+ QUERYXINTERFACE(AccessibleEditableText)
+ break;
+ case XI_TABLE:
+ QUERYXINTERFACE(AccessibleTable)
+ break;
+ case XI_SELECTION:
+ QUERYXINTERFACE(AccessibleSelection)
+ break;
+ case XI_EXTENDEDCOMP:
+ QUERYXINTERFACE(AccessibleExtendedComponent)
+ break;
+ case XI_KEYBINDING:
+ QUERYXINTERFACE(AccessibleKeyBinding)
+ break;
+ case XI_ACTION:
+ QUERYXINTERFACE(AccessibleAction)
+ break;
+ case XI_VALUE:
+ QUERYXINTERFACE(AccessibleValue)
+ break;
+ case XI_HYPERTEXT:
+ QUERYXINTERFACE(AccessibleHypertext)
+ break;
+ case XI_HYPERLINK:
+ QUERYXINTERFACE(AccessibleHyperlink)
+ break;
+ case XI_IMAGE:
+ QUERYXINTERFACE(AccessibleImage)
+ break;
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+HRESULT WINAPI CMAccessible::SmartQI(void* pv, REFIID iid, void** ppvObject)
+{
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if( ImplIsEqualGUID(iid,IID_IAccIdentity) ||
+ ImplIsEqualGUID(iid,IID_IStdMarshalInfo) ||
+ ImplIsEqualGUID(iid,IID_IMarshal) ||
+ ImplIsEqualGUID(iid,IID_IExternalConnection)||
+ ImplIsEqualGUID(iid,IID_IOleWindow))
+ return E_FAIL;
+
+
+ _UNO_AGGMAP_ENTRY* pMap = _GetAggEntries();
+ while(pMap && pMap->piid)
+ {
+ if(ImplIsEqualGUID(iid, *pMap->piid))
+ {
+ XInterface* pXI = NULL;
+ BOOL bFound = GetXInterfaceFromXAccessible(pUNOInterface,&pXI,pMap->XIFIndex);
+ if(!bFound)
+ {
+ return E_FAIL;
+ }
+
+ XGUIDToComObjHash::iterator pIndTemp = m_containedObjects.find( iid );
+ if ( pIndTemp != m_containedObjects.end() )
+ {
+ return pIndTemp->second.p->QueryInterface( iid, ppvObject );
+ }
+ else
+ {
+ ActivateActContext();
+ HRESULT hr = pMap->pfnCreateInstance(pv, iid, ppvObject);
+ DeactivateActContext();
+ if(hr == S_OK)
+ {
+ m_containedObjects.insert(XGUIDToComObjHash::value_type(*pMap->piid,(IUnknown*)*ppvObject));
+ IUNOXWrapper* wrapper = NULL;
+ ((IUnknown*)*ppvObject)->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper);
+ if(wrapper)
+ {
+ wrapper->put_XInterface((long)pUNOInterface);
+ wrapper->Release();
+ }
+ return S_OK;
+ }
+ }
+ return E_FAIL;
+ }
+ pMap++;
+ }
+ return E_FAIL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+BOOL CMAccessible::get_IAccessibleFromXAccessible(long pXAcc, IAccessible **ppIA)
+{
+
+ ENTER_PROTECTED_BLOCK
+
+ // #CHECK#
+ if(ppIA == NULL)
+ {
+ return E_INVALIDARG;
+ }
+ BOOL isGet = FALSE;
+ if(g_pAgent)
+ isGet = g_pAgent->GetIAccessibleFromXAccessible((XAccessible*)pXAcc,ppIA);
+
+ if(isGet)
+ return TRUE;
+ else
+ return FALSE;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+void CMAccessible::get_OLECHARFromAny(Any& pAny, OLECHAR* pChar)
+{
+ // #CHECK#
+ if(pChar == NULL)
+ return;
+
+ switch(pAny.getValueTypeClass())
+ {
+ case TypeClass_CHAR:
+ {
+ sal_Int8 val;
+ pAny >>= val;
+ swprintf( pChar, L"%d", val);
+ break;
+ }
+ case TypeClass_BOOLEAN:
+ {
+ sal_Bool val;
+ pAny >>= val;
+ swprintf( pChar, L"%d", val);
+ break;
+ }
+ case TypeClass_BYTE:
+ {
+ sal_Int8 val;
+ pAny >>= val;
+ swprintf( pChar, L"%d", val);
+ break;
+ }
+ case TypeClass_SHORT:
+ {
+ SHORT val;
+ pAny >>= val;
+ swprintf( pChar, L"%d", val);
+ break;
+ }
+ case TypeClass_UNSIGNED_SHORT:
+ {
+ USHORT val;
+ pAny >>= val;
+ swprintf( pChar, L"%d", val);
+ break;
+ }
+ case TypeClass_LONG:
+ {
+ LONG val;
+ pAny >>= val;
+ swprintf( pChar, L"%ld", val);
+ break;
+ }
+ case TypeClass_UNSIGNED_LONG:
+ {
+ ULONG val;
+ pAny >>= val;
+ swprintf( pChar, L"%ld", val);
+ break;
+ }
+ case TypeClass_FLOAT:
+ {
+ FLOAT val;
+ pAny >>= val;
+ swprintf( pChar, L"%.3f", val);
+ break;
+ }
+ case TypeClass_DOUBLE:
+ {
+ DOUBLE val;
+ pAny >>= val;
+ swprintf( pChar, L"%.6lf", val);
+ break;
+ }
+ case TypeClass_STRING:
+ {
+ ::rtl::OUString val;
+ pAny >>= val;
+ wcscpy(pChar, val.getStr());
+ break;
+ }
+ case TypeClass_SEQUENCE:
+ {
+ if(pAny.getValueType() == getCppuType( (Sequence< ::rtl::OUString > *)0 ) )
+ {
+ Sequence < ::rtl::OUString > val;
+ pAny >>= val;
+
+ ::rtl::OUString pString;
+
+ int count = val.getLength();
+
+ for( int iIndex = 0;iIndex < count;iIndex++ )
+ {
+ pString += val[iIndex];
+ }
+ wcscpy(pChar, pString.getStr());
+ }
+ else if (pAny.getValueType() == getCppuType( (Sequence< ::com::sun::star::style::TabStop >* )0 ) )
+ {
+ Sequence < ::com::sun::star::style::TabStop > val;
+ pAny >>= val;
+ int count = val.getLength();
+
+ for( int iIndex = 0;iIndex < count;iIndex++ )
+ {
+ OLECHAR pAttrs[512] = {NULL};
+
+ OLECHAR pAttrsPosition[512] = {NULL};
+ OLECHAR pAttrsDescimalChar[512] = {NULL};
+ OLECHAR pAttrsFillChar[512] = {NULL};
+
+ ::com::sun::star::style::TabStop sigleVal = val[iIndex];
+
+ swprintf( pAttrsPosition, L"Position=%ld,TabAlign=%ld",
+ sigleVal.Position, sigleVal.Alignment);
+
+ if(sigleVal.DecimalChar==';' || sigleVal.DecimalChar == ':' || sigleVal.DecimalChar == ',' ||
+ sigleVal.DecimalChar == '=' || sigleVal.DecimalChar == '\\')
+ swprintf( pAttrsDescimalChar, L"DecimalChar=\\%c",sigleVal.DecimalChar);
+ else
+ swprintf( pAttrsDescimalChar, L"DecimalChar=%c",sigleVal.DecimalChar);
+
+ if(sigleVal.FillChar==';' || sigleVal.FillChar == ':' || sigleVal.FillChar == ',' ||
+ sigleVal.FillChar == '=' || sigleVal.FillChar == '\\')
+ swprintf( pAttrsFillChar, L"FillChar=\\%c",sigleVal.FillChar);
+ else
+ swprintf( pAttrsFillChar, L"FillChar=%c",sigleVal.FillChar);
+
+ swprintf( pAttrs, L"%s,%s,%s,",pAttrsPosition,pAttrsDescimalChar,pAttrsFillChar);
+
+ wcscat(pChar,pAttrs);
+ }
+ }
+ break;
+ }
+ case TypeClass_ENUM:
+ {
+ if (pAny.getValueType() == getCppuType( (::com::sun::star::awt::FontSlant* )0 ) )
+ {
+ com::sun::star::awt::FontSlant val;
+ pAny >>= val;
+ swprintf( pChar, L"%d", val);
+ }
+ }
+ case TypeClass_STRUCT:
+ {
+ if (pAny.getValueType() == getCppuType( (::com::sun::star::style::LineSpacing* )0 ) )
+ {
+ com::sun::star::style::LineSpacing val;
+ pAny >>= val;
+ swprintf( pChar, L"Mode=%ld,Height=%ld,", val.Mode, val.Height);
+ }
+ else if (pAny.getValueType() == getCppuType( (com::sun::star::accessibility::TextSegment *)0 ) )
+ {
+ com::sun::star::accessibility::TextSegment val;
+ pAny >>= val;
+ ::rtl::OUString realVal(val.SegmentText);
+ wcscpy(pChar, realVal.getStr());
+ }
+ break;
+ }
+ case TypeClass_VOID:
+ case TypeClass_HYPER:
+ case TypeClass_UNSIGNED_HYPER:
+ case TypeClass_TYPE:
+ case TypeClass_ANY:
+ case TypeClass_TYPEDEF:
+ case TypeClass_UNION:
+ case TypeClass_EXCEPTION:
+ case TypeClass_ARRAY:
+ case TypeClass_INTERFACE:
+ case TypeClass_SERVICE:
+ case TypeClass_MODULE:
+ case TypeClass_INTERFACE_METHOD:
+ case TypeClass_INTERFACE_ATTRIBUTE:
+ case TypeClass_UNKNOWN:
+ case TypeClass_PROPERTY:
+ case TypeClass_CONSTANT:
+ case TypeClass_CONSTANTS:
+ case TypeClass_SINGLETON:
+ case TypeClass_MAKE_FIXED_SIZE:
+ break;
+ default:
+ break;
+ }
+}
+
+void CMAccessible::get_OLECHAR4Numbering(const Any& pAny, short numberingLevel,const OUString& numberingPrefix,OLECHAR* pChar)
+{
+ if(pChar == NULL)
+ return;
+ Reference< ::com::sun::star::container::XIndexReplace > pXIndex;
+ if((pAny>>=pXIndex) && (numberingLevel !=-1))//numbering level is -1,means invalid value
+ {
+ Any aAny = pXIndex->getByIndex(numberingLevel);
+ Sequence< ::com::sun::star::beans::PropertyValue > aProps;
+ aAny >>= aProps;
+ const ::com::sun::star::beans::PropertyValue* pPropArray = aProps.getConstArray();
+ sal_Int32 nCount = aProps.getLength();
+ swprintf(pChar,L"Numbering:NumberingLevel=%d,",numberingLevel);
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ ::com::sun::star::beans::PropertyValue rProp = pPropArray[i];
+ if( (rProp.Name.compareTo(OUString::createFromAscii("BulletChar"))==0)||
+ (rProp.Name.compareTo(OUString::createFromAscii("GraphicURL"))==0)||
+ (rProp.Name.compareTo(OUString::createFromAscii("NumberingType"))==0))
+ {
+ OLECHAR propStr[512] = {NULL};
+ swprintf(propStr,L"%s=",rProp.Name.getStr());
+ OLECHAR pTemp[256] = {NULL};
+ CMAccessible::get_OLECHARFromAny(rProp.Value,pTemp);
+ if(rProp.Name.compareTo(OUString::createFromAscii("GraphicURL"))==0)
+ {
+ OLECHAR* pOccur = wcschr(pTemp,':');
+ if(pOccur)
+ *pOccur = '.';
+ }
+ wcscat(propStr,pTemp);
+ wcscat(pChar,propStr);
+ wcscat(pChar,L",");
+
+ if(rProp.Name.compareTo(OUString::createFromAscii("NumberingType"))==0)
+ {
+ if(numberingPrefix.getLength()!=0)
+ {
+ swprintf(pTemp,L"NumberingPrefix=%s,",numberingPrefix.getStr());
+ wcscat(pChar,pTemp);
+ }
+ }
+ }
+ }
+ }
+
+ //Because now have three types numbering level:
+ //1.real numbering list,numbering level>=0 and numbering Rule !=NULL;
+ //2.common paragraph, numbering level >=0, and numbering Rule == NULL;
+ //3.TOC paragraph, numbering level >0, and numbering Rule ==NULL;
+ // IAText:numberinglevel base on 0, but TOC's level base on 1,
+ // so NumberingLevel value will be decreased 1 in bridge code.
+ else if(numberingLevel >0)
+ {
+ swprintf(pChar,L"Numbering:NumberingLevel=%d,NumberingType=4,NumberingPrefix=,",numberingLevel-1);
+ }
+ else
+ {
+ swprintf(pChar,L"Numbering:");
+ }
+}
+
+void CMAccessible::ConvertAnyToVariant(const ::com::sun::star::uno::Any &rAnyVal, VARIANT *pvData)
+{
+ if(rAnyVal.hasValue())
+ {
+ // Clear VARIANT variable.
+ VariantClear(pvData);
+
+ // Set value according to value type.
+ switch(rAnyVal.getValueTypeClass())
+ {
+ case TypeClass_CHAR:
+ pvData->vt = VT_UI1;
+ memcpy(&pvData->bVal, rAnyVal.getValue(), sizeof(sal_Char));
+ break;
+
+ case TypeClass_BOOLEAN:
+ pvData->vt = VT_BOOL;
+ memcpy(&pvData->boolVal, rAnyVal.getValue(), sizeof(sal_Bool));
+ break;
+
+ case TypeClass_BYTE:
+ pvData->vt = VT_UI1;
+ memcpy(&pvData->bVal, rAnyVal.getValue(), sizeof(sal_Int8));
+ break;
+
+ case TypeClass_SHORT:
+ pvData->vt = VT_I2;
+ memcpy(&pvData->iVal, rAnyVal.getValue(), sizeof(sal_Int16));
+ break;
+
+ case TypeClass_UNSIGNED_SHORT:
+ pvData->vt = VT_I2;
+ memcpy(&pvData->iVal, rAnyVal.getValue(), sizeof(sal_uInt16));
+ break;
+
+ case TypeClass_LONG:
+ pvData->vt = VT_I4;
+ memcpy(&pvData->lVal, rAnyVal.getValue(), sizeof(sal_Int32));
+ break;
+
+ case TypeClass_UNSIGNED_LONG:
+ pvData->vt = VT_I4;
+ memcpy(&pvData->lVal, rAnyVal.getValue(), sizeof(sal_uInt32));
+ break;
+
+ case TypeClass_FLOAT:
+ pvData->vt = VT_R4;
+ memcpy(&pvData->fltVal, rAnyVal.getValue(), sizeof(float));
+ break;
+
+ case TypeClass_DOUBLE:
+ pvData->vt = VT_R8;
+ memcpy(&pvData->dblVal, rAnyVal.getValue(), sizeof(double));
+ break;
+
+ case TypeClass_STRING:
+ {
+ pvData->vt = VT_BSTR;
+ ::rtl::OUString val;
+ rAnyVal >>= val;
+ pvData->bstrVal = SysAllocString((OLECHAR *)val.getStr());
+ break;
+ }
+
+ case TypeClass_VOID:
+ case TypeClass_HYPER:
+ case TypeClass_UNSIGNED_HYPER:
+ case TypeClass_TYPE:
+ case TypeClass_ANY:
+ case TypeClass_ENUM:
+ case TypeClass_TYPEDEF:
+ case TypeClass_STRUCT:
+ case TypeClass_UNION:
+ case TypeClass_EXCEPTION:
+ case TypeClass_SEQUENCE:
+ case TypeClass_ARRAY:
+ case TypeClass_INTERFACE:
+ {
+ Reference< XAccessible > pXAcc;
+ if(rAnyVal >>= pXAcc)
+ {
+ if(pXAcc.is())
+ {
+ IAccessible* pIAcc = NULL;
+ get_IAccessibleFromXAccessible((long)pXAcc.get(), &pIAcc);
+ if(pIAcc == NULL)
+ {
+ Reference< XAccessibleContext > pXAccContext = pXAcc->getAccessibleContext();
+ g_pAgent->InsertAccObj(pXAcc.get(),pXAccContext->getAccessibleParent().get());
+ get_IAccessibleFromXAccessible((long)pXAcc.get(), &pIAcc);
+ }
+ if(pIAcc)
+ {
+ pIAcc->AddRef();
+
+ pvData->vt = VT_UNKNOWN;
+ pvData->pdispVal = (IAccessible2*)pIAcc;
+ break;
+ }
+ }
+ }
+ }
+ case TypeClass_SERVICE:
+ case TypeClass_MODULE:
+ case TypeClass_INTERFACE_METHOD:
+ case TypeClass_INTERFACE_ATTRIBUTE:
+ case TypeClass_UNKNOWN:
+ case TypeClass_PROPERTY:
+ case TypeClass_CONSTANT:
+ case TypeClass_CONSTANTS:
+ case TypeClass_SINGLETON:
+ case TypeClass_MAKE_FIXED_SIZE:
+ // Output the type string, if there is other uno value type.
+ pvData->vt = VT_BSTR;
+ pvData->bstrVal = SysAllocString(rAnyVal.getValueTypeName().getStr());
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ {
+ VariantClear(pvData);
+ }
+}
+
+STDMETHODIMP CMAccessible::Get_XAccChildID(long* childID)
+{
+ // #CHECK#
+ if(childID == NULL)
+ {
+ return E_FAIL;
+ }
+ *childID = m_dChildID;
+ return S_OK;
+}
+STDMETHODIMP CMAccessible:: get_states(AccessibleStates __RPC_FAR *states )
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK XInterface#
+ if( !pRContext.is() )
+ return E_FAIL;
+
+ Reference<XAccessibleStateSet> pRStateSet = pRContext.get()->getAccessibleStateSet();
+ if(!pRStateSet.is())
+ {
+ return S_OK;
+ }
+ Sequence<short> pStates = pRStateSet->getStates();
+
+
+ long count = pStates.getLength() ;
+ *states = 0x0;
+ for( int i = 0; i < count; i++ )
+ {
+ for( int j = 0; j < sizeof(UNO_STATES) / sizeof(UNO_STATES[0]); j++ )
+ {
+ if( pStates[i] == UNO_STATES[j] )
+ {
+ *states |= IA2_STATES[j];
+ break;
+ }
+ }
+ }
+ return S_OK;
+
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+// return the UNO roles
+STDMETHODIMP CMAccessible:: get_extendedRole( BSTR __RPC_FAR * )
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+
+ return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible:: get_localizedExtendedRole( BSTR __RPC_FAR * )
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+STDMETHODIMP CMAccessible:: get_nExtendedStates( long __RPC_FAR * )
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+
+ return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+
+STDMETHODIMP CMAccessible:: get_localizedExtendedStates( long, BSTR __RPC_FAR *__RPC_FAR *, long __RPC_FAR *)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ return E_NOTIMPL;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+
+STDMETHODIMP CMAccessible:: get_indexInParent( long __RPC_FAR *accParentIndex)
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ // #CHECK#
+ if(accParentIndex == NULL)
+ return E_INVALIDARG;
+
+ // #CHECK XInterface#
+ if( !pRContext.is() )
+ return E_FAIL;
+
+ *accParentIndex = pRContext.get()->getAccessibleIndexInParent();
+ return S_OK;
+
+
+ LEAVE_PROTECTED_BLOCK
+}
+STDMETHODIMP CMAccessible:: get_locale( IA2Locale __RPC_FAR *locale )
+{
+
+ CHECK_ENABLE_INF
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if(locale == NULL)
+ return E_INVALIDARG;
+ // #CHECK XInterface#
+
+ if( !pRContext.is() )
+ return E_FAIL;
+
+ ::com::sun::star::lang::Locale unoLoc = pRContext.get()->getLocale();
+ locale->language = SysAllocString((OLECHAR*)unoLoc.Language.getStr());
+ locale->country = SysAllocString((OLECHAR*)unoLoc.Country.getStr());
+ locale->variant = SysAllocString((OLECHAR*)unoLoc.Variant.getStr());
+
+ return S_OK;
+
+ LEAVE_PROTECTED_BLOCK
+}
+
+DWORD GetMSAAStateFromUNO(short xState)
+{
+ DWORD IState = STATE_SYSTEM_UNAVAILABLE;
+ switch( xState )
+ {
+ case /*AccessibleStateType::*/AccessibleStateType::BUSY:
+ IState = STATE_SYSTEM_BUSY;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::CHECKED:
+ IState = STATE_SYSTEM_CHECKED;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::DEFUNC:
+ IState = STATE_SYSTEM_UNAVAILABLE;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::EXPANDED:
+ IState = STATE_SYSTEM_EXPANDED;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::FOCUSABLE:
+ IState = STATE_SYSTEM_FOCUSABLE;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::FOCUSED:
+ IState = STATE_SYSTEM_FOCUSED;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::INDETERMINATE:
+ IState = STATE_SYSTEM_MIXED;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::MULTI_SELECTABLE:
+ IState = STATE_SYSTEM_MULTISELECTABLE;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::PRESSED:
+ IState = STATE_SYSTEM_PRESSED;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::RESIZABLE:
+ IState = STATE_SYSTEM_SIZEABLE;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::SELECTABLE:
+ IState = STATE_SYSTEM_SELECTABLE;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::SELECTED:
+ IState = STATE_SYSTEM_SELECTED;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::ARMED:
+ IState = STATE_SYSTEM_FOCUSED;
+ break;
+ case /*AccessibleStateType::*/AccessibleStateType::EXPANDABLE:
+ IState = STATE_SYSTEM_COLLAPSED;
+ break;
+ default:
+ break;
+ }
+ return IState;
+}
+
+STDMETHODIMP CMAccessible:: get_appName( BSTR __RPC_FAR *name)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if(name == NULL)
+ return E_INVALIDARG;
+
+ *name = SysAllocString(OLESTR("Hannover"));
+ return S_OK;
+ LEAVE_PROTECTED_BLOCK
+}
+STDMETHODIMP CMAccessible:: get_appVersion(BSTR __RPC_FAR *version)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if(version == NULL)
+ return E_INVALIDARG;
+ *version=SysAllocString(OLESTR("3.0"));
+ return S_OK;
+ LEAVE_PROTECTED_BLOCK
+}
+STDMETHODIMP CMAccessible:: get_toolkitName(BSTR __RPC_FAR *name)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if(name == NULL)
+ return E_INVALIDARG;
+ *name = SysAllocString(OLESTR(" "));
+ return S_OK;
+ LEAVE_PROTECTED_BLOCK
+}
+STDMETHODIMP CMAccessible:: get_toolkitVersion(BSTR __RPC_FAR *version)
+{
+
+ ENTER_PROTECTED_BLOCK
+ ISDESTROY()
+ if(version == NULL)
+ return E_INVALIDARG;
+ *version = SysAllocString(OLESTR(" "));
+ return S_OK;
+ LEAVE_PROTECTED_BLOCK
+}
+
+
+STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *pAttr)
+{
+ CHECK_ENABLE_INF
+ Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+ if( !pRContext.is() )
+ {
+ return E_FAIL;
+ }
+ Reference<XAccessibleExtendedAttributes> pRXI(pRContext,UNO_QUERY);
+ if( !pRXI.is() )
+ return E_FAIL;
+ else
+ {
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleExtendedAttributes> pRXAttr;
+ pRXAttr = pRXI.get();
+ ::com::sun::star::uno::Any anyVal = pRXAttr->getExtendedAttributes();
+
+ ::rtl::OUString val;
+ anyVal >>= val;
+
+ if(*pAttr)
+ SAFE_SYSFREESTRING(*pAttr);
+ *pAttr = SysAllocString((OLECHAR *)val.getStr());
+
+ return S_OK;
+ }
+}
+
diff --git a/winaccessibility/source/UAccCOM/MAccessible.h b/winaccessibility/source/UAccCOM/MAccessible.h
new file mode 100644
index 000000000000..5e298e257f6a
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/MAccessible.h
@@ -0,0 +1,294 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __MACCESSIBLE_H_
+#define __MACCESSIBLE_H_
+
+#include <Windows.h>
+#include "resource.h" // main symbols
+#include <vector>
+#include <map>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <AccObjectManagerAgent.hxx>
+#include "EnumVariant.h"
+#ifndef __ACCCOMMON_H_
+#include "acccommon.h"
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#define CHILDID_SELF 0
+#define OBJID_WINDOW ((LONG)0x00000000)
+#define OBJID_SYSMENU ((LONG)0xFFFFFFFF)
+#define OBJID_TITLEBAR ((LONG)0xFFFFFFFE)
+#define OBJID_MENU ((LONG)0xFFFFFFFD)
+#define OBJID_CLIENT ((LONG)0xFFFFFFFC)
+#define OBJID_VSCROLL ((LONG)0xFFFFFFFB)
+#define OBJID_HSCROLL ((LONG)0xFFFFFFFA)
+#define OBJID_SIZEGRIP ((LONG)0xFFFFFFF9)
+#define OBJID_CARET ((LONG)0xFFFFFFF8)
+#define OBJID_CURSOR ((LONG)0xFFFFFFF7)
+#define OBJID_ALERT ((LONG)0xFFFFFFF6)
+#define OBJID_SOUND ((LONG)0xFFFFFFF5)
+#define OBJID_QUERYCLASSNAMEIDX ((LONG)0xFFFFFFF4)
+#define OBJID_NATIVEOM ((LONG)0xFFFFFFF0)
+
+using namespace rtl;
+/**
+ *This class implements IMAccessible interface, which inherits from IAccessible2, and
+ *in turn inherits from IAccessible. So its methods include the methods defined only in
+ *IAccessible, plus the methods defined only in IAccessible2, plus the methods defined
+ *only in IMAccessible.
+ */
+class ATL_NO_VTABLE CMAccessible :
+ public CComObjectRoot,
+ public CComCoClass<CMAccessible, &CLSID_MAccessible>,
+ public IDispatchImpl<IMAccessible, &IID_IMAccessible, &LIBID_UACCCOMLib>,
+ public IServiceProvider,
+ public IAccessibleApplication
+{
+ typedef map< const GUID, CComPtr<IUnknown> ,ltComp > XGUIDToComObjHash;
+
+ typedef HRESULT (WINAPI _UNO_AGGCREATORFUNC)(void*, REFIID, LPVOID*);
+
+ struct _UNO_AGGMAP_ENTRY
+ {
+ const IID* piid;
+ _UNO_AGGCREATORFUNC* pfnCreateInstance;
+ int XIFIndex;
+ };
+
+ enum XInterfaceIndex {
+ XI_COMPONENT = 0x01,
+ XI_TEXT = 0x02,
+ XI_TABLE = 0x03,
+ XI_EDITABLETEXT = 0x04,
+ XI_IMAGE = 0x05,
+ XI_SELECTION = 0x06,
+ XI_EXTENDEDCOMP = 0x07,
+ XI_VALUE = 0x08,
+ XI_KEYBINDING = 0x09,
+ XI_ACTION = 0x0A,
+ XI_HYPERTEXT = 0x0B,
+ XI_HYPERLINK = 0x0C,
+ XI_ATTRIBUTE = 0x0D,
+ XI_NULL = -1
+ };
+
+public:
+ CMAccessible();
+ virtual ~CMAccessible();
+ DECLARE_REGISTRY_RESOURCEID(IDR_MACCESSIBLE)
+
+ DECLARE_GET_CONTROLLING_UNKNOWN()
+
+ DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+ BEGIN_COM_MAP(CMAccessible)
+ COM_INTERFACE_ENTRY(IMAccessible)
+ COM_INTERFACE_ENTRY(IAccessible)
+ COM_INTERFACE_ENTRY(IAccessible2)
+ COM_INTERFACE_ENTRY(IDispatch)
+ COM_INTERFACE_ENTRY(IAccessibleApplication)
+ COM_INTERFACE_ENTRY(IServiceProvider)
+ COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+ END_COM_MAP()
+
+ // AGGREGATE OBJECT MAP
+ BEGIN_AGGOBJECT_MAP(CMAccessible)
+ AGGOBJECT_ENTRY(IID_IAccessibleComponent, CLSID_AccComponent, COMPONENT)
+ AGGOBJECT_ENTRY(IID_IAccessibleText, CLSID_AccText, TEXT)
+ AGGOBJECT_ENTRY(IID_IAccessibleEditableText, CLSID_AccEditableText, EDITABLETEXT)
+ AGGOBJECT_ENTRY(IID_IAccessibleImage, CLSID_AccImage, IMAGE)
+ AGGOBJECT_ENTRY(IID_IAccessibleTable, CLSID_AccTable, TABLE)
+ AGGOBJECT_ENTRY(IID_IAccessibleAction, CLSID_AccAction, ACTION)
+ AGGOBJECT_ENTRY(IID_IAccessibleValue, CLSID_AccValue, VALUE)
+ AGGOBJECT_ENTRY(IID_IAccessibleHypertext, CLSID_AccHypertext, HYPERTEXT)
+ AGGOBJECT_ENTRY(IID_IAccessibleHyperlink, CLSID_AccHyperLink, HYPERLINK)
+
+
+ END_AGGOBJECT_MAP()
+
+ // IMAccessible
+ STDMETHOD(put_accValue)(VARIANT varChild,BSTR szValue);
+ STDMETHOD(put_accName)(VARIANT varChild,BSTR szName);
+ STDMETHOD(accDoDefaultAction)(VARIANT varChild);
+ STDMETHOD(accHitTest)(long xLeft,long yTop,VARIANT *pvarChild);
+ STDMETHOD(accNavigate)(long navDir,VARIANT varStart,VARIANT *pvarEndUpAt);
+ STDMETHOD(accLocation)(long *pxLeft,long *pyTop,long *pcxWidth,long *pcyHeight,VARIANT varChild);
+ STDMETHOD(accSelect)(long flagsSelect,VARIANT varChild);
+ STDMETHOD(get_accDefaultAction)( VARIANT varChild,BSTR *pszDefaultAction);
+ STDMETHOD(get_accSelection)(VARIANT *pvarChildren);
+ STDMETHOD(get_accFocus)(VARIANT *pvarChild);
+ STDMETHOD(get_accKeyboardShortcut)( VARIANT varChild,BSTR *pszKeyboardShortcut);
+ STDMETHOD(get_accHelpTopic)(BSTR *pszHelpFile,VARIANT varChild,long *pidTopic);
+ STDMETHOD(get_accHelp)(VARIANT varChild,BSTR *pszHelp);
+ STDMETHOD(get_accState)(VARIANT varChild,VARIANT *pvarState);
+ STDMETHOD(get_accRole)(VARIANT varChild,VARIANT *pvarRole);
+ STDMETHOD(get_accDescription)(VARIANT varChild,BSTR *pszDescription);
+ STDMETHOD(get_accValue)( VARIANT varChild,BSTR *pszValue);
+ STDMETHOD(get_accName)(VARIANT varChild,BSTR *pszName);
+ STDMETHOD(get_accChild)(VARIANT varChild,IDispatch **ppdispChild);
+ STDMETHOD(get_accChildCount)(long *pcountChildren);
+ STDMETHOD(get_accParent)( IDispatch **ppdispParent);
+
+ // methods which are defined only in the IAccessible2
+ // These methods only declare here, and their implementation bodies are empty now.
+ STDMETHOD(get_nRelations)( long __RPC_FAR *nRelations) ;
+ STDMETHOD(get_relation)( long relationIndex, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation) ;
+ STDMETHOD(get_relations)( long maxRelations, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation, long __RPC_FAR *nRelations) ;
+ STDMETHOD(role)(long __RPC_FAR *role);
+ STDMETHOD(get_nActions)(long __RPC_FAR *nActions);
+ STDMETHOD(scrollTo)(enum IA2ScrollType scrollType);
+ STDMETHOD(scrollToPoint)(enum IA2CoordinateType coordinateType, long x, long y);
+ STDMETHOD(get_groupPosition)(long __RPC_FAR *groupLevel,long __RPC_FAR *similarItemsInGroup,long __RPC_FAR *positionInGroup);
+ STDMETHOD(get_states)( AccessibleStates __RPC_FAR *states );
+ STDMETHOD(get_extendedRole)( BSTR __RPC_FAR *extendedRole );
+ STDMETHOD(get_localizedExtendedRole)( BSTR __RPC_FAR *localizedExtendedRole );
+ STDMETHOD(get_nExtendedStates)( long __RPC_FAR *nExtendedStates);
+ STDMETHOD(get_extendedStates)( long maxExtendedStates, BSTR __RPC_FAR *__RPC_FAR *extendedStates, long __RPC_FAR *nExtendedStates);
+ STDMETHOD(get_localizedExtendedStates)(long maxLocalizedExtendedStates,BSTR __RPC_FAR *__RPC_FAR *localizedExtendedStates,long __RPC_FAR *nLocalizedExtendedStates);
+ STDMETHOD(get_uniqueID)(long __RPC_FAR *uniqueID);
+ STDMETHOD(get_windowHandle)(HWND __RPC_FAR *windowHandle);
+ STDMETHOD(get_indexInParent)( long __RPC_FAR *accParentIndex );
+ STDMETHOD(get_locale)( IA2Locale __RPC_FAR *locale );
+ STDMETHOD(get_attributes)(/*[out]*/ BSTR *pAttr);
+
+ //IServiceProvider.
+ STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void** ppvObject);
+
+ //IAccessibleApplication
+ STDMETHOD(get_appName)(BSTR __RPC_FAR *name);
+ STDMETHOD(get_appVersion)(BSTR __RPC_FAR *version);
+ STDMETHOD(get_toolkitName)(BSTR __RPC_FAR *name);
+ STDMETHOD(get_toolkitVersion)(BSTR __RPC_FAR *version);
+
+ // methods which are defined only in IMAccessible
+ // These methods are provided for UNO management system.
+ // The UNO management system use these methods to put Accessibility
+ // information to COM.
+ STDMETHOD(Put_XAccName)(const OLECHAR __RPC_FAR *pszName);
+ STDMETHOD(Put_XAccRole)(unsigned short pRole);
+ STDMETHOD(DecreaseState)(DWORD pXSate);
+ STDMETHOD(IncreaseState)(DWORD pXSate);
+ STDMETHOD(SetState)(DWORD pXSate);
+ STDMETHOD(Put_XAccDescription)(const OLECHAR __RPC_FAR *pszDescription);
+ STDMETHOD(Put_XAccValue)(const OLECHAR __RPC_FAR *pszAccValue);
+ STDMETHOD(Put_XAccLocation)(const Location sLocation);
+ STDMETHOD(Put_XAccFocus)(long dChildID);
+ STDMETHOD(Put_XAccParent)(IMAccessible __RPC_FAR *pIParent);
+ STDMETHOD(Put_XAccWindowHandle)(HWND hwnd);
+ STDMETHOD(Put_XAccChildID)(long dChildID);
+ STDMETHOD(Put_XAccAgent)(long pAgent);
+ STDMETHOD(NotifyDestroy)(BOOL isDestroy);
+ STDMETHOD(Put_ActionDescription)( const OLECHAR* szAction);
+ STDMETHOD(SetDefaultAction)(long pAction);
+ STDMETHOD(GetUNOInterface)(long*);
+ STDMETHOD(SetXAccessible)(long);
+
+private:
+ OLECHAR* m_pszName;
+ OLECHAR* m_pszValue;
+ OLECHAR* m_pszActionDescription;
+ unsigned short m_iRole;
+ DWORD m_dState;
+ OLECHAR* m_pszDescription;
+ IMAccessible* m_pIParent;
+ Location m_sLocation;
+
+ // identify a COM object/Acc object uniquely
+ long m_dChildID;
+ // specify the focus child ID in object self and its direct children
+
+ long m_dFocusChildID;
+ // parent window handle,will be used in the future application, its value comes from UNO
+
+ HWND m_hwnd;
+
+ // the COM class which implements IEnumVARIANT interface,currently only used in
+ // the implementation of get_accSelection
+ CEnumVariant* m_pEnumVar;
+
+ // specify if the XAccessible is invalid
+ BOOL m_isDestroy;
+
+ XAccessible* pUNOInterface;
+ Reference< XAccessible > pRef;
+ XAccessible* pAchorUNOInterface;
+ XAccessibleAction* m_pXAction;
+ XAccessibleContext* pRContextInterface;
+ Reference<XAccessibleContext> pRContext;
+
+private:
+
+ // the helper methods in order to implement the above public methods
+ IMAccessible* GetChildInterface(long dChildIndex);//notice here the parameter is child index,not child id
+ IMAccessible* GetNavigateChildForDM(VARIANT varCur,short flags);//for decendant manage
+ HRESULT GetFirstChild(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation
+ HRESULT GetLastChild(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation
+ HRESULT GetNextSibling(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation
+ HRESULT GetPreSibling(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation
+ BOOL IsDecendantManage();//identify whether the current COM belongs to manage_decendant roles
+
+ // the following private methods are used to implement accSelect method
+ HRESULT SelectChild(XAccessible* pItem);
+ HRESULT DeSelectChild(XAccessible* pItem);
+ HRESULT SelectMutipleChidren( XAccessible** pItem,int size );
+ HRESULT DeSelectMutipleChildren( XAccessible** pItem,int size );
+ XAccessibleContext* GetContextByXAcc( XAccessible* pXAcc );
+ Reference< XAccessibleSelection > GetSelection();
+ // end accSelect implementation methods
+ BOOL GetXInterfaceFromXAccessible(XAccessible*, XInterface**, int);
+ HRESULT WINAPI SmartQI(void* pv, REFIID iid, void** ppvObject);
+
+public:
+ STDMETHOD(Get_XAccChildID)(/*[out,retval]*/ long* childID);
+ // AccObjectManagerAgent is a management object in UNO, here keep its pointer for
+ // the implementation of accNavigate when decendant manage happens for List,Tree, or Table
+ // AccObjectManagerAgent and the following UNO objects XAccessble,XAccessibleSelection,
+ // XAccessibleAction are all used to operate UNO accessiblility information directly when
+ // implement some specific MSAA methods,such as accSelection,accNavigate
+ static AccObjectManagerAgent* g_pAgent;
+
+ static BOOL get_IAccessibleFromXAccessible(long pXAcc,IAccessible** ppIA);
+ BOOL m_bRequiresSave;
+ XGUIDToComObjHash m_containedObjects;
+
+ static HRESULT WINAPI _SmartQI(void* pv,
+ REFIID iid, void** ppvObject, DWORD)
+ {
+ return ((CMAccessible*)pv)->SmartQI(pv,iid,ppvObject);
+ }
+
+ static void get_OLECHARFromAny(Any& pAny, OLECHAR* pChar);
+
+ static void get_OLECHAR4Numbering(const Any& pAny, short numberingLevel, const OUString& numberingPrefix,OLECHAR* pChar);
+
+ // Helper function for data conversion.
+ static void ConvertAnyToVariant(const ::com::sun::star::uno::Any &rAnyVal, VARIANT *pvData);
+};
+
+
+
+#endif //__MACCESSIBLE_H_
diff --git a/winaccessibility/source/UAccCOM/MAccessible.rgs b/winaccessibility/source/UAccCOM/MAccessible.rgs
new file mode 100644
index 000000000000..10bd2c02eb94
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/MAccessible.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+ UAccCOM.MAccessible.1 = s 'MAccessible Class'
+ {
+ CLSID = s '{CF8DF8BA-44FE-4B10-BD2E-8C8CB322485F}'
+ }
+ UAccCOM.MAccessible = s 'MAccessible Class'
+ {
+ CLSID = s '{CF8DF8BA-44FE-4B10-BD2E-8C8CB322485F}'
+ CurVer = s 'UAccCOM.MAccessible.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {CF8DF8BA-44FE-4B10-BD2E-8C8CB322485F} = s 'MAccessible Class'
+ {
+ ProgID = s 'UAccCOM.MAccessible.1'
+ VersionIndependentProgID = s 'UAccCOM.MAccessible'
+ ForceRemove 'Programmable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Both'
+ }
+ 'TypeLib' = s '{19ECB1B0-9376-4FF9-B580-223FC9C200B8}'
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/Resource.h b/winaccessibility/source/UAccCOM/Resource.h
new file mode 100644
index 000000000000..a4df8cde4aee
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/Resource.h
@@ -0,0 +1,70 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by UAccCOM.rc
+//
+#define WNT
+
+#define IDS_PROJNAME 100
+#define IDR_MACCESSIBLE 101
+#define IDR_ENUMVARIANT 106
+#define IDR_UNOXWRAPPER 107
+#define IDS_ACCCOMPONENT_DESC 108
+#define IDR_AccComponent 109
+#define IDS_ACCCONTEXT_DESC 110
+#define IDR_AccContext 111
+#define IDR_ACCRELATION 112
+#define IDR_ACCACTION 113
+#define IDS_ACCFONT_DESC 114
+#define IDR_AccFont 115
+#define IDS_ACCSELECTION_DESC 116
+#define IDR_AccSelection 117
+#define IDS_ACCEXTENDEDCOMPONENT_DESC 118
+#define IDR_AccExtendedComponent 119
+#define IDS_ACCTEXT_DESC 120
+#define IDR_AccText 121
+#define IDS_ACCEDITABLETEXT_DESC 122
+#define IDR_AccEditableText 123
+#define IDS_ACCHYPERTEXT_DESC 124
+#define IDR_AccHypertext 125
+#define IDS_ACCIMAGE_DESC 126
+#define IDR_AccImage 127
+#define IDS_ACCVALUE_DESC 128
+#define IDR_AccValue 129
+#define IDS_ACCTABLE_DESC 130
+#define IDR_ACCTABLE 131
+#define IDS_ACCHYPERLINK_DESC 132
+#define IDR_AccHyperLink 133
+#define IDS_ACCKEYBINDING_DESC 134
+#define IDR_AccKeyBinding 135
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 203
+#define _APS_NEXT_COMMAND_VALUE 32768
+#define _APS_NEXT_CONTROL_VALUE 201
+#define _APS_NEXT_SYMED_VALUE 137
+#endif
+#endif
diff --git a/winaccessibility/source/UAccCOM/StdAfx.cxx b/winaccessibility/source/UAccCOM/StdAfx.cxx
new file mode 100644
index 000000000000..20fae718d15a
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/StdAfx.cxx
@@ -0,0 +1,29 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+
+#ifdef _ATL_STATIC_REGISTRY
+#include <statreg.h>
+#include <statreg.cpp>
+#endif
+
+#include <atlimpl.cpp>
diff --git a/winaccessibility/source/UAccCOM/UAccCOM.cxx b/winaccessibility/source/UAccCOM/UAccCOM.cxx
new file mode 100644
index 000000000000..85471d13158b
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/UAccCOM.cxx
@@ -0,0 +1,109 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+#include "resource.h"
+#include <initguid.h>
+#include "UAccCOM2.h"
+
+#include "UAccCOM_i.c"
+#include "ia2_api_all_i.c"
+
+#include "MAccessible.h"
+#include "EnumVariant.h"
+#include "UNOXWrapper.h"
+#include "AccComponent.h"
+#include "AccRelation.h"
+#include "AccAction.h"
+#include "AccText.h"
+#include "AccEditableText.h"
+#include "AccImage.h"
+#include "AccValue.h"
+#include "AccTable.h"
+#include "AccHyperLink.h"
+#include "AccHyperText.h"
+
+
+CComModule _Module;
+
+BEGIN_OBJECT_MAP(ObjectMap)
+OBJECT_ENTRY(CLSID_MAccessible, CMAccessible)
+OBJECT_ENTRY(CLSID_EnumVariant, CEnumVariant)
+OBJECT_ENTRY(CLSID_AccComponent, CAccComponent)
+OBJECT_ENTRY(CLSID_AccRelation, CAccRelation)
+OBJECT_ENTRY(CLSID_AccAction, CAccAction)
+OBJECT_ENTRY(CLSID_AccText, CAccText)
+OBJECT_ENTRY(CLSID_AccEditableText, CAccEditableText)
+OBJECT_ENTRY(CLSID_AccImage, CAccImage)
+OBJECT_ENTRY(CLSID_AccValue, CAccValue)
+OBJECT_ENTRY(CLSID_AccTable, CAccTable)
+OBJECT_ENTRY(CLSID_AccHyperLink, CAccHyperLink)
+OBJECT_ENTRY(CLSID_AccHypertext, CAccHypertext)
+END_OBJECT_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// DLL Entry Point
+
+extern "C"
+ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
+{
+ if (dwReason == DLL_PROCESS_ATTACH)
+ {
+ _Module.Init(ObjectMap, hInstance, &LIBID_UACCCOMLib);
+ DisableThreadLibraryCalls(hInstance);
+ }
+ else if (dwReason == DLL_PROCESS_DETACH)
+ _Module.Term();
+ return TRUE; // ok
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Used to determine whether the DLL can be unloaded by OLE
+
+STDAPI DllCanUnloadNow(void)
+{
+ return (_Module.GetLockCount()==0) ? S_OK : E_FAIL;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Returns a class factory to create an object of the requested type
+
+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
+{
+ return _Module.GetClassObject(rclsid, riid, ppv);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// DllRegisterServer - Adds entries to the system registry
+
+STDAPI DllRegisterServer(void)
+{
+ // registers object, typelib and all interfaces in typelib
+ return _Module.RegisterServer(TRUE);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// DllUnregisterServer - Removes entries from the system registry
+
+STDAPI DllUnregisterServer(void)
+{
+ return _Module.UnregisterServer(TRUE);
+}
diff --git a/winaccessibility/source/UAccCOM/UAccCOM.def b/winaccessibility/source/UAccCOM/UAccCOM.def
new file mode 100644
index 000000000000..575a28143316
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/UAccCOM.def
@@ -0,0 +1,7 @@
+LIBRARY "UAccCOM.DLL"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/winaccessibility/source/UAccCOM/UAccCOM.rc b/winaccessibility/source/UAccCOM/UAccCOM.rc
new file mode 100644
index 000000000000..f49903d777d6
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/UAccCOM.rc
@@ -0,0 +1,149 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Chinese (P.R.C.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
+#ifdef _WIN32
+LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
+#pragma code_page(936)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// REGISTRY
+//
+
+IDR_MACCESSIBLE REGISTRY DISCARDABLE "MAccessible.rgs"
+IDR_ENUMVARIANT REGISTRY DISCARDABLE "EnumVariant.rgs"
+IDR_UNOXWRAPPER REGISTRY DISCARDABLE "UNOXWrapper.rgs"
+IDR_AccComponent REGISTRY DISCARDABLE "AccComponent.rgs"
+IDR_AccExtendedComponent REGISTRY DISCARDABLE "AccExtendedComponent.rgs"
+IDR_ACCRELATION REGISTRY DISCARDABLE "AccRelation.rgs"
+IDR_ACCACTION REGISTRY DISCARDABLE "AccAction.rgs"
+IDR_AccFont REGISTRY DISCARDABLE "AccFont.rgs"
+IDR_AccSelection REGISTRY DISCARDABLE "AccSelection.rgs"
+IDR_AccText REGISTRY DISCARDABLE "AccText.rgs"
+IDR_AccEditableText REGISTRY DISCARDABLE "AccEditableText.rgs"
+IDR_AccImage REGISTRY DISCARDABLE "AccImage.rgs"
+IDR_AccValue REGISTRY DISCARDABLE "AccValue.rgs"
+IDR_ACCTABLE REGISTRY DISCARDABLE "AccTable.rgs"
+IDR_AccHyperLink REGISTRY DISCARDABLE "AccHyperLink.rgs"
+IDR_AccHypertext REGISTRY DISCARDABLE "AccHypertext.rgs"
+IDR_AccKeyBinding REGISTRY DISCARDABLE "AccKeyBinding.rgs"
+#endif // Chinese (P.R.C.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""winres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "1 TYPELIB ""UAccCOM.tlb""\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_PROJNAME "UAccCOM"
+ IDS_ACCCOMPONENT_DESC "AccComponent Class"
+ IDS_ACCCONTEXT_DESC "AccContext Class"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_ACCFONT_DESC "AccFont Class"
+ IDS_ACCSELECTION_DESC "AccSelection Class"
+ IDS_ACCEXTENDEDCOMPONENT_DESC "AccExtendedComponent Class"
+ IDS_ACCTEXT_DESC "AccText Class"
+ IDS_ACCEDITABLETEXT_DESC "AccEditableText Class"
+ IDS_ACCHYPERTEXT_DESC "AccHypertext Class"
+ IDS_ACCIMAGE_DESC "AccImage Class"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_ACCVALUE_DESC "AccValue Class"
+ IDS_ACCTABLE_DESC "AccTable Class"
+ IDS_ACCHYPERLINK_DESC "AccHyperLink Class"
+ IDS_ACCKEYBINDING_DESC "AccKeyBinding Class"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+1 TYPELIB "UAccCOM.tlb"
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/winaccessibility/source/UAccCOM/UNOXWrapper.cxx b/winaccessibility/source/UAccCOM/UNOXWrapper.cxx
new file mode 100644
index 000000000000..80427ca20049
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/UNOXWrapper.cxx
@@ -0,0 +1,27 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "UNOXWrapper.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CUNOXWrapper
diff --git a/winaccessibility/source/UAccCOM/UNOXWrapper.h b/winaccessibility/source/UAccCOM/UNOXWrapper.h
new file mode 100644
index 000000000000..c80eb203df70
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/UNOXWrapper.h
@@ -0,0 +1,72 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __UNOXWRAPPER_H_
+#define __UNOXWRAPPER_H_
+
+#define WNT
+
+#include "resource.h" // main symbols
+
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include "UAccCOM2.h"
+
+/**
+ * CUNOXWrapper implements IUNOXWrapper interface.
+ */
+class ATL_NO_VTABLE CUNOXWrapper : public IUNOXWrapper
+{
+public:
+ CUNOXWrapper()
+ { }
+
+public:
+ // IUNOXWrapper
+
+ STDMETHOD(put_XInterface)(long pXInterface)
+ {
+ pUNOInterface = (com::sun::star::accessibility::XAccessible*)pXInterface;
+ return S_OK;
+ }
+
+ STDMETHOD(put_XSubInterface)(long)
+ {
+ return S_OK;
+ }
+
+ STDMETHOD(get_XInterface)(/*[out,retval]*/long *pXInterface)
+ {
+ *pXInterface = (long)pUNOInterface;//.get();
+ return S_OK;
+ }
+
+ STDMETHOD(get_XSubInterface)(/*[out,retval]*/long *)
+ {
+ return S_OK;
+ }
+
+protected:
+
+ com::sun::star::accessibility::XAccessible* pUNOInterface;
+};
+
+#endif //__UNOXWRAPPER_H_
diff --git a/winaccessibility/source/UAccCOM/UNOXWrapper.rgs b/winaccessibility/source/UAccCOM/UNOXWrapper.rgs
new file mode 100644
index 000000000000..8a52b08ae7f9
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/UNOXWrapper.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+ UAccCOM.UNOXWrapper.1 = s 'UNOXWrapper Class'
+ {
+ CLSID = s '{AA360FB0-BC98-41C1-A885-BB921F5ED601}'
+ }
+ UAccCOM.UNOXWrapper = s 'UNOXWrapper Class'
+ {
+ CLSID = s '{AA360FB0-BC98-41C1-A885-BB921F5ED601}'
+ CurVer = s 'UAccCOM.UNOXWrapper.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {AA360FB0-BC98-41C1-A885-BB921F5ED601} = s 'UNOXWrapper Class'
+ {
+ ProgID = s 'UAccCOM.UNOXWrapper.1'
+ VersionIndependentProgID = s 'UAccCOM.UNOXWrapper'
+ ForceRemove 'Programmable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Apartment'
+ }
+ 'TypeLib' = s '{19ECB1B0-9376-4FF9-B580-223FC9C200B8}'
+ }
+ }
+}
diff --git a/winaccessibility/source/UAccCOM/acccommon.h b/winaccessibility/source/UAccCOM/acccommon.h
new file mode 100644
index 000000000000..4c0451a65b0e
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/acccommon.h
@@ -0,0 +1,95 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef __ACCCOMMON_H_
+#define __ACCCOMMON_H_
+
+
+//using namespace com::sun::star::accessibility;
+//using namespace com::sun::star::uno;
+
+
+//for MAccessible.cxx
+struct ltComp
+{
+ bool operator()(REFGUID rguid1, REFGUID rguid2) const
+ {
+ if(((PLONG) &rguid1)[0] < ((PLONG) &rguid2)[0])
+ return TRUE;
+ else if(((PLONG) &rguid1)[0] > ((PLONG) &rguid2)[0])
+ return FALSE;
+ if(((PLONG) &rguid1)[1] < ((PLONG) &rguid2)[1])
+ return TRUE;
+ else if(((PLONG) &rguid1)[1] > ((PLONG) &rguid2)[1])
+ return FALSE;
+ if(((PLONG) &rguid1)[2] < ((PLONG) &rguid2)[2])
+ return TRUE;
+ else if(((PLONG) &rguid1)[2] > ((PLONG) &rguid2)[2])
+ return FALSE;
+ if(((PLONG) &rguid1)[3] < ((PLONG) &rguid2)[3])
+ return TRUE;
+ else if(((PLONG) &rguid1)[3] > ((PLONG) &rguid2)[3])
+ return FALSE;
+ return FALSE;
+ }
+};
+
+#define BEGIN_AGGOBJECT_MAP(x) \
+ static _UNO_AGGMAP_ENTRY* WINAPI _GetAggEntries() { \
+ static _UNO_AGGMAP_ENTRY _aggentries[] = {
+#define END_AGGOBJECT_MAP() {NULL, NULL,NULL}}; \
+ return _aggentries;}
+#define AGGOBJECT_ENTRY(iid, clsid, ifindex) {&iid, \
+ CComAggregateCreator< CComObject<CMAccessible>, &clsid >::CreateInstance,\
+ XI_##ifindex},
+
+enum DM_NIR {
+ DM_FIRSTCHILD = 0x00,
+ DM_LASTCHILD = 0x01,
+ DM_NEXTCHILD = 0x02,
+ DM_PREVCHILD = 0x03
+};
+
+inline BOOL ImplIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
+{
+ return (
+ ((PLONG) &rguid1)[0] == ((PLONG) &rguid2)[0] &&
+ ((PLONG) &rguid1)[1] == ((PLONG) &rguid2)[1] &&
+ ((PLONG) &rguid1)[2] == ((PLONG) &rguid2)[2] &&
+ ((PLONG) &rguid1)[3] == ((PLONG) &rguid2)[3]);
+}
+#define InlineIsEqualGUID ImplIsEqualGUID
+//End
+
+//for AccAction.cxx
+#define CODEENTRY(key) \
+ {KEYCODE_##key, L#key}
+#define countof(x) (sizeof(x)/sizeof(x[0]))
+
+#define SELECT L"Select"
+#define PRESS L"Press"
+#define UNCHECK L"UnCheck"
+#define CHECK L"Check"
+//End
+
+static DWORD GetMSAAStateFromUNO(short xState);
+
+#endif
diff --git a/winaccessibility/source/UAccCOM/stdafx.h b/winaccessibility/source/UAccCOM/stdafx.h
new file mode 100644
index 000000000000..c9b2a23cc7c4
--- /dev/null
+++ b/winaccessibility/source/UAccCOM/stdafx.h
@@ -0,0 +1,64 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#if !defined(AFX_STDAFX_H__5E2F9072_190F_47C7_8003_4D44FD308CB9__INCLUDED_)
+#define AFX_STDAFX_H__5E2F9072_190F_47C7_8003_4D44FD308CB9__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define STRICT
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#endif
+//#define _ATL_APARTMENT_THREADED
+
+#include <atlbase.h>
+// You may derive a class from CComModule and use it if you want to override
+// something, but do not change the name of _Module
+extern CComModule _Module;
+#include <atlcom.h>
+
+#define ENTER_PROTECTED_BLOCK \
+ try \
+ {
+
+#define LEAVE_PROTECTED_BLOCK \
+ } \
+ catch(...) \
+ { \
+ return E_FAIL; \
+ }
+
+#define SAFE_SYSFREESTRING(x) { ::SysFreeString(x); x=NULL; }
+
+#include <windows.h>
+#undef OPAQUE
+#include "CheckEnableAccessible.h"
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__5E2F9072_190F_47C7_8003_4D44FD308CB9__INCLUDED)
diff --git a/winaccessibility/source/UAccCOMIDL/AccessibleKeyBinding.idl b/winaccessibility/source/UAccCOMIDL/AccessibleKeyBinding.idl
new file mode 100644
index 000000000000..8e0e8e06c5c5
--- /dev/null
+++ b/winaccessibility/source/UAccCOMIDL/AccessibleKeyBinding.idl
@@ -0,0 +1,66 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+import "objidl.idl";
+import "oaidl.idl";
+import "oleacc.idl";
+import "AccessibleKeyStroke.idl";
+
+[object, uuid(6B1923AC-3E9A-4336-99E1-A69EA4E946E9)]
+interface IAccessibleKeyBinding : IUnknown
+{
+ ///
+ /// get number of key bindings for this object
+ ///
+ [propget] HRESULT nKeyBindings
+ (
+ [out, retval] long *nKeyBindings
+ );
+
+ ///
+ /// get length of keystroke sequence for specified key binding
+ ///
+ [propget] HRESULT keyStrokeSequenceLength
+ (
+ [in] long keyBindingIndex,
+ [out] long *sequenceLength
+ );
+
+ ///
+ /// The returned sequence of key strokes describes one method
+ /// to invoke the associated action (the one from which you
+ /// obtained the object at which you called this method) by
+ /// pressing keys. The keys specified by each of the returned
+ /// key strokes have to be pressed at the same time (the
+ /// Control-key and the A-key for example). The keys of one key
+ /// stroke have to be released before pressing those of the next.
+ /// The order of the key strokes in the sequence define the order
+ /// in which to press them.
+ ///
+ [propget] HRESULT keyBinding
+ (
+ [in] long keyBindingIndex,
+ [in] long keyStrokeSequenceLength,
+ [out, size_is(,keyStrokeSequenceLength), length_is(,*actualKeyStrokeSequenceLength)]
+ ACCESSIBLE_KEYSTROKE **keyStroke,
+ [out, retval] long *actualKeyStrokeSequenceLength
+ );
+}
diff --git a/winaccessibility/source/UAccCOMIDL/AccessibleKeyStroke.idl b/winaccessibility/source/UAccCOMIDL/AccessibleKeyStroke.idl
new file mode 100644
index 000000000000..7e74497ee8cc
--- /dev/null
+++ b/winaccessibility/source/UAccCOMIDL/AccessibleKeyStroke.idl
@@ -0,0 +1,149 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+typedef struct _ACCESSIBLE_KEYSTROKE {
+ short modifiers;
+ short keyCode;
+ char keyChar;
+ short keyFunc;
+} ACCESSIBLE_KEYSTROKE;
+
+const short MODIFIER_SHIFT = 1;
+const short MODIFIER_CTRL = 2;
+const short MODIFIER_ALT = 4;
+
+const short KEYCODE_NUM0 = 256;
+const short KEYCODE_NUM1 = 257;
+const short KEYCODE_NUM2 = 258;
+const short KEYCODE_NUM3 = 259;
+const short KEYCODE_NUM4 = 260;
+const short KEYCODE_NUM5 = 261;
+const short KEYCODE_NUM6 = 262;
+const short KEYCODE_NUM7 = 263;
+const short KEYCODE_NUM8 = 264;
+const short KEYCODE_NUM9 = 265;
+const short KEYCODE_A = 512;
+const short KEYCODE_B = 513;
+const short KEYCODE_C = 514;
+const short KEYCODE_D = 515;
+const short KEYCODE_E = 516;
+const short KEYCODE_F = 517;
+const short KEYCODE_G = 518;
+const short KEYCODE_H = 519;
+const short KEYCODE_I = 520;
+const short KEYCODE_J = 521;
+const short KEYCODE_K = 522;
+const short KEYCODE_L = 523;
+const short KEYCODE_M = 524;
+const short KEYCODE_N = 525;
+const short KEYCODE_O = 526;
+const short KEYCODE_P = 527;
+const short KEYCODE_Q = 528;
+const short KEYCODE_R = 529;
+const short KEYCODE_S = 530;
+const short KEYCODE_T = 531;
+const short KEYCODE_U = 532;
+const short KEYCODE_V = 533;
+const short KEYCODE_W = 534;
+const short KEYCODE_X = 535;
+const short KEYCODE_Y = 536;
+const short KEYCODE_Z = 537;
+const short KEYCODE_F1 = 768;
+const short KEYCODE_F2 = 769;
+const short KEYCODE_F3 = 770;
+const short KEYCODE_F4 = 771;
+const short KEYCODE_F5 = 772;
+const short KEYCODE_F6 = 773;
+const short KEYCODE_F7 = 774;
+const short KEYCODE_F8 = 775;
+const short KEYCODE_F9 = 776;
+const short KEYCODE_F10 = 777;
+const short KEYCODE_F11 = 778;
+const short KEYCODE_F12 = 779;
+const short KEYCODE_F13 = 780;
+const short KEYCODE_F14 = 781;
+const short KEYCODE_F15 = 782;
+const short KEYCODE_F16 = 783;
+const short KEYCODE_F17 = 784;
+const short KEYCODE_F18 = 785;
+const short KEYCODE_F19 = 786;
+const short KEYCODE_F20 = 787;
+const short KEYCODE_F21 = 788;
+const short KEYCODE_F22 = 789;
+const short KEYCODE_F23 = 790;
+const short KEYCODE_F24 = 791;
+const short KEYCODE_F25 = 792;
+const short KEYCODE_F26 = 793;
+const short KEYCODE_DOWN = 1024;
+const short KEYCODE_UP = 1025;
+const short KEYCODE_LEFT = 1026;
+const short KEYCODE_RIGHT = 1027;
+const short KEYCODE_HOME = 1028;
+const short KEYCODE_END = 1029;
+const short KEYCODE_PAGEUP = 1030;
+const short KEYCODE_PAGEDOWN = 1031;
+const short KEYCODE_RETURN = 1280;
+const short KEYCODE_ESCAPE = 1281;
+const short KEYCODE_TAB = 1282;
+const short KEYCODE_BACKSPACE = 1283;
+const short KEYCODE_SPACE = 1284;
+const short KEYCODE_INSERT = 1285;
+const short KEYCODE_DELETE = 1286;
+const short KEYCODE_ADD = 1287;
+const short KEYCODE_SUBTRACT = 1288;
+const short KEYCODE_MULTIPLY = 1289;
+const short KEYCODE_DIVIDE = 1290;
+const short KEYCODE_POINT = 1291;
+const short KEYCODE_COMMA = 1292;
+const short KEYCODE_LESS = 1293;
+const short KEYCODE_GREATER = 1294;
+const short KEYCODE_EQUAL = 1295;
+const short KEYCODE_OPEN = 1296;
+const short KEYCODE_CUT = 1297;
+const short KEYCODE_COPY = 1298;
+const short KEYCODE_PASTE = 1299;
+const short KEYCODE_UNDO = 1300;
+const short KEYCODE_REPEAT = 1301;
+const short KEYCODE_FIND = 1302;
+const short KEYCODE_PROPERTIES = 1303;
+const short KEYCODE_FRONT = 1304;
+const short KEYCODE_CONTEXTMENU = 1305;
+const short KEYCODE_HELP = 1306;
+
+const short SHORTCUT_DONTKNOW = 0;
+const short NEW = 1;
+const short OPEN = 2;
+const short SAVE = 3;
+const short SAVEAS = 4;
+const short PRINT = 5;
+const short CLOSE = 6;
+const short QUIT = 7;
+const short CUT = 8;
+const short COPY = 9;
+const short PASTE = 10;
+const short UNDO = 11;
+const short REDO = 12;
+const short UNODELETE = 13;
+const short REPEAT = 14;
+const short FIND = 15;
+const short FINDBACKWARD = 16;
+const short PROPERTIES = 17;
+const short FRONT = 18;
diff --git a/winaccessibility/source/UAccCOMIDL/Charset.idl b/winaccessibility/source/UAccCOMIDL/Charset.idl
new file mode 100644
index 000000000000..059573224268
--- /dev/null
+++ b/winaccessibility/source/UAccCOMIDL/Charset.idl
@@ -0,0 +1,33 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+const short CHARSET_DONTKNOW = 0;
+const short ANSI = 1;
+const short MAC = 2;
+const short IBMPC_437 = 3;
+const short IBMPC_850 = 4;
+const short IBMPC_860 = 5;
+const short IBMPC_861 = 6;
+const short IBMPC_863 = 7;
+const short IBMPC_865 = 8;
+const short CHARSET_SYSTEM = 9;
+const short SYMBOL = 10;
diff --git a/winaccessibility/source/UAccCOMIDL/UAccCOM.idl b/winaccessibility/source/UAccCOMIDL/UAccCOM.idl
new file mode 100644
index 000000000000..c1de789fbdaa
--- /dev/null
+++ b/winaccessibility/source/UAccCOMIDL/UAccCOM.idl
@@ -0,0 +1,209 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+import "oaidl.idl";
+import "ocidl.idl";
+
+import "ia2_api_all.idl";
+import "defines.idl";
+
+ [
+ object,
+ uuid(D00F5EB7-588A-487F-A6F6-0B5D7D1815AA),
+ dual,
+ helpstring("IMAccessible Interface"),
+ pointer_default(unique)
+ ]
+ interface IMAccessible : IAccessible2
+ {
+ [id(1), helpstring("method Put_XAccName")] HRESULT Put_XAccName(const OLECHAR* pszName);
+ [id(2), helpstring("method Put_XAccRole")] HRESULT Put_XAccRole(unsigned short pRole);
+ [id(3), helpstring("method DecreaseState")] HRESULT DecreaseState(DWORD pXSate);
+ [id(4), helpstring("method IncreaseState")] HRESULT IncreaseState(DWORD pXSate);
+ [id(5), helpstring("method Put_XDescription")] HRESULT Put_XAccDescription(const OLECHAR* pszDescription);
+ [id(6), helpstring("method Put_XAccValue")] HRESULT Put_XAccValue(const OLECHAR* pszAccValue);
+ [id(7), helpstring("method SetState")] HRESULT SetState(DWORD pXSate);
+ [id(8), helpstring("method Put_XAccLocation")] HRESULT Put_XAccLocation(const Location sLocation);
+ [id(9), helpstring("method Put_XAccFocus")] HRESULT Put_XAccFocus(long dChildID);
+ [id(10), helpstring("method Put_XAccParent")] HRESULT Put_XAccParent(IMAccessible* pIParent);
+ [id(13), helpstring("method Put_XAccWindowHandle")] HRESULT Put_XAccWindowHandle(HWND hwnd);
+ [id(14), helpstring("method Put_XAccChildID")] HRESULT Put_XAccChildID(long dChildID);
+ [id(19), helpstring("method SetXAccessible")] HRESULT SetXAccessible( long XAccessible);
+ [id(20), helpstring("method GetUNOInterface")] HRESULT GetUNOInterface(long* UNOInterface);
+ [id(23), helpstring("method SetDefaultAction")] HRESULT SetDefaultAction(long pAction);
+ [id(24), helpstring("method Put_ActionDescription")] HRESULT Put_ActionDescription( const OLECHAR* szAction);
+ [id(25), helpstring("method Put_XAccAgent")] HRESULT Put_XAccAgent(long pAgent);
+ [id(26), helpstring("method NotifyDestroy")] HRESULT NotifyDestroy(BOOL isDestroy);
+ [id(30), helpstring("method Get_XAccChildID")] HRESULT Get_XAccChildID([out,retval] long* childID);
+ };
+ [
+ object,
+ uuid(951299EE-1841-4249-9E07-812C0739E489),
+ dual,
+ helpstring("IEnumVariant Interface"),
+ pointer_default(unique)
+ ]
+ interface IEnumVariant : IEnumVARIANT
+ {
+ [id(1), helpstring("method ClearEnumeration")] HRESULT ClearEnumeration();
+ [id(2), helpstring("method PutSelection")] HRESULT PutSelection(long pXSeletion);
+ };
+ [
+ object,
+ uuid(6641185C-E099-4C45-B753-3FBC0EE40646),
+ dual,
+ helpstring("IUNOXWrapper Interface"),
+ pointer_default(unique)
+ ]
+ interface IUNOXWrapper : IUnknown
+ {
+ [id(1), helpstring("method put_XInterface")] HRESULT put_XInterface(long pXInterface);
+ [id(2), helpstring("method put_XSubInterface")] HRESULT put_XSubInterface(long pXSubInterface);
+ [id(3), helpstring("method get_XInterface")] HRESULT get_XInterface([out,retval]long* pXInterface);
+ [id(4), helpstring("method get_XSubInterface")] HRESULT get_XSubInterface([out,retval]long* pXSubInterface);
+ };
+
+[
+ uuid(19ECB1B0-9376-4FF9-B580-223FC9C200B8),
+ version(1.0),
+ helpstring("UAccCOM 1.0 Type Library")
+]
+library UACCCOMLib
+{
+ importlib("stdole32.tlb");
+ importlib("stdole2.tlb");
+ importlib("oleacc.dll");
+
+ [
+ uuid(CF8DF8BA-44FE-4B10-BD2E-8C8CB322485F),
+ helpstring("MAccessible Class")
+ ]
+ coclass MAccessible
+ {
+ [default] interface IMAccessible;
+ };
+ [
+ uuid(152884E0-268B-4481-9AE7-1B372D3AA97F),
+ helpstring("EnumVariant Class")
+ ]
+ coclass EnumVariant
+ {
+ [default] interface IEnumVariant;
+ };
+ [
+ uuid(AA360FB0-BC98-41C1-A885-BB921F5ED601),
+ helpstring("UNOXWrapper Class")
+ ]
+ coclass UNOXWrapper
+ {
+ [default] interface IUNOXWrapper;
+ };
+
+ [
+ uuid(9FD9BA47-70AF-4160-99F1-526F2B9F111B),
+ helpstring("AccComponent Class")
+ ]
+ coclass AccComponent
+ {
+ [default] interface IAccessibleComponent;
+ };
+
+ [
+ uuid(8745CF0C-3104-4BAE-B7D0-D7B1717C006E),
+ helpstring("AccRelation Class")
+ ]
+ coclass AccRelation
+ {
+ [default] interface IAccessibleRelation;
+ };
+ [
+ uuid(AA49F20E-BB4E-400D-A5B0-6F5B7B770227),
+ helpstring("AccAction Class")
+ ]
+ coclass AccAction
+ {
+ [default] interface IAccessibleAction;
+ };
+
+ [
+ uuid(6D8AB08B-CCE9-471E-8A41-35773D5263F5),
+ helpstring("AccText Class")
+ ]
+ coclass AccText
+ {
+ [default] interface IAccessibleText;
+ };
+
+ [
+ uuid(79CE1450-1F61-48E2-BF76-C07BD10105E2),
+ helpstring("AccEditableText Class")
+ ]
+ coclass AccEditableText
+ {
+ [default] interface IAccessibleEditableText;
+ };
+
+ [
+ uuid(CC55D71B-1828-4EE0-89E2-C3749CF9C9AB),
+ helpstring("AccHypertext Class")
+ ]
+ coclass AccHypertext
+ {
+ [default] interface IAccessibletext;
+ };
+
+
+ [
+ uuid(73A45800-7A62-432C-A1A6-BF8852994331),
+ helpstring("AccImage Class")
+ ]
+ coclass AccImage
+ {
+ [default] interface IAccessibleImage;
+ };
+
+ [
+ uuid(730A561B-1AF6-49E1-9C04-9A2F48CD8512),
+ helpstring("AccValue Class")
+ ]
+ coclass AccValue
+ {
+ [default] interface IAccessibleValue;
+ };
+ [
+ uuid(92BAA62D-535A-4EAB-9ABB-BFA60B7A6DB6),
+ helpstring("AccTable Class")
+ ]
+ coclass AccTable
+ {
+ [default] interface IAccessibleTable;
+ };
+
+ [
+ uuid(519A64CD-F6A6-4793-BE50-4E36C4C593EF),
+ helpstring("AccHyperLink Class")
+ ]
+ coclass AccHyperLink
+ {
+ [default] interface IAccessibleAction;
+ };
+
+};
diff --git a/winaccessibility/source/UAccCOMIDL/defines.idl b/winaccessibility/source/UAccCOMIDL/defines.idl
new file mode 100644
index 000000000000..dc4e9aababb6
--- /dev/null
+++ b/winaccessibility/source/UAccCOMIDL/defines.idl
@@ -0,0 +1,40 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+import "objidl.idl";
+import "oaidl.idl";
+import "oleacc.idl";
+
+interface IMAccessible;
+
+const long UACC_NO_FOCUS=0xFFFF;
+
+typedef struct {
+ long m_dChildID;//identify a unique child node
+ IMAccessible* m_pIMAccessible;
+}AccChildNode;
+
+typedef struct Location {
+ long m_dLeft;
+ long m_dTop;
+ long m_dWidth;
+ long m_dHeight;
+}Location;
diff --git a/winaccessibility/source/UAccCOMIDL/ia2_api_all.idl b/winaccessibility/source/UAccCOMIDL/ia2_api_all.idl
new file mode 100644
index 000000000000..04a2e7b76349
--- /dev/null
+++ b/winaccessibility/source/UAccCOMIDL/ia2_api_all.idl
@@ -0,0 +1,5473 @@
+/*************************************************************************
+ *
+ * File Name (api_all_headers.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2013 Linux Foundation
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+import "objidl.idl";
+import "oaidl.idl";
+import "oleacc.idl";
+
+/*************************************************************************
+ *
+ * File Name (IA2CommonTypes.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+ /** These constants control the scrolling of an object or substring into a window.
+
+ This enum is used in IAccessible2::scrollTo and IAccessibleText::scrollSubstringTo.
+*/
+enum IA2ScrollType {
+
+ /** Scroll the top left corner of the object or substring such that the top left
+ corner (and as much as possible of the rest of the object or substring) is within
+ the top level window. In cases where the entire object or substring fits within
+ the top level window, the placement of the object or substring is dependent on
+ the application. For example, the object or substring may be scrolled to the
+ closest edge, the furthest edge, or midway between those two edges. In cases
+ where there is a hierarchy of nested scrollable controls, more than one control
+ may have to be scrolled.
+ */
+ IA2_SCROLL_TYPE_TOP_LEFT,
+
+ /** Scroll the bottom right corner of the object or substring such that the bottom right
+ corner (and as much as possible of the rest of the object or substring) is within
+ the top level window. In cases where the entire object or substring fits within
+ the top level window, the placement of the object or substring is dependent on
+ the application. For example, the object or substring may be scrolled to the
+ closest edge, the furthest edge, or midway between those two edges. In cases
+ where there is a hierarchy of nested scrollable controls, more than one control
+ may have to be scrolled.
+ */
+ IA2_SCROLL_TYPE_BOTTOM_RIGHT,
+
+ /** Scroll the top edge of the object or substring such that the top edge
+ (and as much as possible of the rest of the object or substring) is within the
+ top level window. In cases where the entire object or substring fits within
+ the top level window, the placement of the object or substring is dependent on
+ the application. For example, the object or substring may be scrolled to the
+ closest edge, the furthest edge, or midway between those two edges. In cases
+ where there is a hierarchy of nested scrollable controls, more than one control
+ may have to be scrolled.
+ */
+ IA2_SCROLL_TYPE_TOP_EDGE,
+
+ /** Scroll the bottom edge of the object or substring such that the bottom edge
+ (and as much as possible of the rest of the object or substring) is within the
+ top level window. In cases where the entire object or substring fits within
+ the top level window, the placement of the object or substring is dependent on
+ the application. For example, the object or substring may be scrolled to the
+ closest edge, the furthest edge, or midway between those two edges. In cases
+ where there is a hierarchy of nested scrollable controls, more than one control
+ may have to be scrolled.
+ */
+ IA2_SCROLL_TYPE_BOTTOM_EDGE,
+
+ /** Scroll the left edge of the object or substring such that the left edge
+ (and as much as possible of the rest of the object or substring) is within the
+ top level window. In cases where the entire object or substring fits within
+ the top level window, the placement of the object or substring is dependent on
+ the application. For example, the object or substring may be scrolled to the
+ closest edge, the furthest edge, or midway between those two edges. In cases
+ where there is a hierarchy of nested scrollable controls, more than one control
+ may have to be scrolled.
+ */
+ IA2_SCROLL_TYPE_LEFT_EDGE,
+
+ /** Scroll the right edge of the object or substring such that the right edge
+ (and as much as possible of the rest of the object or substring) is within the
+ top level window. In cases where the entire object or substring fits within
+ the top level window, the placement of the object or substring is dependent on
+ the application. For example, the object or substring may be scrolled to the
+ closest edge, the furthest edge, or midway between those two edges. In cases
+ where there is a hierarchy of nested scrollable controls, more than one control
+ may have to be scrolled.
+ */
+ IA2_SCROLL_TYPE_RIGHT_EDGE,
+
+ /** Scroll the object or substring such that as much as possible of the
+ object or substring is within the top level window. The placement of
+ the object is dependent on the application. For example, the object or
+ substring may be scrolled to to closest edge, the furthest edge, or midway
+ between those two edges.
+ */
+ IA2_SCROLL_TYPE_ANYWHERE
+};
+
+/** These constants define which coordinate system a point is located in.
+
+ This enum is used in IAccessible2::scrollToPoint, IAccessibleImage::imagePosition,
+ IAccessibleText::characterExtents, and IAccessibleText::offsetAtPoint, and
+ IAccessibleText::scrollSubstringToPoint.
+*/
+enum IA2CoordinateType {
+
+ /// The coordinates are relative to the screen.
+ IA2_COORDTYPE_SCREEN_RELATIVE,
+
+ /** The coordinates are relative to the upper left corner of the bounding box
+ of the immediate parent.
+ */
+ IA2_COORDTYPE_PARENT_RELATIVE
+
+};
+
+/** Special offsets for use in IAccessibleText and IAccessibleEditableText methods
+
+ Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for more information.
+*/
+enum IA2TextSpecialOffsets {
+ IA2_TEXT_OFFSET_LENGTH = -1, /**< This offset is equivalent to the length of the string. It eliminates
+ the need to call IAccessibleText::nCharacters. */
+ IA2_TEXT_OFFSET_CARET = -2 /**< This offset signifies that the text related to the physical location
+ of the caret should be used. */
+};
+
+/** These constants specify the kind of change made to a table.
+
+ This enum is used in the IA2TableModelChange struct which in turn is used by
+ IAccessibleTable::modelChange and IAccessibleTable2::modelChange.
+*/
+enum IA2TableModelChangeType {
+ IA2_TABLE_MODEL_CHANGE_INSERT, // = 0;
+ IA2_TABLE_MODEL_CHANGE_DELETE,
+ IA2_TABLE_MODEL_CHANGE_UPDATE
+};
+
+/** A structure defining the type of and extents of changes made to a table
+
+ IAccessibleTable::modelChange and IAccessibleTable2::modelChange return this struct.
+ In the case of an insertion or change the row and column offsets define the boundaries
+ of the inserted or changed subtable after the operation. In the case of a deletion
+ the row and column offsets define the boundaries of the subtable being removed before
+ the removal.
+*/
+typedef struct IA2TableModelChange {
+ enum IA2TableModelChangeType type; // insert, delete, update
+ long firstRow; ///< 0 based, inclusive
+ long lastRow; ///< 0 based, inclusive
+ long firstColumn; ///< 0 based, inclusive
+ long lastColumn; ///< 0 based, inclusive
+} IA2TableModelChange;
+/*************************************************************************
+ *
+ * File Name (AccessibleRelation.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+/** @defgroup grpRelations Relations
+ Use the following constants to compare against the BSTRs returned by
+ IAccessibleRelation::relationType.
+*/
+///@{
+
+/** The target object is the containing application object. */
+const WCHAR *const IA2_RELATION_CONTAINING_APPLICATION = L"containingApplication";
+
+/** The target object is the containing document object. The target object implements
+ the IAccessibleDocument interface.
+*/
+const WCHAR *const IA2_RELATION_CONTAINING_DOCUMENT = L"containingDocument";
+
+/** The target object is the containing tab pane object. */
+const WCHAR *const IA2_RELATION_CONTAINING_TAB_PANE = L"containingTabPane";
+
+/** The target object is the containing window object. */
+const WCHAR *const IA2_RELATION_CONTAINING_WINDOW = L"containingWindow";
+
+/** Some attribute of this object is affected by a target object. */
+const WCHAR *const IA2_RELATION_CONTROLLED_BY = L"controlledBy";
+
+/** This object is interactive and controls some attribute of a target object. */
+const WCHAR *const IA2_RELATION_CONTROLLER_FOR = L"controllerFor";
+
+/** This object is described by the target object. */
+const WCHAR *const IA2_RELATION_DESCRIBED_BY = L"describedBy";
+
+/** This object is describes the target object. */
+const WCHAR *const IA2_RELATION_DESCRIPTION_FOR = L"descriptionFor";
+
+/** This object is embedded by a target object. */
+const WCHAR *const IA2_RELATION_EMBEDDED_BY = L"embeddedBy";
+
+/** This object embeds a target object. This relation can be used on the
+ OBJID_CLIENT accessible for a top level window to show where the content
+ areas are.
+*/
+const WCHAR *const IA2_RELATION_EMBEDS = L"embeds";
+
+/** Content flows to this object from a target object.
+ This relation and IA2_RELATION_FLOWS_TO are useful to tie text and non-text
+ objects together in order to allow assistive technology to follow the
+ intended reading order.
+*/
+const WCHAR *const IA2_RELATION_FLOWS_FROM = L"flowsFrom";
+
+/** Content flows from this object to a target object. */
+const WCHAR *const IA2_RELATION_FLOWS_TO = L"flowsTo";
+
+/** This object is label for a target object. */
+const WCHAR *const IA2_RELATION_LABEL_FOR = L"labelFor";
+
+/** This object is labelled by a target object. Note that the double L spelling
+ which follows is preferred. Please use it instead. This single L version may
+ be removed in a later version.
+*/
+const WCHAR *const IA2_RELATION_LABELED_BY = L"labelledBy";
+
+/** This object is labelled by a target object. */
+const WCHAR *const IA2_RELATION_LABELLED_BY = L"labelledBy";
+
+/** This object is a member of a group of one or more objects. When
+ there is more than one object in the group each member may have one and the
+ same target, e.g. a grouping object. It is also possible that each member has
+ multiple additional targets, e.g. one for every other member in the group.
+*/
+const WCHAR *const IA2_RELATION_MEMBER_OF = L"memberOf";
+
+/** The target object is the next object in the tab order. */
+const WCHAR *const IA2_RELATION_NEXT_TABBABLE = L"nextTabbable";
+
+/** This object is a logical child of a target object. This relation is the reciprocal
+ of the IA2_RELATION_NODE_PARENT_OF relation. In some cases an application's accessible
+ tree is such that objects can be in a logical parent-child relationship which is
+ different from the hierarchy of the accessible tree. */
+const WCHAR *const IA2_RELATION_NODE_CHILD_OF = L"nodeChildOf";
+
+/** This object is a logical parent of a target object. This relation is the reciprocal
+ of the IA2_RELATION_NODE_CHILD_OF relation. In some cases an application's accessible
+ tree is such that objects can be in a logical parent-child relationship which is
+ different from the hierarchy of the accessible tree. */
+const WCHAR *const IA2_RELATION_NODE_PARENT_OF = L"nodeParentOf";
+
+/** This object is a parent window of the target object. */
+const WCHAR *const IA2_RELATION_PARENT_WINDOW_OF = L"parentWindowOf";
+
+/** This object is a transient component related to the target object.
+ When this object is activated the target object doesn't lose focus.
+*/
+const WCHAR *const IA2_RELATION_POPUP_FOR = L"popupFor";
+
+/** The target object is the previous object in the tab order. */
+const WCHAR *const IA2_RELATION_PREVIOUS_TABBABLE = L"previousTabbable";
+
+/** This object is a sub window of a target object. */
+const WCHAR *const IA2_RELATION_SUBWINDOW_OF = L"subwindowOf";
+
+///@}
+
+/** This interface gives access to an object's set of relations.
+*/
+[object, uuid(7CDF86EE-C3DA-496a-BDA4-281B336E1FDC)]
+interface IAccessibleRelation : IUnknown
+{
+ /** @brief Returns the type of the relation.
+ @param [out] relationType
+ The strings returned are defined @ref grpRelations "in this section of the documentation".
+ @retval S_OK
+ */
+ [propget] HRESULT relationType
+ (
+ [out, retval] BSTR *relationType
+ );
+
+ /** @brief Returns a localized version of the relation type.
+ @param [out] localizedRelationType
+ @retval S_OK
+ */
+ [propget] HRESULT localizedRelationType
+ (
+ [out, retval] BSTR *localizedRelationType
+ );
+
+ /** @brief Returns the number of targets for this relation.
+ @param [out] nTargets
+ @retval S_OK
+ */
+ [propget] HRESULT nTargets
+ (
+ [out, retval] long *nTargets
+ );
+
+ /** @brief Returns one accessible relation target.
+ @param [in] targetIndex
+ 0 based index
+ @param [out] target
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @note Use QueryInterface to get IAccessible2.
+ */
+ [propget] HRESULT target
+ (
+ [in] long targetIndex,
+ [out, retval] IUnknown **target
+ );
+
+ /** @brief Returns multiple accessible relation targets
+ @param [in] maxTargets
+ maximum size of the array allocated by the client
+ @param [out] targets
+ The array of target objects. Note that this array is to be allocated by the
+ client and freed when no longer needed. Refer to @ref _arrayConsideration
+ "Special Consideration when using Arrays" for more details. You will need to use
+ QueryInterface on the IUnknown to get the IAccessible2.
+ @param [out] nTargets
+ actual number of targets in the returned array (not more than maxTargets)
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, e.g. a negative value
+ */
+ [propget] HRESULT targets
+ (
+ [in] long maxTargets,
+ [out, size_is(maxTargets), length_is(*nTargets)]
+ IUnknown **targets,
+ [out, retval] long *nTargets
+ );
+
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleAction.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+/** This enum defines values which are predefined actions for use when implementing
+ support for media.
+
+ This enum is used when specifying an action for IAccessibleAction::doAction.
+*/
+
+enum IA2Actions {
+ IA2_ACTION_OPEN = -1, /**< Used to inform the server that the client will
+ signal via IA2_ACTION_COMPLETE when it has consumed
+ the content provided by the object. This action
+ allows the object's server to wait for all clients
+ to signal their readiness for additional content.
+ Any form of content generation that requires
+ synchronization with an AT would require use of this
+ action. One example is the generation of text describing
+ visual content not obvious from a video's sound track.
+ In this scenario the Text to Speech or Braille output
+ may take more time than the related length of silence
+ in the video's sound track. */
+ IA2_ACTION_COMPLETE = -2, /**< Used by the client to inform the server that it has
+ consumed the most recent content provided by this object. */
+ IA2_ACTION_CLOSE = -3 /**< Used to inform the server that the client no longer
+ requires synchronization. */
+};
+
+/** @brief This interface gives access to actions that can be executed
+ for accessible objects.
+
+ Every accessible object that can be manipulated via the native GUI beyond the
+ methods available either in the MSAA IAccessible interface or in the set of
+ IAccessible2 interfaces (other than this IAccessibleAction interface) should
+ support the IAccessibleAction interface in order to provide Assistive Technology
+ access to all the actions that can be performed by the object. Each action can
+ be performed or queried for a name, description or associated key bindings.
+ Actions are needed more for ATs that assist the mobility impaired, such as
+ on-screen keyboards and voice command software. By providing actions directly,
+ the AT can present them to the user without the user having to perform the extra
+ steps to navigate a context menu.
+
+ The first action should be equivalent to the MSAA default action. If there is
+ only one action, %IAccessibleAction should also be implemented.
+*/
+[object, uuid(B70D9F59-3B5A-4dba-AB9E-22012F607DF5)]
+interface IAccessibleAction : IUnknown
+{
+
+ /** @brief Returns the number of accessible actions available in this object.
+
+ If there are more than one, the first one is considered the
+ "default" action of the object.
+ @param [out] nActions
+ The returned value of the number of actions is zero if there are
+ no actions.
+ @retval S_OK
+ @note This method is missing a [propget] prefix in the IDL. The result is the
+ method is named nActions in generated C++ code instead of get_nActions.
+ */
+ HRESULT nActions
+ (
+ [out,retval] long* nActions
+ );
+
+ /** @brief Performs the specified Action on the object.
+ @param [in] actionIndex
+ 0 based index specifying the action to perform. If it lies outside
+ the valid range no action is performed.
+ @retval S_OK
+ @retval S_FALSE if action could not be performed
+ @retval E_INVALIDARG if bad [in] passed
+ @note If implementing support for media, refer to the predefined constants in the ::IA2Actions enum.
+ */
+ HRESULT doAction
+ (
+ [in] long actionIndex
+ );
+
+ /** @brief Returns a description of the specified action of the object.
+ @param [in] actionIndex
+ 0 based index specifying which action's description to return.
+ If it lies outside the valid range an empty string is returned.
+ @param [out] description
+ The returned value is a localized string of the specified action.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT description
+ (
+ [in] long actionIndex,
+ [out, retval] BSTR *description
+ );
+
+ /** @brief Returns an array of BSTRs describing one or more key bindings, if
+ there are any, associated with the specified action.
+
+ The returned strings are the localized human readable key sequences to be
+ used to activate each action, e.g. "Ctrl+Shift+D". Since these key
+ sequences are to be used when the object has focus, they are like
+ mnemonics (access keys), and not like shortcut (accelerator) keys.
+
+ There is no need to implement this method for single action controls since
+ that would be redundant with the standard MSAA programming practice of
+ getting the mnemonic from get_accKeyboardShortcut.
+
+ An AT such as an On Screen Keyboard might not expose these bindings but
+ provide alternative means of activation.
+
+ Note: the client allocates and passes in an array of pointers. The server
+ allocates the BSTRs and passes back one or more pointers to these BSTRs into
+ the array of pointers allocated by the client. The client is responsible
+ for deallocating the BSTRs.
+
+ @param [in] actionIndex
+ 0 based index specifying which action's key bindings should be returned.
+ @param [in] nMaxBindings
+ This parameter is ignored. Refer to @ref _arrayConsideration
+ "Special Consideration when using Arrays" for more details.
+ @param [out] keyBindings
+ An array of BSTRs, allocated by the server, one for each key binding.
+ The client must free it with CoTaskMemFree.
+ @param [out] nBindings
+ The number of key bindings returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are no key bindings, [out] values are NULL and 0 respectively
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT keyBinding
+ (
+ [in] long actionIndex,
+ [in] long nMaxBindings,
+ [out, size_is(,nMaxBindings), length_is(,*nBindings)] BSTR **keyBindings,
+ [out, retval] long *nBindings
+ );
+
+ /** @brief Returns the non-localized name of specified action.
+ @param [in] actionIndex
+ 0 based index specifying which action's non-localized name should be returned.
+ @param [out] name
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT name
+ (
+ [in] long actionIndex,
+ [out, retval] BSTR *name
+ );
+
+ /** @brief Returns the localized name of specified action.
+ @param [in] actionIndex
+ 0 based index specifying which action's localized name should be returned.
+ @param [out] localizedName
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT localizedName
+ (
+ [in] long actionIndex,
+ [out, retval] BSTR *localizedName
+ );
+
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleRole.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+/** Collection of roles
+
+ This enumerator defines an extended set of accessible roles of objects implementing
+ the %IAccessible2 interface. These roles are in addition to the MSAA roles obtained
+ through the MSAA get_accRole method. Examples are 'footnote', 'heading', and
+ 'label'. You obtain an object's %IAccessible2 roles by calling IAccessible2::role.
+*/
+enum IA2Role {
+
+ /** Unknown role. The object contains some Accessible information, but its
+ role is not known.
+ */
+ IA2_ROLE_UNKNOWN = 0,
+
+ /** An object that can be drawn into and to manage events from the objects
+ drawn into it. Also refer to ::IA2_ROLE_FRAME,
+ ::IA2_ROLE_GLASS_PANE, and ::IA2_ROLE_LAYERED_PANE.
+ */
+ IA2_ROLE_CANVAS = 0x401,
+
+ /// A caption describing another object.
+ IA2_ROLE_CAPTION,
+
+ /// Used for check buttons that are menu items.
+ IA2_ROLE_CHECK_MENU_ITEM,
+
+ /// A specialized dialog that lets the user choose a color.
+ IA2_ROLE_COLOR_CHOOSER,
+
+ /// A date editor.
+ IA2_ROLE_DATE_EDITOR,
+
+ /** An iconified internal frame in an ::IA2_ROLE_DESKTOP_PANE.
+ Also refer to ::IA2_ROLE_INTERNAL_FRAME.
+ */
+ IA2_ROLE_DESKTOP_ICON,
+
+ /** A desktop pane. A pane that supports internal frames and iconified
+ versions of those internal frames. Also refer to ::IA2_ROLE_INTERNAL_FRAME.
+ */
+ IA2_ROLE_DESKTOP_PANE,
+
+ /** A directory pane. A pane that allows the user to navigate through
+ and select the contents of a directory. May be used by a file chooser.
+ Also refer to ::IA2_ROLE_FILE_CHOOSER.
+ */
+ IA2_ROLE_DIRECTORY_PANE,
+
+ /** An editable text object in a toolbar. <b>Deprecated.</b>
+ The edit bar role was meant for a text area in a tool bar. However, to detect
+ a text area in a tool bar the AT can query the parent.
+ */
+ IA2_ROLE_EDITBAR,
+
+ /// Embedded (OLE) object.
+ IA2_ROLE_EMBEDDED_OBJECT,
+
+ /// Text that is used as an endnote (footnote at the end of a chapter or section).
+ IA2_ROLE_ENDNOTE,
+
+ /** A file chooser. A specialized dialog that displays the files in the
+ directory and lets the user select a file, browse a different directory,
+ or specify a filename. May use the directory pane to show the contents of
+ a directory.
+ Also refer to ::IA2_ROLE_DIRECTORY_PANE.
+ */
+ IA2_ROLE_FILE_CHOOSER,
+
+ /** A font chooser. A font chooser is a component that lets the user pick
+ various attributes for fonts.
+ */
+ IA2_ROLE_FONT_CHOOSER,
+
+ /** Footer of a document page.
+ Also refer to ::IA2_ROLE_HEADER.
+ */
+ IA2_ROLE_FOOTER,
+
+ /// Text that is used as a footnote. Also refer to ::IA2_ROLE_ENDNOTE.
+ IA2_ROLE_FOOTNOTE,
+
+ /** A container of form controls. An example of the use of this role is to
+ represent an HTML FORM tag.
+ */
+ IA2_ROLE_FORM,
+
+ /** Frame role. A top level window with a title bar, border, menu bar, etc.
+ It is often used as the primary window for an application. Also refer to
+ ::IA2_ROLE_CANVAS and the MSAA roles of dialog and window.
+ */
+ IA2_ROLE_FRAME,
+
+ /** A glass pane. A pane that is guaranteed to be painted on top of all panes
+ beneath it. Also refer to ::IA2_ROLE_CANVAS, ::IA2_ROLE_INTERNAL_FRAME, and
+ ::IA2_ROLE_ROOT_PANE.
+ */
+ IA2_ROLE_GLASS_PANE,
+
+ /** Header of a document page.
+ Also refer to ::IA2_ROLE_FOOTER.
+ */
+ IA2_ROLE_HEADER,
+
+ /// Heading. Use the IAccessible2::attributes level attribute to determine the heading level.
+ IA2_ROLE_HEADING,
+
+ /// A small fixed size picture, typically used to decorate components.
+ IA2_ROLE_ICON,
+
+ /** An image map object. Usually a graphic with multiple hotspots, where
+ each hotspot can be activated resulting in the loading of another document
+ or section of a document.
+ */
+ IA2_ROLE_IMAGE_MAP,
+
+ /** An object which is used to allow input of characters not found on a keyboard,
+ such as the input of Chinese characters on a Western keyboard.
+ */
+ IA2_ROLE_INPUT_METHOD_WINDOW,
+
+ /** An internal frame. A frame-like object that is clipped by a desktop pane.
+ The desktop pane, internal frame, and desktop icon objects are often used to
+ create multiple document interfaces within an application.
+ Also refer to ::IA2_ROLE_DESKTOP_ICON, ::IA2_ROLE_DESKTOP_PANE, and ::IA2_ROLE_FRAME.
+ */
+ IA2_ROLE_INTERNAL_FRAME,
+
+ /// An object used to present an icon or short string in an interface.
+ IA2_ROLE_LABEL,
+
+ /** A layered pane. A specialized pane that allows its children to be drawn
+ in layers, providing a form of stacking order. This is usually the pane that
+ holds the menu bar as well as the pane that contains most of the visual
+ components in a window.
+ Also refer to ::IA2_ROLE_CANVAS, ::IA2_ROLE_GLASS_PANE, and ::IA2_ROLE_ROOT_PANE.
+ */
+ IA2_ROLE_LAYERED_PANE,
+
+ /** A section whose content is parenthetic or ancillary to the main content
+ of the resource.
+ */
+ IA2_ROLE_NOTE,
+
+ /** A specialized pane whose primary use is inside a dialog.
+ Also refer to MSAA's dialog role.
+ */
+ IA2_ROLE_OPTION_PANE,
+
+ /** An object representing a page of document content. It is used in documents
+ which are accessed by the user on a page by page basis.
+ */
+ IA2_ROLE_PAGE,
+
+ /// A paragraph of text.
+ IA2_ROLE_PARAGRAPH,
+
+ /** A radio button that is a menu item.
+ Also refer to MSAA's button and menu item roles.
+ */
+ IA2_ROLE_RADIO_MENU_ITEM,
+
+ /** An object which is redundant with another object in the accessible hierarchy.
+ ATs typically ignore objects with this role.
+ */
+ IA2_ROLE_REDUNDANT_OBJECT,
+
+ /** A root pane. A specialized pane that has a glass pane and a layered pane
+ as its children.
+ Also refer to ::IA2_ROLE_GLASS_PANE and ::IA2_ROLE_LAYERED_PANE
+ */
+ IA2_ROLE_ROOT_PANE,
+
+ /** A ruler such as those used in word processors.
+ */
+ IA2_ROLE_RULER,
+
+ /** A scroll pane. An object that allows a user to incrementally view a large
+ amount of information. Its children can include scroll bars and a viewport.
+ Also refer to ::IA2_ROLE_VIEW_PORT and MSAA's scroll bar role.
+ */
+ IA2_ROLE_SCROLL_PANE,
+
+ /** A container of document content. An example of the use of this role is to
+ represent an HTML DIV tag. A section may be used as a region. A region is a
+ group of elements that together form a perceivable unit. A region does not
+ necessarily follow the logical structure of the content, but follows the
+ perceivable structure of the page. A region may have an attribute in the set
+ of IAccessible2::attributes which indicates that it is "live". A live region
+ is content that is likely to change in response to a timed change, a user
+ event, or some other programmed logic or event.
+ */
+ IA2_ROLE_SECTION,
+
+ /// Object with graphical representation used to represent content on draw pages.
+ IA2_ROLE_SHAPE,
+
+ /** A split pane. A specialized panel that presents two other panels at the
+ same time. Between the two panels is a divider the user can manipulate to make
+ one panel larger and the other panel smaller.
+ */
+ IA2_ROLE_SPLIT_PANE,
+
+ /** An object that forms part of a menu system but which can be "undocked"
+ from or "torn off" the menu system to exist as a separate window.
+ */
+ IA2_ROLE_TEAR_OFF_MENU,
+
+ /// An object used as a terminal emulator.
+ IA2_ROLE_TERMINAL,
+
+ /// Collection of objects that constitute a logical text entity.
+ IA2_ROLE_TEXT_FRAME,
+
+ /** A toggle button. A specialized push button that can be checked or unchecked,
+ but does not provide a separate indicator for the current state.
+ Also refer to MSAA's roles of push button, check box, and radio button.
+ <BR><B>Note:</B> IA2_ROLE_TOGGLE_BUTTON should not be used. Instead, use MSAA's
+ ROLE_SYSTEM_PUSHBUTTON and STATE_SYSTEM_PRESSED.
+ */
+ IA2_ROLE_TOGGLE_BUTTON,
+
+ /** A viewport. An object usually used in a scroll pane. It represents the
+ portion of the entire data that the user can see. As the user manipulates
+ the scroll bars, the contents of the viewport can change.
+ Also refer to ::IA2_ROLE_SCROLL_PANE.
+ */
+ IA2_ROLE_VIEW_PORT,
+
+ /** An object containing content which is complementary to the main content of
+ a document, but remains meaningful when separated from the main content. There
+ are various types of content that would appropriately have this role. For example,
+ in the case where content is delivered via a web portal to a web browser, this may
+ include but not be limited to show times, current weather, related articles, or
+ stocks to watch. The complementary role indicates that contained content is relevant
+ to the main content. If the complementary content is completely separable main
+ content, it may be appropriate to use a more general role.
+ */
+ IA2_ROLE_COMPLEMENTARY_CONTENT
+
+};
+/*************************************************************************
+ *
+ * File Name (AccessibleStates.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2010 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+typedef long AccessibleStates;
+
+/** %IAccessible2 specific state bit constants
+
+ This enum defines the state bits returned by IAccessible2::states. The
+ %IAccessible2 state bits are in addition to those returned by MSAA.
+*/
+enum IA2States {
+
+/** Indicates a window is currently the active window, or is an active subelement
+ within a container or table.
+
+ This state can be used to indicate the current active item in a container, even
+ if the container itself is not currently active. In other words this would indicate
+ the item that will get focus if you tab to the container.
+
+ This information is important for knowing what to report for trees and potentially
+ other containers in a virtual buffer.
+
+ Also, see ::IA2_STATE_MANAGES_DESCENDANTS for more information.
+*/
+IA2_STATE_ACTIVE = 0x1,
+
+/** Indicates that the object is armed.
+
+ Used to indicate that the control is "pressed" and will be invoked when the
+ actuator, e.g. a mouse button, is "released". An AT which either monitors the
+ mouse or synthesizes mouse events might need to know that, and possibly a talking
+ interface would even let the user know about it. It could also potentially be
+ useful to on screen keyboards or test tools since the information does indicate
+ something about the state of the interface, for example, code operating asynchronously
+ might need to wait for the armed state to change before doing something else.
+
+*/
+IA2_STATE_ARMED = 0x2,
+
+/** Indicates the user interface object corresponding to this object no longer exists. */
+IA2_STATE_DEFUNCT = 0x4,
+
+/** An object with this state has a caret and implements the IAccessibleText interface.
+
+ Such fields may be read-only, so STATE_SYSTEM_READONLY is valid in combination
+ with IA2_STATE_EDITABLE.
+
+*/
+IA2_STATE_EDITABLE = 0x8,
+
+/** Indicates the orientation of this object is horizontal. */
+IA2_STATE_HORIZONTAL = 0x10,
+
+/** Indicates this object is minimized and is represented only by an icon. */
+IA2_STATE_ICONIFIED = 0x20,
+
+/** Indicates an input validation failure. */
+IA2_STATE_INVALID_ENTRY = 0x40,
+
+/** Indicates that this object manages its children.
+
+ Note: Due to the fact that MSAA's WinEvents don't allow the active child index
+ to be passed on the IA2_EVENT_ACTIVE_DESCENDANT_CHANGED event, the manages
+ descendants scheme can't be used. Instead the active child object has to fire
+ MSAA's EVENT_OBJECT_FOCUS. In a future release a new event mechanism may be
+ added to provide for event specific data to be passed with the event. At that
+ time the IA2_EVENT_ACTIVE_DECENDENT_CHANGED event and
+ IA2_STATE_MANAGES_DESCENDANTS state would be useful.
+*/
+IA2_STATE_MANAGES_DESCENDANTS = 0x80,
+
+/** Indicates that an object is modal.
+
+ Modal objects have the behavior that something must be done with the object
+ before the user can interact with an object in a different window.
+*/
+IA2_STATE_MODAL = 0x100,
+
+/** Indicates this text object can contain multiple lines of text. */
+IA2_STATE_MULTI_LINE = 0x200,
+
+/** Indicates this object paints every pixel within its rectangular region. */
+IA2_STATE_OPAQUE = 0x400,
+
+/** Indicates that user interaction is required.
+
+ An example of when this state is used is when a field in a form must be filled
+ before a form can be processed.
+*/
+IA2_STATE_REQUIRED = 0x800,
+
+/** Indicates an object which supports text selection.
+
+ Note: This is different than MSAA STATE_SYSTEM_SELECTABLE.
+*/
+IA2_STATE_SELECTABLE_TEXT = 0x1000,
+
+/** Indicates that this text object can contain only a single line of text. */
+IA2_STATE_SINGLE_LINE = 0x2000,
+
+/** Indicates that the accessible object is stale.
+
+ This state is used when the accessible object no longer accurately
+ represents the state of the object which it is representing such as when an
+ object is transient or when an object has been or is in the process of being
+ destroyed or when the object's index in its parent has changed.
+*/
+IA2_STATE_STALE = 0x4000,
+
+/** Indicates that the object implements autocompletion.
+
+ This state indicates that a text control will respond to the input of
+ one ore more characters and cause a sub-item to become selected. The
+ selection may also result in events fired on the parent object.
+*/
+IA2_STATE_SUPPORTS_AUTOCOMPLETION = 0x8000,
+
+/** Indicates this object is transient.
+
+ An object has this state when its parent object has the state ::IA2_STATE_MANAGES_DESCENDANTS.
+ For example, a list item object may be managed by its parent list object and may only
+ exist as long as the object is actually rendered. Similarly a table cell's accessible
+ object may exist only while the cell has focus. However, from the perspective of an
+ assistive technology a transient object behaves like a non-transient object. As a
+ result it is likely that this state is not of use to an assistive technology, but it
+ is provided in case an assistive technology determines that knowledge of the transient
+ nature of the object is useful and also for harmony with the Linux accessibility API.
+
+ Also, see ::IA2_STATE_MANAGES_DESCENDANTS for more information.
+ */
+IA2_STATE_TRANSIENT = 0x10000,
+
+/** Indicates the orientation of this object is vertical. */
+IA2_STATE_VERTICAL = 0x20000,
+
+/** Indicates this object is checkable.
+
+ The standard checkable objects are check boxes, radio buttons, check box menu
+ items, radio menu items, and toggle buttons. Since assistive technology will
+ determine that these objects are checkable via the object's role the checkable
+ state is not required. However, this state is necessary in those cases where
+ an object has a role which is not one of the previously mentioned roles. An
+ example is a table cell which indicates whether or not an email has an attachment,
+ whether or not an mail is considered spam, and whether or not an email has been read.
+ */
+IA2_STATE_CHECKABLE = 0x40000,
+
+/** Indicates this object is pinned.
+
+ This state indicates that an object is fixed at a certain location. One example
+ is a browser tab that when pinned cannot be moved until unpinned. Another example
+ is a movable or floating object that when pinned remains in its pinned location
+ until being unpinned.
+ */
+IA2_STATE_PINNED = 0x80000
+
+};
+/*************************************************************************
+ *
+ * File Name (Accessible2.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+/** @mainpage
+
+ @section _interfaces Interfaces
+ IAccessible2\n
+ IAccessible2_2\n
+ IAccessibleAction\n
+ IAccessibleApplication\n
+ IAccessibleComponent\n
+ IAccessibleDocument\n
+ IAccessibleEditableText\n
+ IAccessibleHypertext\n
+ IAccessibleHypertext2\n
+ IAccessibleHyperlink\n
+ IAccessibleImage\n
+ IAccessibleRelation\n
+ IAccessibleTable [Deprecated]\n
+ IAccessibleTable2\n
+ IAccessibleTableCell\n
+ IAccessibleText\n
+ IAccessibleText2\n
+ IAccessibleValue
+
+ @section _structs Structs
+ IA2Locale\n
+ IA2TableModelChange\n
+ IA2TextSegment
+
+ @section _enums Enums
+ ::IA2Actions values are predefined actions for use when implementing support for HTML5 media.\n
+ ::IA2CoordinateType values define the requested coordinate type (screen or parent window).\n
+ ::IA2EventID values identify events.\n
+ ::IA2Role values defines roles which are in addition to the existing MSAA roles.\n
+ ::IA2ScrollType values define where to place an object or substring on the screen.\n
+ ::IA2States values define states which are in addition to the existing MSAA states.\n
+ ::IA2TableModelChangeType values describe the kinds of changes made to a table (insert, delete, update).\n
+ ::IA2TextBoundaryType values define the requested text unit (character, word, sentence, line, paragraph).\n
+ ::IA2TextSpecialOffsets values define special offsets for use in the text interfaces.
+
+ @section _constants Constants
+ @ref grpRelations
+
+ @section _misc Miscellaneous
+ @ref _licensePage "BSD License"\n
+ @ref _generalInfo "General Information"\n
+
+ @page _licensePage BSD License
+ %IAccessible2 IDL Specification
+
+ Copyright (c) 2007, 2013 Linux Foundation\n
+ Copyright (c) 2006 IBM Corporation\n
+ Copyright (c) 2000, 2006 Sun Microsystems, Inc.\n
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+ 3. Neither the name of the Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This BSD License conforms to the Open Source Initiative "Simplified
+ BSD License" as published at:
+ http://www.opensource.org/licenses/bsd-license.php
+
+ %IAccessible2 is a trademark of the Linux Foundation. The %IAccessible2
+ mark may be used in accordance with the
+ <a href="http://www.linuxfoundation.org/collaborate/workgroups/accessibility/trademark-policy">
+ Linux Foundation Trademark Policy</a> to indicate compliance with the %IAccessible2 specification.
+
+ @page _generalInfo General Information
+ The following information is applicable to two or more interfaces.
+
+ @ref _errors\n
+ @ref _memory\n
+ &nbsp;&nbsp;@ref _arrayConsideration\n
+ @ref _indexes\n
+ @ref _enumBase\n
+ @ref _specialOffsets\n
+ @ref _dicoveringInterfaces\n
+ @ref _changingInterfaces\n
+ @ref _applicationInfo\n
+ @ref _childIDs\n
+ @ref _variants\n
+ @ref _iaaction-iahyperlink\n
+ @ref _trademark
+
+ @section _errors Error Handling
+ HRESULT values are defined by the Microsoft&reg; Win32&reg; API. For more information, refer to
+ <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa378137%28v=vs.85%29.aspx">
+ Interpreting HRESULT Values</a> in MSDN&reg;.
+
+ Note that the S_FALSE return value is considered a non-error value and the
+ SUCCEEDED macro will return TRUE. S_FALSE is used when there is no failure
+ but there was nothing valid to return, e.g. in IAccessible2::attributes when
+ there are no attributes. When S_FALSE is returned [out] pointer types should
+ be NULL and [out] longs should generally be 0, but sometimes -1 is used such
+ as IAccessible2::indexInParent, IAccessibleText::caretOffset, and
+ IAccessibleHypertext::hyperlinkIndex.
+
+ Note that for BSTR [out] variables common COM practice is that the server does
+ the SysAllocString and the client does the SysFreeString. Also note that when
+ NULL is returned there is no need for the client to call SysFreeString. Please
+ refer to the documentation for each method for more details regarding error handling.
+
+ @section _memory Memory Management
+ The following memory management issues should be considered:
+ @li Although [out] BSTR variables are declared by the client, their space is
+ allocated by the server. They need to be freed with SysFreeString by the
+ client at end of life; the same is true when BSTRs are used in structs or
+ arrays which are passed to the server.
+ @li If there is no valid [out] BSTR to return, the server should return S_FALSE and
+ assign NULL to the output, e.g. *theOutBSTR = NULL;.
+ @li COM interfaces need to be referenced with AddRef when used and dereferenced
+ with Release at end of life.
+ @li Single [out] longs, HWNDs, booleans, and structs are declared by the caller
+ and passed by reference. The marshaller does all the memory management.
+
+ The following articles may be helpful for understanding memory management issues:
+ @li An article by Don Box in a
+ <a href="http://www.microsoft.com/msj/1196/activex1196.aspx">Q & A section</a>
+ of the November 1996 edition of the Microsoft Systems Journal.
+ @li A posting to a CodeGuru forum,
+ <a href="http://www.codeguru.com/forum/showthread.php?t=364511">Windows SDK
+ String: What are the rules for BSTR allocation and deallocation?</a>
+
+ @subsection _arrayConsideration Special Consideration when using Arrays
+ There are several methods which return arrays. In the case of IAccessible2::relations
+ and IAccessibleRelation::targets the client must allocate and free the arrays.
+
+ For the remaining methods which return arrays, the server must allocate the array
+ and the client must free the array when no longer needed. These methods are
+ IAccessible2::extendedStates, IAccessible2::localizedExtendedStates,
+ IAccessible2_2::relationTargetsOfType, IAccessibleAction::keyBinding,
+ IAccessibleHypertext2::hyperlinks, IAccessibleTable::selectedChildren,
+ IAccessibleTable::selectedColumns, IAccessibleTable::selectedRows,
+ IAccessibleTable2::selectedCells, IAccessibleTable2::selectedColumns,
+ IAccessibleTable2::selectedRows, IAccessibleTableCell::columnHeaderCells,
+ and IAccessibleTableCell::rowHeaderCells.
+ For those methods, the server must allocate both the top level array and any storage
+ associated with it, e.g. for BSTRs. The server must allocate the arrays with
+ CoTaskMemAlloc and any BSTRs with SysAllocString. The client must use CoTaskMemFree
+ to free the array and any BSTRs must be freed with SysFreeString.
+
+ Also, the IDL for IAccessible2::extendedStates, IAccessible2::localizedExtendedStates,
+ IAccessibleAction::keyBinding, IAccessibleTable::selectedChildren,
+ IAccessibleTable::selectedColumns, and IAccessibleTable::selectedRows includes an
+ extraneous [in] parameter for the caller to specify the max size of the array.
+ This parameter will be ignored by the COM server.
+
+ @section _indexes Zero and One Based Indexes
+ Unless otherwise specified all offsets and indexes are 0 based.
+
+ @section _enumBase Enum Base
+ Note that enums start at 0.
+
+ @section _specialOffsets Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods
+ IAccessibleText and IAccessibleEditableText can use one or more of the following
+ special offset values. They are defined in the ::IA2TextSpecialOffsets enum.
+ @li Using ::IA2_TEXT_OFFSET_LENGTH (-1) as an offset in any of the IAccessibleText or
+ IAccessibleEditableText methods is the same as specifying the length of the string.
+ @li Using ::IA2_TEXT_OFFSET_CARET (-2) as an offset for IAccessibleText::textBeforeOffset,
+ IAccessibleText::textAtOffset, and IAccessibleText::textAfterOffset indicates that the
+ text related to the physical location of the caret should be used. This is needed for
+ applications that consider the character offset of the end of one line (as reached by
+ pressing the End key) the same as the offset of the first character on the next line.
+ Since the same offset is associated with two different lines a special means is needed
+ to fetch text from the line where the caret is physically located.
+
+ @section _dicoveringInterfaces Discovery of Interfaces
+ In general AT (Assistive Technology) should try IAccessible2 interfaces, followed by using
+ the MSAA (Microsoft&reg; Active Accessibility&reg;) interfaces. (In cases where the an application
+ is known to have custom interfaces which provide information not supplied by IAccessible2
+ or MSAA, then those custom interfaces can be used.) The AT can then, by default, support
+ unknown IAccessible2/MSAA applications, without the application developers having to request
+ AT vendors for support on an individual application by application basis.
+
+ When you have a reference to an IAccessible and require a reference to an IAccessible2 use
+ QueryService as follows:
+ @code
+ // pAcc is a reference to the accessible object's IAccessible interface.
+ IServiceProvider *pService = NULL;
+ hr = pAcc->QueryInterface(IID_IServiceProvider, (void **)&pService);
+ if(SUCCEEDED(hr)) {
+ IAccessible2 *pIA2 = NULL;
+ hr = pService->QueryService(IID_IAccessible, IID_IAccessible2, (void**)&pIA2);
+ if (SUCCEEDED(hr) && pIA2) {
+ // The control supports IAccessible2.
+ // pIA2 is the reference to the accessible object's IAccessible2 interface.
+ }
+ }
+ @endcode
+
+ @section _changingInterfaces Changing between Accessible Interfaces
+ Note that developers must always implement MSAA's IAccessible and, if needed, some
+ of the interfaces in the set of IAccessible2 interfaces. Although the IAccessible2
+ IDL is coded such that IAccessible2 is a subclass of MSAA's IAccessible, none of
+ MSAA's IAccessible methods are redefined by IAccessible2.
+
+ QueryService must be used to switch from a reference to an MSAA IAccessible interface
+ to another interface. This has been
+ <a href="http://www.atia.org/files/public/Introducing_IAccessibleEx.doc">
+ documented</a> and the pertinent facts have been extracted below:
+
+ @par
+ Why use QueryService instead of just using QueryInterface to get IAccessibleEx
+ directly? The reason is that since MSAA 2.0, clients don't talk to a server's
+ IAccessible interface directly; instead they talk to an intermediate MSAA-provided
+ wrapper that calls through to the original IAccessible. This wrapper provides services
+ such as implementing IDispatch, supplying information from MSAA 2.0's Dynamic Annotation
+ service, and scaling locations when running on Windows Vista with DPI scaling enabled.
+ QueryService is the supported way to expose additional interfaces from an existing
+ IAccessible and was originally used by MSHTML to expose IHTMLElement objects corresponding
+ to IAccessibles. QueryService is often more convenient for servers to implement than
+ QueryInterface because it does not have the same requirements for preserving object
+ identity or symmetry/transitivity as QueryInterface, so QueryService allows servers to
+ easily implement the interface on the same object or a separate object. The latter is
+ often hard to do with QueryInterface unless the original object supports aggregation.
+
+ Two related references in MSDN&reg; are:
+ @li <a href="http://msdn.microsoft.com/en-us/library/ms696078(VS.85).aspx">
+ "Using QueryService to expose a native object model interface for an IAccessible object"</a>
+ @li <a href="http://msdn.microsoft.com/en-us/library/ms528415.aspx#acc_obj">
+ "Accessing the Internet Explorer Object Associated with an Accessible Object"</a>
+
+ Based on this information from Microsoft, QueryService must be used to switch back and forth
+ between a reference to an MSAA IAccessible interface and any of the IAccessible2 interfaces.
+
+ Regarding switching between any of the IAccessible2 interfaces, applications implementing
+ IAccessible2 should implement the IAccessible2 interfaces on a single object since ATs
+ will be using QueryInterface to switch between the IAccessilbe2 interfaces. Implementing
+ the IAccessible2 interfaces on separate objects would require the use of QueryService.
+ There is one exception, IAccessibleApplication can be implemented on a separate object so
+ its common code doesn't have to be included in each accessible object. ATs should use
+ QueryService to access IAccessibleApplication.
+
+ @section _applicationInfo Access to Information about the Application
+ Servers implementing IAccessible2 should provide access to the IAccessibleApplication
+ interface via QueryService from any object so that ATs can easily determine specific
+ information about the application such as its name or version.
+
+ @section _childIDs Child IDs
+ The IAccessible2 interfaces do not support child IDs, i.e. simple child elements.
+ Full accessible objects must be created for each object that supports IAccessible2.
+ Therefore MSAA's get_accChild should never return a child ID (other than CHILDID_SELF)
+ for an object that implements any of the IAccessible2 interfaces.
+
+ Microsoft's UI Automation specification has the same limitation and this was resolved
+ in the UI Automation Express specification by adding IAccessibleEx::GetObjectForChild
+ and IAccessibleEx::GetIAccessiblePair. These methods allow mapping back and forth
+ between an IAccessibleEx and an {IAccessible, Child ID} pair. A future version of
+ IAccessible2 may include similar methods to map back and forth between an IAccessible2
+ and an {IAccessible, Child ID} pair.
+
+ @section _variants VARIANTs
+ Some methods return a VARIANT. Implementers need to make sure that the return type is
+ specified, i.e. VT_I4, VT_IDISPATCH, etc. The methods that return VARIANTs are
+ IAccessibleHyperlink::anchor, IAccessibleHyperlink::anchorTarget, IAccessibleValue::currentValue,
+ IAccessibleValue::maximumValue, IAccessibleValue::minimumValue.
+
+ @section _iaaction-iahyperlink IAccessibleHyperlink as subclass of IAccessibleAction
+ In this version of the IDL, IAccessibleHyperlink is a subclass of IAccessibleAction.
+ However, there is no practical need for that inheritance and in some cases, such as
+ an image map of smart tags, it doesn't make sense because such an image map doesn't
+ have actionable objects; it's the secondary smart tags that are actionable. As a
+ result, implementations should not rely on the inheritance as it may be removed in
+ a later version of the IDL.
+
+ @section _trademark Trademark Attribution
+ The names of actual companies and products mentioned herein may be the trademarks of
+ their respective owners. In particular, Active Accessibility, Microsoft, MSDN, and Win32
+ are trademarks of the Microsoft group of companies in the U.S.A. and/or other countries.
+
+**/
+
+
+
+
+
+
+
+
+/** A structure defining the locale of an accessible object.
+
+IAccessible2::locale returns this struct.
+*/
+typedef struct IA2Locale {
+ BSTR language; ///< ISO 639-1 Alpha-2 two character language code
+ BSTR country; ///< ISO 3166-1 Alpha-2 two character country code
+ BSTR variant; ///< Application specific variant of the locale
+} IA2Locale;
+
+/** @brief This interface exposes the primary set of information about an
+ IAccessible2 enabled accessible object.
+
+ This interface must always be provided for objects that support some
+ portion of the collection of the %IAccessible2 interfaces.
+
+ Please refer to @ref _changingInterfaces "Changing between Accessible Interfaces"
+ for special considerations related to use of the MSAA IAccessible interface and
+ the set of %IAccessible2 interfaces.
+ */
+[object, uuid(E89F726E-C4F4-4c19-BB19-B647D7FA8478)]
+interface IAccessible2 : IAccessible
+{
+
+ /** @brief Returns the number of accessible relations for this object.
+ @param [out] nRelations
+ @retval S_OK
+ */
+ [propget] HRESULT nRelations
+ (
+ [out, retval] long *nRelations
+ );
+
+ /** @brief Returns one accessible relation for this object.
+ @param [in] relationIndex
+ 0 based
+ @param [out] relation
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT relation
+ (
+ [in] long relationIndex,
+ [out, retval] IAccessibleRelation **relation
+ );
+
+ /** @brief Returns multiple accessible relations for this object.
+ @param [in] maxRelations
+ maximum size of the array allocated by the client
+ @param [out] relations
+ The array of accessible relation objects. Note that this array is to be
+ allocated by the client and freed when no longer needed. Refer to @ref
+ _arrayConsideration "Special Consideration when using Arrays" for more details.
+ @param [out] nRelations
+ actual number of relations in the returned array (not more than maxRelations)
+ @retval S_OK
+ @retval S_FALSE if there are no relations, nRelations is set to 0
+ @note As a performant alternative, client code should consider using IAccessible2_2::relationTargetsOfType.
+ */
+ [propget] HRESULT relations
+ (
+ [in] long maxRelations,
+ [out, size_is(maxRelations), length_is(*nRelations)]
+ IAccessibleRelation **relations,
+ [out, retval] long *nRelations
+ );
+
+ /** @brief Returns the role of an %IAccessible2 object.
+ @param [out] role
+ The role of an %IAccessible2 object.
+ @retval S_OK
+ @note
+ @li For convenience MSAA roles are also passed through this method so the
+ AT doesn't have to also fetch roles through MSAA's get_accRole.
+ @li %IAccessible2 roles should not be passed through MSAA's get_accRole.
+ @li For compatibility with non IAccessible2 enabled ATs, IAccessible2
+ applications should also add support to get_accRole to return the closest
+ MSAA role or ROLE_SYSTEM_CLIENT (the MSAA defined default role) if there
+ is not a good match.
+ @li This method is missing a [propget] prefix in the IDL. The result is the
+ method is named role in generated C++ code instead of get_role.
+ */
+ HRESULT role
+ (
+ [out, retval] long *role
+ );
+
+ /** @brief Makes an object visible on the screen.
+ @param [in] scrollType
+ Defines where the object should be placed on the screen.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT scrollTo
+ (
+ [in] enum IA2ScrollType scrollType
+ );
+
+ /** @brief Moves the top left of an object to a specified location.
+
+ @param [in] coordinateType
+ Specifies whether the coordinates are relative to the screen or the parent object.
+ @param [in] x
+ Defines the x coordinate.
+ @param [in] y
+ Defines the y coordinate.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT scrollToPoint
+ (
+ [in] enum IA2CoordinateType coordinateType,
+ [in] long x,
+ [in] long y
+ );
+
+ /** @brief Returns grouping information.
+
+ Used for tree items, list items, tab panel labels, radio buttons, etc.
+ Also used for collections of non-text objects.
+
+ @param [out] groupLevel
+ 1 based, 0 indicates that this value is not applicable
+ @param [out] similarItemsInGroup
+ 1 based, 0 indicates that this value is not applicable
+ @param [out] positionInGroup
+ 1 based, 0 indicates that this value is not applicable. This is an index
+ into the objects in the current group, not an index into all the objects
+ at the same group level.
+ @retval S_OK if at least one value is valid
+ @retval S_FALSE if no values are valid, [out] values are 0s
+ @note This method is meant to describe the nature of an object's containment
+ structure. It's exposed by trees, tree grids, nested lists, nested menus,
+ but not headings, which uses the level object attribute. It is also exposed
+ by radio buttons (with groupLevel == 0).
+ @note This is normally not implemented on a combo box to describe the nature
+ of its contents. Normally an AT will get that information from its child list
+ object. However, in some cases when non-edit combo boxes are not able to be structured
+ such that the list is a child of the combo box, this method is implemented on
+ the combo box itself. ATs can use this interface if a child list is not found.
+ */
+ [propget] HRESULT groupPosition
+ (
+ [out] long *groupLevel,
+ [out] long *similarItemsInGroup,
+ [out, retval] long *positionInGroup
+ );
+
+ /** @brief Returns the bit strip containing any IAccessible2 states.
+
+ The IAccessible2 states are in addition to the MSAA states and are defined in
+ the IA2States enum.
+
+ @param [out] states
+ @retval S_OK
+ */
+ [propget] HRESULT states
+ (
+ [out, retval] AccessibleStates *states
+ );
+
+ /** @brief Returns the extended role.
+
+ An extended role is a role which is dynamically generated by the application.
+ It is not predefined by the %IAccessible2 specification.
+
+ @param [out] extendedRole
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT extendedRole
+ (
+ [out, retval] BSTR *extendedRole
+ );
+
+ /** @brief Returns the localized extended role.
+ @param [out] localizedExtendedRole
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT localizedExtendedRole
+ (
+ [out, retval] BSTR *localizedExtendedRole
+ );
+
+ /** @brief Returns the number of extended states.
+ @param [out] nExtendedStates
+ @retval S_OK
+ */
+ [propget] HRESULT nExtendedStates
+ (
+ [out, retval] long *nExtendedStates
+ );
+
+ /** @brief Returns the extended states (array of strings).
+
+ An extended state is a state which is dynamically generated by the application.
+ It is not predefined by the %IAccessible2 specification.
+
+ @param [in] maxExtendedStates
+ This parameter is ignored. Refer to @ref _arrayConsideration
+ "Special Consideration when using Arrays" for more details.
+ @param [out] extendedStates
+ This array is allocated by the server. The client must free it with CoTaskMemFree.
+ @param [out] nExtendedStates
+ The number of extended states returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are no states, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT extendedStates
+ (
+ [in] long maxExtendedStates,
+ [out, size_is(,maxExtendedStates), length_is(,*nExtendedStates)] BSTR **extendedStates,
+ [out, retval] long *nExtendedStates
+ );
+
+ /** @brief Returns the localized extended states (array of strings).
+
+ @param [in] maxLocalizedExtendedStates
+ This parameter is ignored. Refer to @ref _arrayConsideration
+ "Special Consideration when using Arrays" for more details.
+ @param [out] localizedExtendedStates
+ This array is allocated by the server. The client must free it with CoTaskMemFree.
+ @param [out] nLocalizedExtendedStates
+ The number of localized extended states returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are no states, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT localizedExtendedStates
+ (
+ [in] long maxLocalizedExtendedStates,
+ [out, size_is(,maxLocalizedExtendedStates), length_is(,*nLocalizedExtendedStates)] BSTR **localizedExtendedStates,
+ [out, retval] long *nLocalizedExtendedStates
+ );
+
+ /** @brief Returns the unique ID.
+
+ The uniqueID is an identifier for this object, is unique within the
+ current window, and remains the same for the lifetime of the accessible
+ object.
+
+ The uniqueID is not related to:
+ - the MSAA objectID which is used by the server to disambiguate between
+ IAccessibles per HWND or
+ - the MSAA childID which is used to disambiguate between children being
+ managed by an IAccessible.
+
+ This value is provided so the AT can have access to a unique runtime persistent
+ identifier even when not handling an event for the object.
+
+ An example of when this value is useful is if the AT wants to build a cache.
+ The AT could cache the uniqueIDs in addition to other data being cached.
+ When an event is fired the AT could map the uniqueID to its internal model.
+ Thus, if there's a REORDER/SHOW/HIDE event the AT knows which part of the
+ internal structure has been invalidated and can refetch just that part.
+
+ This value can also be used by an AT to determine when the current control
+ has changed. If the role is the same for two controls that are adjacent in
+ the tab order, this can be used to detect the new control.
+
+ Another use of this value by an AT is to identify when a grouping object has
+ changed, e.g. when moving from a radio button in one group to a radio button in a
+ different group.
+
+ One means of implementing this would be to create a factory with a 32 bit number
+ generator and a reuse pool. The number generator would emit numbers starting
+ at 1. Each time an object's life cycle ended, its number would be saved into a
+ reuse pool. The number generator would be used whenever the reuse pool was empty.
+
+ Another way to create a unique ID is to generate it from a pointer value, e.g. an
+ object's address. That would be unique because no two active objects can use the
+ same allocated memory space.
+
+ @param [out] uniqueID
+ @retval S_OK
+ */
+ [propget] HRESULT uniqueID
+ (
+ [out, retval] long *uniqueID
+ );
+
+ /** @brief Returns the window handle for the parent window which contains this object.
+
+ This is the same window handle which will be passed for any events that occur on the
+ object, but is cached in the accessible object for use when it would be helpful to
+ access the window handle in cases where an event isn't fired on this object.
+
+ A use case is when a screen reader is grabbing an entire web page on a page load.
+ Without the availability of windowHandle, the AT would have to get the window handle
+ by using WindowFromAccessibleObject on each IAccessible, which is slow because it's
+ implemented by oleacc.dll as a loop which crawls up the ancestor chain and looks for
+ a ROLE_WINDOW object, mapping that back to a window handle.
+
+ @param [out] windowHandle
+ @retval S_OK
+ */
+ [propget] HRESULT windowHandle
+ (
+ [out, retval] HWND *windowHandle
+ );
+
+ /** @brief Returns the index of this object in its parent object.
+ @param [out] indexInParent
+ 0 based; -1 indicates there is no parent; the upper bound is the value
+ returned by the parent's IAccessible::get_accChildCount.
+ @retval S_OK
+ @retval S_FALSE if no parent, [out] value is -1
+ */
+ [propget] HRESULT indexInParent
+ (
+ [out, retval] long *indexInParent
+ );
+
+ /** @brief Returns the IA2Locale of the accessible object.
+ @param [out] locale
+ @retval S_OK
+ */
+ [propget] HRESULT locale
+ (
+ [out, retval] IA2Locale *locale
+ );
+
+ /** @brief Returns the attributes specific to this object, such as a cell's formula.
+ @param [out] attributes
+ @retval S_OK
+ @retval S_FALSE returned if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT attributes
+ (
+ [out, retval] BSTR *attributes
+ );
+
+}
+
+/*************************************************************************
+ *
+ * File Name (Accessible2_2.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+/** @brief This interface exposes the primary set of information about an
+ IAccessible2 enabled accessible object.
+
+ This interface must always be provided for objects that support some
+ portion of the collection of the %IAccessible2 interfaces.
+
+ Please refer to @ref _changingInterfaces "Changing between Accessible Interfaces"
+ for special considerations related to use of the MSAA IAccessible interface and
+ the set of %IAccessible2 interfaces.
+ */
+[object, uuid(6C9430E9-299D-4E6F-BD01-A82A1E88D3FF)]
+interface IAccessible2_2 : IAccessible2
+{
+ /** @brief Returns the attribute value of a specified attribute specific to this object.
+ @param [in] name
+ @param [out] attribute
+ @retval S_OK
+ @retval S_FALSE returned if there is nothing to return, [out] value is NULL.
+ @retval E_INVALIDARG if bad [in] passed.
+ @note The output value is a VARIANT. Typically it will be a VT_BSTR, but there
+ are some cases where it will be a VT_I4 or VT_BOOL. Refer to the <a href=
+ "http://www.linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2/objectattributesIAccessible2">
+ Object Attributes specification</a> for more information.
+ */
+ [propget] HRESULT attribute
+ (
+ [in] BSTR name,
+ [out, retval] VARIANT *attribute
+ );
+
+ /** @brief Returns the deepest hypertext accessible in the subtree of this object, and the caret offset within it.
+ @param [out] accessible
+ @param [out] caretOffset
+ @retval S_OK
+ @retval S_FALSE returned if there is no caret in any of the objects in the subtree, [out] accessible is NULL and [out] caretOffset is -1.
+ */
+ [propget] HRESULT accessibleWithCaret
+ (
+ [out] IUnknown **accessible,
+ [out, retval] long *caretOffset
+ );
+
+ /** @brief Returns relation targets for a specified target type.
+ @param [in] type
+ The requested @ref grpRelations "relation type".
+ @param [in] maxTargets
+ The number of targets requested. 0 indicates that all targets should be returned.
+ @param [out] targets
+ This array is allocated by the server. The client must free it with CoTaskMemFree.
+ @param [out] nTargets
+ The number of targets returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are no targets, [out] values are NULL and 0 respectively.
+ @retval E_INVALIDARG if bad [in] passed.
+ */
+ [propget] HRESULT relationTargetsOfType
+ (
+ [in] BSTR type,
+ [in] long maxTargets,
+ [out, size_is(,*nTargets)] IUnknown ***targets,
+ [out, retval] long *nTargets
+ );
+
+}
+
+/*************************************************************************
+ *
+ * File Name (AccessibleComponent.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2010 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+/** A value specifying a color in ARGB format, where each 8 bit color component
+specifies alpha, red, green, and blue respectively. The alpha value is optional.
+*/
+typedef long IA2Color;
+
+/** @brief This interface is implemented by any object that can be rendered
+ on the screen.
+
+ This interface provides the standard mechanism for an assistive technology
+ to retrieve information concerning the graphical representation of an object.
+ Coordinates used by the functions of this interface are specified in
+ different coordinate systems. Their scale is the same and is equal to
+ that of the screen coordinate system. In other words all coordinates
+ are measured in pixels. They differ in their respective origin:
+ <ul>
+ <li>The screen coordinate system has its origin in the upper left
+ corner of the current screen.</li>
+ <li>The origin of the parent coordinate system is the upper left corner
+ of the parent's bounding box. With no parent the screen coordinate
+ system is used instead.</li>
+ </ul>
+*/
+[object, uuid(1546D4B0-4C98-4bda-89AE-9A64748BDDE4)]
+interface IAccessibleComponent : IUnknown
+{
+
+ /** @brief Returns the location of the upper left corner of the object's
+ bounding box relative to the immediate parent object.
+
+ The coordinates of the bounding box are given relative to the parent's
+ coordinate system. The coordinates of the returned position are relative
+ to this object's parent or relative to the screen on which this object
+ is rendered if it has no parent. If the object is not on any screen
+ the returned position is (0,0).
+
+ @param [out] x
+ @param [out] y
+ @retval S_OK
+ */
+ [propget] HRESULT locationInParent
+ (
+ [out] long *x,
+ [out, retval] long *y
+ );
+
+ /** @brief Returns the foreground color of this object.
+ @param [out] foreground
+ The returned color is the foreground color of this object or, if
+ that is not supported, the default foreground color.
+ @retval S_OK
+ */
+ [propget] HRESULT foreground
+ (
+ [out, retval] IA2Color *foreground
+ );
+
+ /** @brief Returns the background color of this object.
+ @param [out] background
+ The returned color is the background color of this object or, if
+ that is not supported, the default background color.
+ @retval S_OK
+ */
+ [propget] HRESULT background
+ (
+ [out, retval] IA2Color *background
+ );
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleValue.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2010 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+/** @brief This interface gives access to a single numerical value.
+
+ The %IAccessibleValue interface represents a single numerical value and should
+ be implemented by any class that supports numerical value like progress bars
+ and spin boxes. This interface lets you access the value and its upper and
+ lower bounds.
+*/
+[object, uuid(35855B5B-C566-4fd0-A7B1-E65465600394)]
+interface IAccessibleValue : IUnknown
+{
+
+ /** @brief Returns the value of this object as a number.
+
+ The exact return type is implementation dependent. Typical types are long and
+ double.
+ @param [out] currentValue
+ Returns the current value represented by this object. See the section about
+ @ref _variants "VARIANTs" for additional information.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is a VARIANT with vt = VT_EMPTY
+ */
+ [propget] HRESULT currentValue
+ (
+ [out, retval] VARIANT *currentValue
+ );
+
+ /** @brief Sets the value of this object to the given number.
+
+ The argument is clipped to the valid interval whose upper and lower
+ bounds are returned by the methods IAccessibleValue::maximumValue and
+ IAccessibleValue::minimumValue, i.e. if it is lower than the minimum
+ value the new value will be the minimum and if it is greater than the
+ maximum then the new value will be the maximum.
+
+ @param [in] value
+ The new value represented by this object. The set of admissible types for
+ this argument is implementation dependent.
+ @retval S_OK
+ */
+ HRESULT setCurrentValue
+ (
+ [in] VARIANT value
+ );
+
+ /** @brief Returns the maximal value that can be represented by this object.
+
+ The type of the returned value is implementation dependent. It does not have
+ to be the same type as that returned by method IAccessibleValue::currentValue.
+
+ @param [out] maximumValue
+ Returns the maximal value in an implementation dependent type. If this object
+ has no upper bound then an empty object is returned. See the section about
+ @ref _variants "VARIANTs" for additional information.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is a VARIANT with vt = VT_EMPTY
+ */
+ [propget] HRESULT maximumValue
+ (
+ [out, retval] VARIANT *maximumValue
+ );
+
+ /** @brief Returns the minimal value that can be represented by this object.
+
+ The type of the returned value is implementation dependent. It does not have
+ to be the same type as that returned by method IAccessibleValue::currentValue.
+
+ @param [out] minimumValue
+ Returns the minimal value in an implementation dependent type. If this object
+ has no lower bound then an empty object is returned. See the section about
+ @ref _variants "VARIANTs" for additional information.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is a VARIANT with vt = VT_EMPTY
+ */
+ [propget] HRESULT minimumValue
+ (
+ [out, retval] VARIANT *minimumValue
+ );
+
+};
+/*************************************************************************
+ *
+ * File Name (AccessibleText.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+/** A structure containing a substring and the start and end offsets in the enclosing string.
+
+ IAccessibleText::newText and IAccessibleText::oldText return this struct.
+*/
+typedef struct IA2TextSegment {
+ BSTR text; ///< A copy of a segment of text taken from an enclosing paragraph.
+ long start; ///< Index of the first character of the segment in the enclosing text.
+ long end; ///< Index of the character following the last character of the segment in the enclosing text.
+} IA2TextSegment;
+
+/** This enum defines values which specify a text boundary type.
+
+ IA2_TEXT_BOUNDARY_SENTENCE is optional. When a method doesn't implement this
+ method it must return S_FALSE. Typically this feature would not be implemented
+ by an application. However, if the application developer was not satisfied with
+ how screen readers have handled the reading of sentences this boundary type
+ could be implemented and screen readers could use the application's version of a
+ sentence rather than the screen reader's.
+
+ The rest of the boundary types must be supported.
+
+ This enum is used in IAccessibleText::textBeforeOffset, IAccessibleText::textAtOffset,
+ and IAccessibleText::textAfterOffset.
+*/
+
+enum IA2TextBoundaryType {
+ IA2_TEXT_BOUNDARY_CHAR, /**< Typically, a single character is returned. In some cases more than
+ one character is returned, for example, when a document contains field
+ data such as a field containing a date, time, or footnote reference.
+ In this case the caret can move over several characters in one movement
+ of the caret. Note that after the caret moves, the caret offset changes
+ by the number of characters in the field, e.g. by 8 characters in the
+ following date: 03/26/07. */
+ IA2_TEXT_BOUNDARY_WORD, /**< The range provided matches the range observed when the application
+ processes the Ctrl + left arrow and Ctrl + right arrow key sequences.
+ Typically this is from the start of one word to the start of the next, but
+ various applications are inconsistent in the handling of the end of a line. */
+ IA2_TEXT_BOUNDARY_SENTENCE, ///< Range is from start of one sentence to the start of another sentence.
+ IA2_TEXT_BOUNDARY_PARAGRAPH, ///< Range is from start of one paragraph to the start of another paragraph.
+ IA2_TEXT_BOUNDARY_LINE, /**< Range is from start of one line to the start of another line. This
+ often means that an end-of-line character will appear at the end of the
+ range. However in the case of some applications an end-of-line character
+ indicates the end of a paragraph and the lines composing the paragraph,
+ other than the last line, do not contain an end of line character. */
+ IA2_TEXT_BOUNDARY_ALL ///< Using this value will cause all text to be returned.
+};
+
+/** @brief This interface gives read-only access to text.
+
+ The %IAccessibleText interface should be implemented by all components
+ that present textual information on the display like buttons,
+ text entry fields, or text portions of the document window. The interface
+ provides access to the text's content, attributes, and spatial location.
+ However, text can not be modified with this interface. That is the task
+ of the IAccessibleEditableText interface.
+
+ The text length, i.e. the number of characters in the text, is
+ returned by IAccessibleText::nCharacters. All methods that operate
+ on particular characters (e.g. IAccessibleText::textAtOffset) use character
+ indices from 0 to length-1. All methods that operate on character positions
+ (e.g. IAccessibleText::text) use indices from 0 to length.
+
+ Please note that accessible text does not necessarily support selection.
+ In this case it should behave as if there where no selection. An empty
+ selection is used for example to express the current cursor position.
+
+ Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+
+ E_FAIL is returned in the following cases
+ @li endOffset < startOffset
+ @li endoffset > length
+*/
+[object, uuid(24FD2FFB-3AAD-4a08-8335-A3AD89C0FB4B)]
+interface IAccessibleText : IUnknown
+{
+
+ /** @brief Adds a text selection
+ @param [in] startOffset
+ Starting offset ( 0 based).
+ @param [in] endOffset
+ Offset of first character after new selection (0 based).
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @note Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ */
+ HRESULT addSelection
+ (
+ [in] long startOffset,
+ [in] long endOffset
+ );
+
+ /** @brief Returns text attributes.
+ @param [in] offset
+ Text offset (0 based). Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ @param [out] startOffset
+ The starting offset of the character range over which all text attributes match
+ those of offset. (0 based)
+ @param [out] endOffset
+ The offset of the first character past the character range over which all text
+ attributes match those of offset. (0 based)
+ @param [out] textAttributes
+ A string of attributes describing the text. The attributes are described in the
+ <a href="http://www.linuxfoundation.org/en/Accessibility/IAccessible2/TextAttributes">
+ text attributes specification</a> on the %IAccessible2 web site.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] values are 0s and NULL respectively
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT attributes
+ (
+ [in] long offset,
+ [out] long *startOffset,
+ [out] long *endOffset,
+ [out, retval] BSTR *textAttributes
+ );
+
+ /** @brief Returns the position of the caret.
+
+ Returns the 0-based offset of the caret within the text. If the text is
+ implemented as a tree of text objects with embed characters in higher levels
+ representing substrings of child text objects and the caret is in one of the
+ child text objects, then the offset in the higher level text object would be
+ at the embed character representing child text object that contains the caret.
+
+ For example, if the string "one two three" is implemented as a two text objects,
+ with a top level text object containing an embed character "one ? three" and a
+ child text object containing "two" and if the caret is in the descendant object
+ just before the 'o' in "two", then:
+ <ul>
+ <li>the caretOffset for the "one ? three" object would be 4, matching the embed character</li>
+ <li>the caretOffset for "two" would be 2, matching the "o"</li>
+ </ul>
+ The caret position/offset is that of the character logically following it, e.g.
+ to the right of it in a left to right language, or to the left of it in a right
+ to left language.
+ @param [out] offset
+ The returned offset is relative to the text represented by this object.
+ @retval S_OK
+ @retval S_FALSE if the caret is not currently active on this object, i.e. the
+ caret is located on some other object. The returned offset value will be -1.
+ @note S_FALSE (and an offset of -1) will not be returned if the caret is somewhere
+ in the text object or one of its descendants.
+ */
+ [propget] HRESULT caretOffset
+ (
+ [out, retval] long *offset
+ );
+
+
+ /** @brief Returns the bounding box of the specified position.
+
+ The virtual character after the last character of the represented
+ text, i.e. the one at position length is a special case. It represents the
+ current input position and will therefore typically be queried by AT more
+ often than other positions. Because it does not represent an existing character
+ its bounding box is defined in relation to preceding characters. It should be
+ roughly equivalent to the bounding box of some character when inserted at the
+ end of the text. Its height typically being the maximal height of all the
+ characters in the text or the height of the preceding character, its width being
+ at least one pixel so that the bounding box is not degenerate.
+
+ Note that the index 'length' is not always valid. Whether it is or not is
+ implementation dependent. It typically is when text is editable or otherwise
+ when on the screen the caret can be placed behind the text. You can be sure
+ that the index is valid after you have received a ::IA2_EVENT_TEXT_CARET_MOVED
+ event for this index.
+ @param [in] offset
+ Index of the character for which to return its bounding box. The valid range
+ is 0..length. Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ @param [in] coordType
+ Specifies if the coordinates are relative to the screen or to the parent window.
+ @param [out] x
+ X coordinate of the top left corner of the bounding box of the referenced character.
+ @param [out] y
+ Y coordinate of the top left corner of the bounding box of the referenced character.
+ @param [out] width
+ Width of the bounding box of the referenced character.
+ @param [out] height
+ Height of the bounding box of the referenced character.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT characterExtents
+ (
+ [in] long offset,
+ [in] enum IA2CoordinateType coordType,
+ [out] long *x,
+ [out] long *y,
+ [out] long *width,
+ [out, retval] long *height
+ );
+
+
+ /** @brief Returns the number of active non-contiguous selections
+ @param [out] nSelections
+ @retval S_OK
+ */
+ [propget] HRESULT nSelections
+ (
+ [out, retval] long *nSelections
+ );
+
+ /** @brief Returns the text position for the specified screen position.
+
+ Given a point return the zero-based index of the character under that
+ point. The same functionality could be achieved by using the bounding
+ boxes for each character as returned by IAccessibleText::characterExtents.
+ The method IAccessibleText::offsetAtPoint, however, can be implemented
+ more efficiently.
+
+ @param [in] x
+ The position's x value for which to look up the index of the character that
+ is rendered on to the display at that point.
+ @param [in] y
+ The position's y value for which to look up the index of the character that
+ is rendered on to the display at that point.
+ @param [in] coordType
+ Screen coordinates or window coordinates.
+ @param [out] offset
+ Index of the character under the given point or -1 if the point
+ is invalid or there is no character under the point.
+ @retval S_OK
+ @retval S_FALSE if nothing to return, [out] value is -1
+
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT offsetAtPoint
+ (
+ [in] long x,
+ [in] long y,
+ [in] enum IA2CoordinateType coordType,
+ [out, retval] long *offset
+ );
+
+ /** @brief Returns the character offsets of Nth active text selection
+
+ Returns the 0-based starting and ending offsets of the Nth selection. If the
+ text is implemented as a tree of text objects with embed characters in higher
+ levels representing substrings of child text objects, consider the following.
+ If the starting selection offset is in one of the child text objects, then the
+ starting offset in the higher level text object would be at the embed character
+ representing the child text object that contains the starting selection offset.
+ If the ending selection offset is in one of the child text objects, then the
+ ending offset in the higher level text object would be just after the embed
+ character representing the child text object that contains the ending selection
+ offset.
+
+ For example, if the string "one two three" is implemented as a two text objects,
+ with a top level text object containing an embed character "one ? three" and a
+ child text object containing "two" and if the selection is the string "two" then:
+ <ul>
+ <li>the startOffset for the "one ? three" object would be 4, matching the embed character and the endOffset would be 5.</li>
+ <li>the startOffset for the "two" object would be 0, and the endOffset would be 3</li>
+ </ul>
+ Selection offsets are that of the character logically following it, e.g.
+ to the right of it in a left to right language or to the left of it in a right to left language.
+ @param [in] selectionIndex
+ Index of selection (0 based).
+ @param [out] startOffset
+ 0 based offset of first selected character
+ @param [out] endOffset
+ 0 based offset of one past the last selected character.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT selection
+ (
+ [in] long selectionIndex,
+ [out] long *startOffset,
+ [out, retval] long *endOffset
+ );
+
+ /** @brief Returns the substring between the two given indices.
+
+ The substring starts with the character at startOffset (inclusive) and up to
+ the character at endOffset (exclusive), if startOffset is less or equal
+ endOffset. If endOffset is lower than startOffset, the result is the same
+ as a call with the two arguments being exchanged.
+
+ The whole text can be requested by passing the indices zero and
+ IAccessibleText::nCharacters. If both indices have the same value, an empty
+ string is returned.
+ @param [in] startOffset
+ Index of the first character to include in the returned string. The valid range
+ is 0..length.
+ @param [in] endOffset
+ Index of the last character to exclude in the returned string. The valid range
+ is 0..length.
+ @param [out] text
+ Returns the substring starting with the character at startOffset (inclusive)
+ and up to the character at endOffset (exclusive), if startOffset is less than
+ or equal to endOffset.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @note
+ @li The returned string may be longer than endOffset-startOffset bytes if text
+ contains multi-byte characters.
+ @li Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ */
+ [propget] HRESULT text
+ (
+ [in] long startOffset,
+ [in] long endOffset,
+ [out, retval] BSTR *text
+ );
+
+ /** @brief Returns a text portion before the given position.
+
+ Returns the substring of the specified text type that is located before the
+ given character and does not include it. The result of this method should be
+ same as a result for IAccessibleText::textAtOffset with a suitably decreased
+ index value.
+
+ For example, if text type is ::IA2_TEXT_BOUNDARY_WORD, then the complete
+ word that is closest to and located before offset is returned.
+
+ If the index is valid, but no text is found, S_FALSE is returned along with out
+ values of 0, 0, and a NULL pointer. This would happen for boundary types other
+ than character when the text consists entirely of whitespace.
+
+ @param [in] offset
+ Index of the character for which to return the text part before it. The index
+ character will not be part of the returned string. The valid range is 0..length.
+ Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ @param [in] boundaryType
+ The type of the text portion to return. See ::IA2TextBoundaryType for the
+ complete list.
+ @param [out] startOffset
+ 0 based offset of first character.
+ @param [out] endOffset
+ 0 based offset of one past the last character.
+ @param [out] text
+ Returns the requested text portion. This portion may be empty or invalid when
+ no appropriate text portion is found or text type is invalid.
+ @retval S_OK
+ @retval S_FALSE if the requested boundary type is not implemented, such as
+ ::IA2_TEXT_BOUNDARY_SENTENCE, or if there is nothing to return;
+ [out] values are 0s and NULL respectively
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT textBeforeOffset
+ (
+ [in] long offset,
+ [in] enum IA2TextBoundaryType boundaryType,
+ [out] long *startOffset,
+ [out] long *endOffset,
+ [out, retval] BSTR *text
+ );
+
+ /** @brief Returns a text portion after the given position.
+
+ Returns the substring of the specified text type that is located after the
+ given character and does not include it. The result of this method should be
+ same as a result for IAccessibleText::textAtOffset with a suitably increased
+ index value.
+
+ For example, if text type is ::IA2_TEXT_BOUNDARY_WORD, then the complete
+ word that is closest to and located after offset is returned.
+
+ If the index is valid, but no text is found, S_FALSE is returned along with out
+ values of 0, 0, and a NULL pointer. This would happen for boundary types other
+ than character when the text consists entirely of whitespace.
+
+ @param [in] offset
+ Index of the character for which to return the text part after it. The index
+ character will not be part of the returned string. The valid range is 0..length.
+ Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ @param [in] boundaryType
+ The type of the text portion to return. See ::IA2TextBoundaryType for the complete
+ list.
+ @param [out] startOffset
+ 0 based offset of first character.
+ @param [out] endOffset
+ 0 based offset of one past the last character.
+ @param [out] text
+ Returns the requested text portion. This portion may be empty or invalid when
+ no appropriate text portion is found or text type is invalid.
+ @retval S_OK
+ @retval S_FALSE if the requested boundary type is not implemented, such as
+ ::IA2_TEXT_BOUNDARY_SENTENCE, or if there is nothing to return;
+ [out] values are 0s and NULL respectively
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT textAfterOffset
+ (
+ [in] long offset,
+ [in] enum IA2TextBoundaryType boundaryType,
+ [out] long *startOffset,
+ [out] long *endOffset,
+ [out, retval] BSTR *text
+ );
+
+ /** @brief Returns a text portion that spans the given position.
+
+ Returns the substring defined by the specified boundary type at the specified
+ offset. Refer to IA2TextBoundaryType for more details.
+
+ For the word boundary type the returned string will contain the word at the
+ offset if the offset is inside a word and will contain the word before the
+ offset if the offset is not inside a word. All offsets from the first to the
+ last characters of a word are considered inside the word. Boundary types of
+ sentence and paragraph should exhibit similar behavior.
+
+ If the index is valid, but no text is found, S_FALSE is returned along with out
+ values of 0, 0, and a NULL pointer. This would happen for boundary types other
+ than character when the text consists entirely of whitespace.
+
+ @param [in] offset
+ Index of the character for which to return the text part it belongs to. The valid
+ range is 0..length.
+ Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ @param [in] boundaryType
+ The type of the text portion to return. See ::IA2TextBoundaryType for the complete
+ list.
+ @param [out] startOffset
+ 0 based offset of first character.
+ @param [out] endOffset
+ 0 based offset of one past the last character.
+ @param [out] text
+ Returns the requested text portion. This portion may be empty or invalid when
+ no appropriate text portion is found or text type is invalid.
+ @retval S_OK
+ @retval S_FALSE if the requested boundary type is not implemented, such as
+ ::IA2_TEXT_BOUNDARY_SENTENCE, or if there is nothing to return;
+ [out] values are 0s and NULL respectively
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT textAtOffset
+ (
+ [in] long offset,
+ [in] enum IA2TextBoundaryType boundaryType,
+ [out] long *startOffset,
+ [out] long *endOffset,
+ [out, retval] BSTR *text
+ );
+
+ /** @brief Unselects a range of text.
+ @param [in] selectionIndex
+ Index of selection to remove (0 based).
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT removeSelection
+ (
+ [in] long selectionIndex
+ );
+
+ /** @brief Sets the position of the caret.
+
+ The caret position/offset is that of the character logically following it,
+ e.g. to the right of it in a left to right language.
+
+ Setting the caret position may or may not alter the current selection. A
+ change of the selection is notified to the accessibility event listeners with
+ an ::IA2_EVENT_TEXT_SELECTION_CHANGED event.
+
+ When the new caret position differs from the old one (which, of course, is the
+ standard case) this is notified to the accessibility event listeners with an
+ ::IA2_EVENT_TEXT_CARET_MOVED event.
+ @param [in] offset
+ The new index of the caret. This caret is actually placed to the left side of
+ the character with that index. An index of 0 places the caret so that the next
+ insertion goes before the first character. An index of IAccessibleText::nCharacters
+ leads to insertion after the last character. Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ @retval S_OK
+ @retval E_FAIL if the caret cannot be set
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT setCaretOffset
+ (
+ [in] long offset
+ );
+
+ /** @brief Changes the bounds of an existing selection.
+ @param [in] selectionIndex
+ Index of selection to change (0 based)
+ @param [in] startOffset
+ New starting offset (0 based)
+ @param [in] endOffset
+ New ending offset (0 based) - the offset of the character just past the last character of the selection.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @note Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ */
+ HRESULT setSelection
+ (
+ [in] long selectionIndex,
+ [in] long startOffset,
+ [in] long endOffset
+ );
+
+ /** @brief Returns total number of characters.
+
+ Note that this may be different than the total number of bytes required to store the
+ text, if the text contains multi-byte characters.
+ @param [out] nCharacters
+ @retval S_OK
+ */
+ [propget] HRESULT nCharacters
+ (
+ [out, retval] long *nCharacters
+ );
+
+ /** @brief Makes a specific part of string visible on screen.
+ @param [in] startIndex
+ 0 based character offset.
+ @param [in] endIndex
+ 0 based character offset - the offset of the character just past the last character of the string.
+ @param [in] scrollType
+ Defines where the object should be placed on the screen.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @note Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ */
+ HRESULT scrollSubstringTo
+ (
+ [in] long startIndex,
+ [in] long endIndex,
+ [in] enum IA2ScrollType scrollType
+ );
+
+ /** @brief Moves the top left of a substring to a specified location.
+
+ @param [in] startIndex
+ 0 based character offset.
+ @param [in] endIndex
+ 0 based character offset - the offset of the character just past the last character of the string.
+ @param [in] coordinateType
+ Specifies whether the coordinates are relative to the screen or the parent object.
+ @param [in] x
+ Defines the x coordinate.
+ @param [in] y
+ Defines the y coordinate.
+ @retval S_OK
+ @retval S_FALSE if the object is already at the specified location.
+ @retval E_INVALIDARG if bad [in] passed
+ @note Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleText methods.
+ */
+ HRESULT scrollSubstringToPoint
+ (
+ [in] long startIndex,
+ [in] long endIndex,
+ [in] enum IA2CoordinateType coordinateType,
+ [in] long x,
+ [in] long y
+ );
+
+ /** @brief Returns any inserted text.
+
+ Provided for use by the ::IA2_EVENT_TEXT_INSERTED and ::IA2_EVENT_TEXT_UPDATED
+ event handlers.
+
+ This data is only guaranteed to be valid while the thread notifying the event
+ continues. Once the handler has returned, the validity of the data depends on
+ how the server manages the life cycle of its objects. Also, note that the server
+ may have different life cycle management strategies for controls depending on
+ whether or not a control manages its children. Lists, trees, and tables can have
+ a large number of children and thus it's possible that the child objects for those
+ controls would only be created as needed. Servers should document their life cycle
+ strategy as this will be of interest to assistive technology or script engines
+ accessing data out of process or from other threads. Servers only need to save the
+ last inserted block of text and a scope of the entire application is adequate.
+
+ @param [out] newText
+ The text that was just inserted.
+ @retval S_OK
+ @retval S_FALSE If there is nothing to return, the values of IA2TextSegment
+ struct are set as follows: text = NULL, start = 0, end = 0.
+
+ */
+ [propget] HRESULT newText
+ (
+ [out, retval] IA2TextSegment *newText
+ );
+
+ /** @brief Returns any removed text.
+
+ Provided for use by the IA2_EVENT_TEXT_REMOVED/UPDATED event handlers.
+
+ This data is only guaranteed to be valid while the thread notifying the event
+ continues. Once the handler has returned, the validity of the data depends on
+ how the server manages the life cycle of its objects. Also, note that the server
+ may have different life cycle management strategies for controls depending on
+ whether or not a control manages its children. Lists, trees, and tables can have
+ a large number of children and thus it's possible that the child objects for those
+ controls would only be created as needed. Servers should document their life cycle
+ strategy as this will be of interest to assistive technology or script engines
+ accessing data out of process or from other threads. Servers only need to save the
+ last removed block of text and a scope of the entire application is adequate.
+
+ @param [out] oldText
+ The text that was just removed.
+ @retval S_OK
+ @retval S_FALSE If there is nothing to return, the values of IA2TextSegment
+ struct are set as follows: text = NULL, start = 0, end = 0.
+ */
+ [propget] HRESULT oldText
+ (
+ [out, retval] IA2TextSegment *oldText
+ );
+
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleText2.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+
+/** @brief This interface gives read-only access to text.
+
+ The %IAccessibleText2 interface extends the functionality of the
+ %IAccessibleText interface.
+*/
+[object, uuid(9690A9CC-5C80-4DF5-852E-2D5AE4189A54)]
+interface IAccessibleText2 : IAccessibleText
+{
+
+ /** @brief Returns the range and of the specified set of attributes.
+
+ Return the range (start and end offsets) and text attributes that correspond
+ to the given attributes filter at the given offset.
+
+ @param [in] offset
+ The offset at which to search for the attributes specified in the filter.
+ @param [in] filter
+ The requested attribute names. The filter format is "attribute1, attribute2".
+ @param [out] startOffset
+ The starting (0-based) offset of the text containing the specified attributes.
+ @param [out] endOffset
+ The (0-based) offset one past the last character of the text containing the
+ specified attributes.
+ @param [out] attributeValues
+ The values of the requested attributes.
+ @retval S_OK
+ @retval S_FALSE if nothing to return, [out] values are -1, -1, NULL respectively.
+ @retval E_INVALIDARG if bad [in] passed.
+ */
+ [propget] HRESULT attributeRange
+ (
+ [in] long offset,
+ [in] BSTR filter,
+ [out] long *startOffset,
+ [out] long *endOffset,
+ [out, retval] BSTR *attributeValues
+ );
+
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleEditableText.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2012 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+/** @brief This interface provides clipboard capability to text objects.
+
+ This interface is typically used in conjunction with the IAccessibleText
+ interface and complements that interface with the additional capability of
+ clipboard operations. Note that even a read only text object can support
+ the copy capability so this interface is not limited to editable objects.
+
+ The substrings used with this interface are specified as follows:
+ If startOffset is less than endOffset, the substring starts with the
+ character at startOffset and ends with the character just before endOffset.
+ If endOffset is lower than startOffset, the result is the same as a call
+ with the two arguments exchanged. The whole text can be defined by passing
+ the indices zero and IAccessibleText::nCharacters. If both indices have the
+ same value, an empty string is defined.
+
+ Refer to the @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about a special offset constant that can be used in %IAccessibleEditableText methods.
+*/
+[object, uuid(A59AA09A-7011-4b65-939D-32B1FB5547E3)]
+interface IAccessibleEditableText : IUnknown
+{
+
+ /** @brief Copies the text range into the clipboard.
+
+ The selection is set to the specified offsets and then selection is copied into
+ the system clipboard.
+
+ @param [in] startOffset
+ Start index of the text to moved into the clipboard.
+ The valid range is 0..length.
+ @param [in] endOffset
+ End index of the text to moved into the clipboard.
+ The valid range is 0..length.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @note Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleEditableText
+ methods.
+ @deprecated This function is available via the application's GUI.
+ */
+ HRESULT copyText
+ (
+ [in] long startOffset,
+ [in] long endOffset
+ );
+
+ /** @brief Deletes a range of text.
+
+ The text between and including the two given indices is deleted
+ from the text represented by this object.
+
+ @param [in] startOffset
+ Start index of the text to be deleted.
+ The valid range is 0..length.
+ @param [in] endOffset
+ End index of the text to be deleted.
+ The valid range is 0..length.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @note Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleEditableText
+ methods.
+ */
+ HRESULT deleteText
+ (
+ [in] long startOffset,
+ [in] long endOffset
+ );
+
+ /** @brief Inserts text at the specified position.
+
+ The specified string is inserted at the given index into the text
+ represented by this object.
+
+ @param [in] offset
+ Index at which to insert the text.
+ The valid range is 0..length.
+ Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleEditableText
+ methods.
+ @param [in] text
+ Text that is inserted.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT insertText
+ (
+ [in] long offset,
+ [in] BSTR *text
+ );
+
+ /** @brief Deletes a range of text and copies it to the clipboard.
+
+ The selection is set to the specified offsets, the selection is then copied into
+ the system clipboard, and then the selection is deleted.
+
+ @param [in] startOffset
+ Start index of the text to be deleted.
+ The valid range is 0..length.
+ @param [in] endOffset
+ End index of the text to be deleted.
+ The valid range is 0..length.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @note Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleEditableText
+ methods.
+ @deprecated This function is available via the application's GUI.
+ */
+ HRESULT cutText
+ (
+ [in] long startOffset,
+ [in] long endOffset
+ );
+
+ /** @brief Pastes content from the clipboard.
+
+ Any existing selection is removed, the clipboard content is then pasted into
+ this object's text at the given offset. This method is similar to the insertText
+ method. If the index is not valid the system clipboard content is not inserted. The
+ behavior is the same as when Ctrl+V is used, i.e. the pasted contents are not
+ necessarily plain text.
+
+ @param [in] offset
+ Index at which to insert the content from the system clipboard into
+ the text represented by this object.
+ The valid range is 0..length.
+ Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleEditableText
+ methods.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @deprecated This function is available via the application's GUI.
+ */
+ HRESULT pasteText
+ (
+ [in] long offset
+ );
+
+ /** @brief Replaces text.
+
+ The text between the two given indices is replaced by the specified
+ replacement string. This method is equivalent to calling first
+ IAccessibleEditableText::deleteText with the two indices and then
+ calling IAccessibleEditableText::insertText with the replacement text
+ at the start index.
+
+ @param [in] startOffset
+ Start index of the text to be replaced.
+ The valid range is 0..length.
+ @param [in] endOffset
+ End index of the text to be replaced.
+ The valid range is 0..length.
+ @param [in] text
+ The Text that replaces the text between the given indices.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @note Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleEditableText
+ methods.
+ */
+ HRESULT replaceText
+ (
+ [in] long startOffset,
+ [in] long endOffset,
+ [in] BSTR *text
+ );
+
+ /** @brief Replaces the attributes of a text range by the given set of attributes.
+
+ Sets the attributes for the text between the two given indices. The old
+ attributes are replaced by the new list of attributes.
+
+ @param [in] startOffset
+ Start index of the text whose attributes are modified.
+ The valid range is 0..length.
+ @param [in] endOffset
+ End index of the text whose attributes are modified.
+ The valid range is 0..length.
+ @param [in] attributes
+ Set of attributes that replaces the old list of attributes of
+ the specified text portion.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ @note Refer to @ref _specialOffsets
+ "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
+ for information about special offsets that can be used in %IAccessibleEditableText
+ methods.
+ */
+ HRESULT setAttributes
+ (
+ [in] long startOffset,
+ [in] long endOffset,
+ [in] BSTR *attributes
+ );
+}
+
+/*************************************************************************
+ *
+ * File Name (AccessibleHyperlink.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2010 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+/** @brief This interface represents hyperlinks.
+
+ This interface represents a hyperlink associated with a single substring
+ of text or single non-text object. Non-text objects can have either a
+ single link or a collection of links such as when the non-text object is
+ an image map.
+
+ Linked objects and anchors are implementation dependent. This interface is derived
+ from IAccessibleAction. IAccessibleAction::nActions is one greater than the
+ maximum value for the indices used with the methods of this interface.
+
+ Furthermore, the object that implements this interface has to be connected
+ implicitly or explicitly with an object that implements IAccessibleText.
+ IAccessibleHyperlink::startIndex and IAccessibleHyperlink::endIndex are
+ indices with respect to the text exposed by IAccessibleText.
+
+ This interface provides access to a single object which can have multiple actions.
+ An example is an image map which is an image with multiple links each of which is
+ associated with a separate non-overlapping area of the image. This interface could
+ also be applied to other kinds of objects with multiple actions such as "smart tags"
+ which are objects, typically strings, which have multiple actions such as
+ "Activate URI", "Bookmark URI", etc.
+
+ An interesting use case is an image map where each area is associated with multiple
+ actions, e.g. an image map of smart tags. In this case you would have to implement
+ two levels of accessible hyperlinks. The first level hyperlinks would only implement
+ anchor and anchorTarget. The anchors would all reference the image object. The
+ anchorTargets would reference the second level accessible hyperlink objects. None
+ of the IAccessibleAction methods would be implemented on the first level hyperlink
+ objects. The second level hyperlink objects would implement the IAccessibleAction
+ methods. Their anchors would also reference the image object and their anchorTargets
+ would reference URLs or the objects that would be activated.
+
+ This use case demonstrates that in some cases there is no need for IAccessibleHyperlink
+ to derive from IAccessibleAction. As a result it may be removed in a later version of
+ the IDL and it is suggested that implementations should not rely on the inheritance.
+
+*/
+[object, uuid(01C20F2B-3DD2-400f-949F-AD00BDAB1D41)]
+interface IAccessibleHyperlink : IAccessibleAction
+{
+
+ /** @brief Returns an object that represents the link anchor, as appropriate
+ for the link at the specified index.
+ @param [in] index
+ A 0 based index identifies the anchor when, as in the case of an image map,
+ there is more than one link represented by this object. The valid maximal
+ index is indicated by IAccessibleAction::nActions.
+ @param [out] anchor
+ This is an implementation dependent value. For example, for a text link this
+ method could return the substring of the containing string where the substring
+ is overridden with link behavior, and for an image link this method could return
+ an IUnknown VARIANT for IAccessibleImage. See the section about
+ @ref _variants "VARIANTs" for additional information.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT anchor
+ (
+ [in] long index,
+ [out, retval] VARIANT *anchor
+ );
+
+ /** @brief Returns an object representing the target of the link, as appropriate
+ for the link at the specified index.
+ @param [in] index
+ A 0 based index identifies the anchor when, as in the case of an image map,
+ there is more than one link represented by this object. The valid maximal
+ index is indicated by IAccessibleAction::nActions.
+ @param [out] anchorTarget
+ This is an implementation dependent value. For example this method could
+ return a BSTR VARIANT of the URI. Alternatively this method could return an
+ IUnknown VARIANT of a COM interface representing a target object to be
+ activated when the link is activated. See the section about
+ @ref _variants "VARIANTs" for additional information.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT anchorTarget
+ (
+ [in] long index,
+ [out, retval] VARIANT *anchorTarget
+ );
+
+ /** @brief Returns the 0 based character offset at which the textual representation of the hyperlink starts.
+
+ The returned value is related to the IAccessibleText interface of the object that
+ owns this hyperlink.
+ @param [out] index
+ @retval S_OK
+ */
+ [propget] HRESULT startIndex
+ (
+ [out, retval] long *index
+ );
+
+ /** @brief Returns the 0 based character offset at which the textual representation of the hyperlink ends.
+
+ The returned value is related to the IAccessibleText interface of the object that
+ owns this hyperlink. The character at the index is not part of the hypertext.
+ @param [out] index
+ @retval S_OK
+ */
+ [propget] HRESULT endIndex
+ (
+ [out, retval] long *index
+ );
+
+ /** @brief Returns whether the target object referenced by this link is still valid.
+
+ This is a volatile state that may change without sending an appropriate event.
+ Returns TRUE if the referenced target is still valid and FALSE otherwise.
+
+ This has also been used to indicate whether or not the URI of the anchorTarget
+ is malformed.
+
+ @param [out] valid
+ If false, one or more of the object's links are invalid.
+ If true, all of the object's links are valid.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is FALSE
+ @note This method is not being used, is deprecated, and should not be implemented or
+ used. It is likely that this method will be removed in a later version of the IDL.
+ */
+ [propget] HRESULT valid
+ (
+ [out, retval] boolean *valid
+ );
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleHypertext.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2010 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+
+/** @brief This interface exposes information about hypertext in a document.
+
+ The %IAccessibleHypertext interface is the main interface to expose
+ hyperlinks in a document, typically a text document, that are used
+ to reference other documents. A typical implementation is to implement
+ this interface on the smallest text object such as a paragraph of text.
+*/
+[object, uuid(6B4F8BBF-F1F2-418a-B35E-A195BC4103B9)]
+interface IAccessibleHypertext : IAccessibleText
+{
+
+ /** @brief Returns the number of links and link groups contained within this hypertext
+ paragraph.
+ @param [out] hyperlinkCount
+ The number of links and link groups within this hypertext paragraph.
+ Returns 0 if there is no link.
+ @retval S_OK
+ */
+ [propget] HRESULT nHyperlinks
+ (
+ [out, retval] long *hyperlinkCount
+ );
+
+ /** @brief Returns the specified link.
+
+ The returned IAccessibleHyperlink object encapsulates the hyperlink and
+ provides several kinds of information describing it.
+ @param [in] index
+ This 0 based index specifies the hyperlink to return.
+ @param [out] hyperlink
+ If the given index is valid, i.e. lies in the interval from 0 to the number
+ of links minus one, a reference to the specified hyperlink object is returned.
+ If the index is invalid then a NULL pointer is returned.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT hyperlink
+ (
+ [in] long index,
+ [out, retval] IAccessibleHyperlink **hyperlink
+ );
+
+ /** @brief Returns the index of the hyperlink that is associated with this character index.
+
+ This is the case when a link spans the given character index.
+ @param [in] charIndex
+ A 0 based index of the character for which to return the link index. If
+ IAccessibleText is used to represent the text containing the link, then the
+ character index is only valid if it is greater than or equal to zero and
+ lower than the number of characters in the text.
+ @param [out] hyperlinkIndex
+ Returns the 0 based index of the hyperlink that is associated with this
+ character index, or -1 if charIndex is not on a link.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is -1
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT hyperlinkIndex
+ (
+ [in] long charIndex,
+ [out, retval] long *hyperlinkIndex
+ );
+
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleHypertext2.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+
+/** @brief This interface exposes information about hypertext in a document.
+
+ The %IAccessibleHypertext2 interface extends the functinality of the
+ %IAccessibleHypertext inteface.
+*/
+[object, uuid(CF64D89F-8287-4B44-8501-A827453A6077)]
+interface IAccessibleHypertext2 : IAccessibleHypertext
+{
+
+ /** @brief Returns the links for this object.
+
+ The returned IAccessibleHyperlink objects encapsulate the hyperlink and
+ provides several kinds of information describing it.
+
+ @param [out] hyperlinks
+ This array is allocated by the server. The client must free it with CoTaskMemFree.
+ @param [out] nHyperlinks
+ The number of links returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are no links, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT hyperlinks
+ (
+ [out, size_is(,*nHyperlinks)] IAccessibleHyperlink ***hyperlinks,
+ [out, retval] long *nHyperlinks
+ );
+
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleTable.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+
+/** @brief This interface gives access to a two-dimensional table.
+
+ Typically all accessible objects that represent cells or cell-clusters of a table
+ will be at the same time children of the table. In this case IAccessible2::indexInParent
+ will return the child index which then can be used when calling IAccessibleTable::rowIndex
+ and IAccessibleTable::columnIndex.
+
+ However, in some cases that kind of implementation will not be possible. When
+ the table cells are not direct children of a table, the object representing
+ the cell can define a "table-cell-index" object attribute identifying the 0
+ based table cell index. This object attribute is obtained by parsing the
+ attribute string returned by IAccessible2::attributes. The "table-cell-index"
+ attribute can be used just like a child index of the typical case. ATs should
+ first test for the presence of the "table-cell-index" attribute and if it is not
+ present then IAccessible2::indexInParent can be used as in the typical case
+ where cells are direct children of the table.
+
+ The range of valid coordinates for this interface are implementation dependent.
+ However, that range includes at least the intervals from the from the first row
+ or column with the index 0 up to the last (but not including) used row or column
+ as returned by IAccessibleTable::nRows and IAccessibleTable::nColumns.
+
+ Note that newer implementations are now using IAccessibleTable2 and IAccessibleTableCell
+ rather than this interface.
+*/
+[object, uuid(35AD8070-C20C-4fb4-B094-F4F7275DD469)]
+interface IAccessibleTable : IUnknown
+{
+
+ /** @brief Returns the accessible object at the specified row and column in
+ the table. This object could be an IAccessible or an IAccessible2.
+ @param [in] row
+ The 0 based row index for which to retrieve the cell.
+ @param [in] column
+ The 0 based column index for which to retrieve the cell.
+ @param [out] accessible
+ If both row and column index are valid then the corresponding accessible
+ object is returned that represents the requested cell regardless of whether
+ the cell is currently visible (on the screen).
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, [out] value is NULL
+ */
+ [propget] HRESULT accessibleAt
+ (
+ [in] long row,
+ [in] long column,
+ [out, retval] IUnknown **accessible
+ );
+
+ /** @brief Returns the caption for the table. The returned object could be
+ an IAccessible or an IAccessible2.
+ @param [out] accessible
+ If the table has a caption then a reference to it is returned, else a NULL
+ pointer is returned.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT caption
+ (
+ [out, retval] IUnknown **accessible
+ );
+
+ /** @brief Translates the given row and column indexes into the corresponding cell index.
+ @param [in] rowIndex
+ 0 based row index for the cell.
+ @param [in] columnIndex
+ 0 based column index for the cell.
+ @param [out] cellIndex
+ Returns the 0 based index of the cell at the specified row and column indexes.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, [out] value is 0
+ @note The returned value is not necessarily a child index of the immediate parent.
+ In cases where the table cells are not direct children of the table the index
+ is actually the cell index, i.e. conceptually it's an index into a one dimensional
+ array of cells laid out in row order.
+ */
+ [propget] HRESULT childIndex
+ (
+ [in] long rowIndex,
+ [in] long columnIndex,
+ [out, retval] long *cellIndex
+ );
+
+ /** @brief Returns the description text of the specified column in the table.
+ @param [in] column
+ The 0 based index of the column for which to retrieve the description.
+ @param [out] description
+ Returns the description text of the specified column in the table if such a
+ description exists. Otherwise a NULL pointer is returned.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ @retval E_INVALIDARG if bad [in] passed, [out] value is NULL
+ */
+ [propget] HRESULT columnDescription
+ (
+ [in] long column,
+ [out, retval] BSTR *description
+ );
+
+ /** @brief Returns the number of columns occupied by the accessible object
+ at the specified row and column in the table.
+
+ The result is greater than 1 if the specified cell spans multiple columns.
+ @param [in] row
+ 0 based row index of the accessible for which to return the column extent.
+ @param [in] column
+ 0 based column index of the accessible for which to return the column extent.
+ @param [out] nColumnsSpanned
+ Returns the 1 based column extent of the specified cell.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, [out] value is 0
+ */
+ [propget] HRESULT columnExtentAt
+ (
+ [in] long row,
+ [in] long column,
+ [out, retval] long *nColumnsSpanned
+ );
+
+ /** @brief Returns the column headers as an %IAccessibleTable object.
+
+ Content and size of the returned table are implementation dependent.
+ @param [out] accessibleTable
+ The column header
+ @param [out] startingRowIndex
+ The 0 based row index where the header starts, usually 0.
+ @retval S_OK
+ @retval S_FALSE if there is no header, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT columnHeader
+ (
+ [out] IAccessibleTable **accessibleTable,
+ [out, retval] long *startingRowIndex
+ );
+
+ /** @brief Translates the given cell index into the corresponding column index.
+ @param [in] cellIndex
+ 0 based index of the cell in the parent or closest ancestor table. Typically this
+ is the value returned from IAccessible2::indexInParent, but in the case where the
+ table cells are not direct children of the table this is the cell index specified
+ by the "table-cell-index" object attribute obtained from parsing the attributes
+ string returned by calling IAccessible2::attributes on the cell object.
+ @param [out] columnIndex
+ Returns the 0 based column index of the cell of the specified child or the index of
+ the first column if the child spans multiple columns.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, [out] value is 0
+ */
+ [propget] HRESULT columnIndex
+ (
+ [in] long cellIndex,
+ [out, retval] long *columnIndex
+ );
+
+ /** @brief Returns the total number of columns in table
+ @param [out] columnCount
+ Number of columns in table (including columns outside the current viewport)
+ @retval S_OK
+ */
+ [propget] HRESULT nColumns
+ (
+ [out, retval] long *columnCount
+ );
+
+ /** @brief Returns the total number of rows in table
+ @param [out] rowCount
+ Number of rows in table (including rows outside the current viewport)
+ @retval S_OK
+ */
+ [propget] HRESULT nRows
+ (
+ [out, retval] long *rowCount
+ );
+
+ /** @brief Returns the total number of selected cells
+ @param [out] cellCount
+ Number of cells currently selected
+ @retval S_OK
+ */
+ [propget] HRESULT nSelectedChildren
+ (
+ [out, retval] long *cellCount
+ );
+
+ /** @brief Returns the total number of selected columns
+ @param [out] columnCount
+ Number of columns currently selected
+ @retval S_OK
+ */
+ [propget] HRESULT nSelectedColumns
+ (
+ [out, retval] long *columnCount
+ );
+
+ /** @brief Returns the total number of selected rows
+ @param [out] rowCount
+ Number of rows currently selected
+ @retval S_OK
+ */
+ [propget] HRESULT nSelectedRows
+ (
+ [out, retval] long *rowCount
+ );
+
+ /** @brief Returns the description text of the specified row in the table.
+ @param [in] row
+ The 0 based index of the row for which to retrieve the description.
+ @param [out] description
+ Returns the description text of the specified row in the table if such a
+ description exists. Otherwise a NULL pointer is returned.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ @retval E_INVALIDARG if bad [in] passed, [out] value is NULL
+ */
+ [propget] HRESULT rowDescription
+ (
+ [in] long row,
+ [out, retval] BSTR *description
+ );
+
+ /** @brief Returns the number of rows occupied by the accessible object
+ at the specified row and column in the table.
+
+ The result is greater than 1 if the specified cell spans multiple rows.
+ @param [in] row
+ 0 based row index of the accessible for which to return the row extent.
+ @param [in] column
+ 0 based column index of the accessible for which to return the row extent.
+ @param [out] nRowsSpanned
+ Returns the row extent of the specified cell.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, [out] value is 0
+ */
+ [propget] HRESULT rowExtentAt
+ (
+ [in] long row,
+ [in] long column,
+ [out, retval] long *nRowsSpanned
+ );
+
+ /** @brief Returns the row headers as an %IAccessibleTable object.
+
+ Content and size of the returned table are implementation dependent.
+ @param [out] accessibleTable
+ The row header.
+ @param [out] startingColumnIndex
+ The 0 based column index where the header starts, usually 0.
+ @retval S_OK
+ @retval S_FALSE if there is no header, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT rowHeader
+ (
+ [out] IAccessibleTable **accessibleTable,
+ [out, retval] long *startingColumnIndex
+ );
+
+ /** @brief Translates the given cell index into a row index.
+ @param [in] cellIndex
+ 0 based index of the cell in the parent or closest ancestor table. Typically this
+ is the value returned from IAccessible2::indexInParent, but in the case where the
+ table cells are not direct children of the table this is the cell index specified
+ by the "table-cell-index" object attribute obtained from parsing the attributes
+ string returned by calling IAccessible2::attributes on the cell object.
+ @param [out] rowIndex
+ 0 based row index
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, [out] value is 0
+ */
+ [propget] HRESULT rowIndex
+ (
+ [in] long cellIndex,
+ [out, retval] long *rowIndex
+ );
+
+ /** @brief Returns a list of cell indexes currently selected (0 based).
+ @param [in] maxChildren
+ This parameter is ignored. Refer to @ref _arrayConsideration
+ "Special Consideration when using Arrays" for more details.
+ @param [out] children
+ An array of cell indexes of selected cells (each index is 0 based),
+ allocated by the server. The client must free it with CoTaskMemFree.
+ @param [out] nChildren
+ The number of cell indexes returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are none, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT selectedChildren
+ (
+ [in] long maxChildren,
+ [out, size_is(,maxChildren), length_is(,*nChildren)] long **children,
+ [out, retval] long *nChildren
+ );
+
+ /** @brief Returns a list of column indexes currently selected (0 based).
+ @param [in] maxColumns
+ This parameter is ignored. Refer to @ref _arrayConsideration
+ "Special Consideration when using Arrays" for more details.
+ @param [out] columns
+ An array of column indexes of selected columns (each index is 0 based), allocated
+ by the server. The client must free it with CoTaskMemFree.
+ @param [out] nColumns
+ The number of column indexes returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are none, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT selectedColumns
+ (
+ [in] long maxColumns,
+ [out, size_is(,maxColumns), length_is(,*nColumns)] long **columns,
+ [out, retval] long *nColumns
+ );
+
+ /** @brief Returns a list of row indexes currently selected (0 based).
+ @param [in] maxRows
+ This parameter is ignored. Refer to @ref _arrayConsideration
+ "Special Consideration when using Arrays" for more details.
+ @param [out] rows
+ An array of row indexes of selected rows (each index is 0 based), allocated
+ by the server. The client must free it with CoTaskMemFree.
+ @param [out] nRows
+ The number of row indexes returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are none, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT selectedRows
+ (
+ [in] long maxRows,
+ [out, size_is(,maxRows), length_is(,*nRows)] long **rows,
+ [out, retval] long *nRows
+ );
+
+ /** @brief Returns the summary description of the table. The returned object could be
+ an IAccessible or an IAccessible2.
+ @param [out] accessible
+ Returns a reference to an implementation dependent accessible object
+ representing the table's summary or a NULL pointer if the table
+ does not support a summary.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT summary
+ (
+ [out, retval] IUnknown **accessible
+ );
+
+ /** @brief Returns a boolean value indicating whether the specified column is
+ completely selected.
+ @param [in] column
+ 0 based index of the column for which to determine whether it is selected.
+ @param [out] isSelected
+ Returns TRUE if the specified column is selected completely and FALSE otherwise.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, [out] value is FALSE
+ */
+ [propget] HRESULT isColumnSelected
+ (
+ [in] long column,
+ [out, retval] boolean *isSelected
+ );
+
+ /** @brief Returns a boolean value indicating whether the specified row is completely
+ selected.
+ @param [in] row
+ 0 based index of the row for which to determine whether it is selected.
+ @param [out] isSelected
+ Returns TRUE if the specified row is selected completely and FALSE otherwise.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, [out] value is FALSE
+ */
+ [propget] HRESULT isRowSelected
+ (
+ [in] long row,
+ [out, retval] boolean *isSelected
+ );
+
+ /** @brief Returns a boolean value indicating whether the specified cell is selected.
+ @param [in] row
+ 0 based index of the row for the cell to determine whether it is selected.
+ @param [in] column
+ 0 based index of the column for the cell to determine whether it is selected.
+ @param [out] isSelected
+ Returns TRUE if the specified cell is selected and FALSE otherwise.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, [out] value is FALSE
+ */
+ [propget] HRESULT isSelected
+ (
+ [in] long row,
+ [in] long column,
+ [out, retval] boolean *isSelected
+ );
+
+ /** @brief Selects a row and unselects all previously selected rows.
+ @param [in] row
+ 0 based index of the row to be selected.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT selectRow
+ (
+ [in] long row
+ );
+
+ /** @brief Selects a column and unselects all previously selected columns.
+ @param [in] column
+ 0 based index of the column to be selected.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT selectColumn
+ (
+ [in] long column
+ );
+
+ /** @brief Unselects one row, leaving other selected rows selected (if any).
+ @param [in] row
+ 0 based index of the row to be unselected.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT unselectRow
+ (
+ [in] long row
+ );
+
+ /** @brief Unselects one column, leaving other selected columns selected (if any).
+ @param [in] column
+ 0 based index of the column to be unselected.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT unselectColumn
+ (
+ [in] long column
+ );
+
+ /** @brief Given a cell index, gets the row and column indexes and extents of a cell
+ and whether or not it is selected.
+
+ This is a convenience function. It is not mandatory to implement it.
+ @param [in] index
+ 0 based index of this cell in the table.
+ @param [out] row
+ 0 based row index.
+ @param [out] column
+ 0 based column index.
+ @param [out] rowExtents
+ Number of cells spanned by this cell in this row.
+ @param [out] columnExtents
+ Number of cells spanned by this cell in this column.
+ @param [out] isSelected
+ Indicates if the specified cell is selected.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed, [out] values are 0s and FALSE respectively
+ */
+ [propget] HRESULT rowColumnExtentsAtIndex
+ (
+ [in] long index,
+ [out] long *row,
+ [out] long *column,
+ [out] long *rowExtents,
+ [out] long *columnExtents,
+ [out, retval] boolean *isSelected
+ );
+
+ /** @brief Returns the type and extents describing how a table changed.
+
+ Provided for use by the IA2_EVENT_TABLE_MODEL_CHANGED event handler.
+
+ This data is only guaranteed to be valid while the thread notifying the event
+ continues. Once the handler has returned, the validity of the data depends on
+ how the server manages the life cycle of its objects. Also, note that the server
+ may have different life cycle management strategies for controls depending on
+ whether or not a control manages its children. Lists, trees, and tables can have
+ a large number of children and thus it's possible that the child objects for those
+ controls would only be created as needed. Servers should document their life cycle
+ strategy as this will be of interest to assistive technology or script engines
+ accessing data out of process or from other threads. Servers only need to save the
+ most recent row and column values associated with the change and a scope of the
+ entire application is adequate.
+
+ @param [out] modelChange
+ A struct of (type(insert, delete, update), firstRow, lastRow, firstColumn, lastColumn).
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT modelChange
+ (
+ [out, retval] IA2TableModelChange *modelChange
+ );
+
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleTable2.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2012 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+
+/** @brief This interface gives access to a two-dimensional table.
+
+ Please also refer to the IAccessibleTableCell interface.
+
+ If you want to support older applications you should also support the
+ IAccessibleTable inteface.
+*/
+[object, uuid(6167f295-06f0-4cdd-a1fa-02e25153d869)]
+interface IAccessibleTable2 : IUnknown
+{
+
+ /** @brief Returns the accessible object at the specified row and column in
+ the table. This object could be an IAccessible or an IAccessible2.
+ @param [in] row
+ The 0 based row index for which to retrieve the cell.
+ @param [in] column
+ The 0 based column index for which to retrieve the cell.
+ @param [out] cell
+ If both row and column index are valid then the corresponding accessible
+ object is returned that represents the requested cell regardless of whether
+ the cell is currently visible (on the screen).
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT cellAt
+ (
+ [in] long row,
+ [in] long column,
+ [out, retval] IUnknown **cell
+ );
+
+ /** @brief Returns the caption for the table. The returned object could be
+ an IAccessible or an IAccessible2.
+ @param [out] accessible
+ If the table has a caption then a reference to it is returned, else a NULL
+ pointer is returned.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ @deprecated use a describedBy relation
+ */
+ [propget] HRESULT caption
+ (
+ [out, retval] IUnknown **accessible
+ );
+
+ /** @brief Returns the description text of the specified column in the table.
+ @param [in] column
+ The 0 based index of the column for which to retrieve the description.
+ @param [out] description
+ Returns the description text of the specified column in the table if such a
+ description exists. Otherwise a NULL pointer is returned.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT columnDescription
+ (
+ [in] long column,
+ [out, retval] BSTR *description
+ );
+
+
+ /** @brief Returns the total number of columns in table
+ @param [out] columnCount
+ Number of columns in table (including columns outside the current viewport)
+ @retval S_OK
+ */
+ [propget] HRESULT nColumns
+ (
+ [out, retval] long *columnCount
+ );
+
+ /** @brief Returns the total number of rows in table
+ @param [out] rowCount
+ Number of rows in table (including rows outside the current viewport)
+ @retval S_OK
+ */
+ [propget] HRESULT nRows
+ (
+ [out, retval] long *rowCount
+ );
+
+ /** @brief Returns the total number of selected cells
+ @param [out] cellCount
+ Number of cells currently selected
+ @retval S_OK
+ */
+ [propget] HRESULT nSelectedCells
+ (
+ [out, retval] long *cellCount
+ );
+
+ /** @brief Returns the total number of selected columns
+ @param [out] columnCount
+ Number of columns currently selected
+ @retval S_OK
+ */
+ [propget] HRESULT nSelectedColumns
+ (
+ [out, retval] long *columnCount
+ );
+
+ /** @brief Returns the total number of selected rows
+ @param [out] rowCount
+ Number of rows currently selected
+ @retval S_OK
+ */
+ [propget] HRESULT nSelectedRows
+ (
+ [out, retval] long *rowCount
+ );
+
+ /** @brief Returns the description text of the specified row in the table.
+ @param [in] row
+ The 0 based index of the row for which to retrieve the description.
+ @param [out] description
+ Returns the description text of the specified row in the table if such a
+ description exists. Otherwise a NULL pointer is returned.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT rowDescription
+ (
+ [in] long row,
+ [out, retval] BSTR *description
+ );
+
+ /** @brief Returns a list of accessibles currently selected.
+ @param [out] cells
+ Pointer to an array of references to selected accessibles. The array is
+ allocated by the server with CoTaskMemAlloc and freed by the client with
+ CoTaskMemFree.
+ @param [out] nSelectedCells
+ The number of accessibles returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are none, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT selectedCells
+ (
+ [out, size_is(,*nSelectedCells)] IUnknown ***cells,
+ [out, retval] long *nSelectedCells
+ );
+
+ /** @brief Returns a list of column indexes currently selected (0 based).
+ @param [out] selectedColumns
+ A pointer to an array of column indexes of selected columns (each index is
+ 0 based). The array is allocated by the server with CoTaskMemAlloc and
+ freed by the client with CoTaskMemFree.
+ @param [out] nColumns
+ The number of column indexes returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are none, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT selectedColumns
+ (
+ [out, size_is(,*nColumns)] long **selectedColumns,
+ [out, retval] long *nColumns
+ );
+
+ /** @brief Returns a list of row indexes currently selected (0 based).
+ @param [out] selectedRows
+ An array of row indexes of selected rows (each index is 0 based). The array
+ is allocated by the server with CoTaskMemAlloc and freed by the client with
+ CoTaskMemFree.
+ @param [out] nRows
+ The number of row indexes returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there are none, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT selectedRows
+ (
+ [out, size_is(,*nRows)] long **selectedRows,
+ [out, retval] long *nRows
+ );
+
+ /** @brief Returns the summary description of the table. The returned object could be
+ an IAccessible or an IAccessible2.
+ @param [out] accessible
+ Returns a reference to an implementation dependent accessible object
+ representing the table's summary or a NULL pointer if the table
+ does not support a summary.
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ @deprecated Use the labeledBy relation
+ */
+ [propget] HRESULT summary
+ (
+ [out, retval] IUnknown **accessible
+ );
+
+ /** @brief Returns a boolean value indicating whether the specified column is
+ completely selected.
+ @param [in] column
+ 0 based index of the column for which to determine whether it is selected.
+ @param [out] isSelected
+ Returns TRUE if the specified column is selected completely and FALSE otherwise.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT isColumnSelected
+ (
+ [in] long column,
+ [out, retval] boolean *isSelected
+ );
+
+ /** @brief Returns a boolean value indicating whether the specified row is completely
+ selected.
+ @param [in] row
+ 0 based index of the row for which to determine whether it is selected.
+ @param [out] isSelected
+ Returns TRUE if the specified row is selected completely and FALSE otherwise.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ [propget] HRESULT isRowSelected
+ (
+ [in] long row,
+ [out, retval] boolean *isSelected
+ );
+
+ /** @brief Selects a row and unselects all previously selected rows.
+
+ The behavior should mimic that of the application, but for those applications
+ which do not have a means in the GUI to select a full row of cells the behavior
+ should be as follows: First any selected rows in the table are unselected. Then
+ the entire row of cells for the specified row is selected. If any of the
+ cells in the selected row span additional rows, the cells in those rows
+ are also selected.
+ @param [in] row
+ 0 based index of the row to be selected.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT selectRow
+ (
+ [in] long row
+ );
+
+ /** @brief Selects a column and unselects all previously selected columns.
+
+ The behavior should mimic that of the application, but for those applications
+ which do not have a means in the GUI to select a full column of cells the behavior
+ should be as follows: First any selected columns in the table are unselected. Then
+ the entire column of cells for the specified column is selected. If any of the
+ cells in the selected column span additional columns, the cells in those columns
+ are also selected.
+ @param [in] column
+ 0 based index of the column to be selected.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT selectColumn
+ (
+ [in] long column
+ );
+
+ /** @brief Unselects one row, leaving other selected rows selected (if any).
+
+ The behavior should mimic that of the application, but for those applications
+ which do not have a means in the GUI to unselect a full row of cells the
+ behavior should be as follows: The entire row of cells for the specified
+ row is unselected. If any of the cells in the selected row span additional
+ rows, the cells in those rows are also unselected.
+ @param [in] row
+ 0 based index of the row to be unselected.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT unselectRow
+ (
+ [in] long row
+ );
+
+ /** @brief Unselects one column, leaving other selected columns selected (if any).
+
+ The behavior should mimic that of the application, but for those applications
+ which do not have a means in the GUI to unselect a full column of cells the
+ behavior should be as follows: The entire column of cells for the specified
+ column is unselected. If any of the cells in the selected column span additional
+ columns, the cells in those columns are also unselected.
+ @param [in] column
+ 0 based index of the column to be unselected.
+ @retval S_OK
+ @retval E_INVALIDARG if bad [in] passed
+ */
+ HRESULT unselectColumn
+ (
+ [in] long column
+ );
+
+ /** @brief Returns the type and extents describing how a table changed.
+
+ Provided for use by the IA2_EVENT_TABLE_MODEL_CHANGED event handler.
+
+ This data is only guaranteed to be valid while the thread notifying the event
+ continues. Once the handler has returned, the validity of the data depends on
+ how the server manages the life cycle of its objects. Also, note that the server
+ may have different life cycle management strategies for controls depending on
+ whether or not a control manages its children. Lists, trees, and tables can have
+ a large number of children and thus it's possible that the child objects for those
+ controls would only be created as needed. Servers should document their life cycle
+ strategy as this will be of interest to assistive technology or script engines
+ accessing data out of process or from other threads. Servers only need to save the
+ most recent row and column values associated with the change and a scope of the
+ entire application is adequate.
+
+ @param [out] modelChange
+ A struct of (type(insert, delete, update), firstRow, lastRow, firstColumn, lastColumn).
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT modelChange
+ (
+ [out, retval] IA2TableModelChange *modelChange
+ );
+
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleTableCell.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2013 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+/** @brief This interface gives access to the cells of a two-dimensional table.
+
+ Please also refer to the IAccessibleTable2 interface.
+
+*/
+[object, uuid(594116B1-C99F-4847-AD06-0A7A86ECE645)]
+interface IAccessibleTableCell : IUnknown
+{
+
+ /** @brief Returns the number of columns occupied by this cell accessible.
+
+ The result is greater than 1 if the specified cell spans multiple columns.
+ @param [out] nColumnsSpanned
+ Returns the 1 based column extent of the specified cell.
+ @retval S_OK
+ */
+ [propget] HRESULT columnExtent
+ (
+ [out, retval] long *nColumnsSpanned
+ );
+
+ /** @brief Returns the column headers as an array of cell accessibles.
+
+ @param [out] cellAccessibles
+ Pointer to an array of references to cell accessibles. The array is allocated
+ by the server. The client must free it with CoTaskMemFree.
+ @param [out] nColumnHeaderCells
+ The number of accessibles returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there is no header, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT columnHeaderCells
+ (
+ [out, size_is(,*nColumnHeaderCells)] IUnknown ***cellAccessibles,
+ [out, retval] long *nColumnHeaderCells
+ );
+
+ /** @brief Translates this cell accessible into the corresponding column index.
+
+ @param [out] columnIndex
+ Returns the 0 based column index of the cell of the specified cell or the index of
+ the first column if the cell spans multiple columns.
+ @retval S_OK
+ */
+ [propget] HRESULT columnIndex
+ (
+ [out, retval] long *columnIndex
+ );
+
+ /** @brief Returns the number of rows occupied by this cell accessible.
+
+ @param [out] nRowsSpanned
+ Returns the row extent of the specified cell.
+ @retval S_OK
+ */
+ [propget] HRESULT rowExtent
+ (
+ [out, retval] long *nRowsSpanned
+ );
+
+ /** @brief Returns the row headers as an array of cell accessibles.
+
+ @param [out] cellAccessibles
+ Pointer to an array of references to cell accessibles. The array is allocated
+ by the server. The client must free it with CoTaskMemFree.
+ @param [out] nRowHeaderCells
+ The number of accessibles returned; the size of the returned array.
+ @retval S_OK
+ @retval S_FALSE if there is no header, [out] values are NULL and 0 respectively
+ */
+ [propget] HRESULT rowHeaderCells
+ (
+ [out, size_is(,*nRowHeaderCells)] IUnknown ***cellAccessibles,
+ [out, retval] long *nRowHeaderCells
+ );
+
+ /** @brief Translates this cell accessible into the corresponding row index.
+
+ @param [out] rowIndex
+ Returns the 0 based row index of the specified cell or the index of
+ the first row if the cell spans multiple rows.
+ @retval S_OK
+ */
+ [propget] HRESULT rowIndex
+ (
+ [out, retval] long *rowIndex
+ );
+
+ /** @brief Returns a boolean value indicating whether this cell is selected.
+
+ @param [out] isSelected
+ Returns TRUE if the specified cell is selected and FALSE otherwise.
+ @retval S_OK
+ */
+ [propget] HRESULT isSelected
+ (
+ [out, retval] boolean *isSelected
+ );
+
+ /** @brief Gets the row and column indexes and extents of this cell accessible
+ and whether or not it is selected.
+
+ This is a convenience function. It is not mandatory to implement it.
+ @param [out] row
+ 0 based row index.
+ @param [out] column
+ 0 based column index.
+ @param [out] rowExtents
+ Number of cells spanned by this cell in this row.
+ @param [out] columnExtents
+ Number of cells spanned by this cell in this column.
+ @param [out] isSelected
+ Indicates if the specified cell is selected.
+ @retval S_OK
+ */
+ [propget] HRESULT rowColumnExtents
+ (
+ [out] long *row,
+ [out] long *column,
+ [out] long *rowExtents,
+ [out] long *columnExtents,
+ [out, retval] boolean *isSelected
+ );
+
+ /** @brief Returns a reference to the accessbile of the containing table.
+
+ @param [out] table
+ Returns a reference to the IUnknown of the containing table.
+ @retval S_OK
+ */
+ [propget] HRESULT table
+ (
+ [out, retval] IUnknown **table
+ );
+
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleImage.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2010 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+/** @brief This interface represents images and icons.
+
+ This interface is used for a representation of images like icons on buttons.
+ %IAccessibleImage only needs to be implemented in certain situations. Some
+ examples are:
+ <ol>
+ <li>The accessible name and description are not enough to fully
+ describe the image, e.g. when the accessible description is used to define the
+ behavior of an actionable image and the image itself conveys semantically
+ significant information.
+ <li>The user can edit the content that includes an
+ image and therefore the user needs to be able to review the image's position.
+ </ol>
+*/
+[object, uuid(FE5ABB3D-615E-4f7b-909F-5F0EDA9E8DDE)]
+interface IAccessibleImage : IUnknown
+{
+ /** @brief Returns the localized description of the image.
+ @param [out] description
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT description
+ (
+ [out, retval] BSTR *description
+ );
+
+ /** @brief Returns the coordinates of the image.
+ @param [in] coordinateType
+ Specifies whether the returned coordinates should be relative to the screen or the parent object.
+ @param [out] x
+ @param [out] y
+ @retval S_OK
+ */
+ [propget] HRESULT imagePosition
+ (
+ [in] enum IA2CoordinateType coordinateType,
+ [out] long *x,
+ [out, retval] long *y
+ );
+
+ /** @brief Returns the size of the image in units specified by parent's coordinate system.
+ @param [out] height
+ @param [out] width
+ @retval S_OK
+ */
+
+ [propget] HRESULT imageSize
+ (
+ [out] long *height,
+ [out, retval] long *width
+ );
+}
+/*************************************************************************
+ *
+ * File Name (AccessibleEventID.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2010 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+/** %IAccessible2 specific event constants
+
+ This enum defines the event IDs fired by %IAccessible2 objects. The event IDs
+ are in addition to those used by MSAA.
+*/
+enum IA2EventID {
+
+ /** The change of the number or attributes of actions of an accessible
+ object is signaled by events of this type.
+ */
+ IA2_EVENT_ACTION_CHANGED = 0x101,
+
+ /** <b>Deprecated.</b> The active descendant of a component has changed.
+
+ Note: This event constant is misspelled and thus is deprecated and will be
+ removed in a later version. Please use the correctly spelled version which
+ follows.
+ */
+ IA2_EVENT_ACTIVE_DECENDENT_CHANGED,
+
+ /** The active descendant of a component has changed. The active descendant
+ is used in objects with transient children.
+
+ Note: Due to the fact that MSAA's WinEvents don't allow the active child index
+ to be passed on the IA2_EVENT_ACTIVE_DESCENDANT_CHANGED event the manages
+ descendants scheme can't be used. Instead the active child object has to fire
+ MSAA's EVENT_OBJECT_FOCUS. In a future release a new event mechanism may be
+ added to provide for event specific data to be passed with the event. At that
+ time the IA2_EVENT_ACTIVE_DECENDENT_CHANGED event and
+ IA2_STATE_MANAGES_DESCENDANTS state would be useful.
+ */
+ IA2_EVENT_ACTIVE_DESCENDANT_CHANGED = IA2_EVENT_ACTIVE_DECENDENT_CHANGED,
+
+ /** The document wide attributes of the document object have changed.
+ */
+ IA2_EVENT_DOCUMENT_ATTRIBUTE_CHANGED,
+
+ /** The contents of the document have changed.
+ */
+ IA2_EVENT_DOCUMENT_CONTENT_CHANGED,
+
+ /** The loading of the document has completed.
+ */
+ IA2_EVENT_DOCUMENT_LOAD_COMPLETE,
+
+ /** The loading of the document was interrupted.
+ */
+ IA2_EVENT_DOCUMENT_LOAD_STOPPED,
+
+ /** The document contents are being reloaded.
+ */
+ IA2_EVENT_DOCUMENT_RELOAD,
+
+ /** The ending index of this link within the containing string has changed.
+ */
+ IA2_EVENT_HYPERLINK_END_INDEX_CHANGED,
+
+ /** The number of anchors associated with this hyperlink object has changed.
+ */
+ IA2_EVENT_HYPERLINK_NUMBER_OF_ANCHORS_CHANGED,
+
+ /** The hyperlink selected state changed from selected to unselected or
+ from unselected to selected.
+ */
+ IA2_EVENT_HYPERLINK_SELECTED_LINK_CHANGED,
+
+ /** One of the links associated with the hypertext object has been activated.
+ */
+ IA2_EVENT_HYPERTEXT_LINK_ACTIVATED,
+
+ /** One of the links associated with the hypertext object has been selected.
+ */
+ IA2_EVENT_HYPERTEXT_LINK_SELECTED,
+
+ /** The starting index of this link within the containing string has changed.
+ */
+ IA2_EVENT_HYPERLINK_START_INDEX_CHANGED,
+
+ /** Focus has changed from one hypertext object to another, or focus moved
+ from a non-hypertext object to a hypertext object, or focus moved from a
+ hypertext object to a non-hypertext object.
+ */
+ IA2_EVENT_HYPERTEXT_CHANGED,
+
+ /** The number of hyperlinks associated with a hypertext object changed
+ */
+ IA2_EVENT_HYPERTEXT_NLINKS_CHANGED,
+
+ /** An object's attributes changed.
+ Also see ::IA2_EVENT_TEXT_ATTRIBUTE_CHANGED.
+ */
+ IA2_EVENT_OBJECT_ATTRIBUTE_CHANGED,
+
+ /** A slide changed in a presentation document or a page boundary was
+ crossed in a word processing document.
+ */
+ IA2_EVENT_PAGE_CHANGED,
+
+ /** The caret moved from one section to the next.
+ */
+ IA2_EVENT_SECTION_CHANGED,
+
+ /** A table caption changed.
+ */
+ IA2_EVENT_TABLE_CAPTION_CHANGED,
+
+ /** A table's column description changed.
+ */
+ IA2_EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED,
+
+ /** A table's column header changed.
+ */
+ IA2_EVENT_TABLE_COLUMN_HEADER_CHANGED,
+
+ /** A table's data changed.
+ */
+ IA2_EVENT_TABLE_MODEL_CHANGED,
+
+ /** A table's row description changed.
+ */
+ IA2_EVENT_TABLE_ROW_DESCRIPTION_CHANGED,
+
+ /** A table's row header changed.
+ */
+ IA2_EVENT_TABLE_ROW_HEADER_CHANGED,
+
+ /** A table's summary changed.
+ */
+ IA2_EVENT_TABLE_SUMMARY_CHANGED,
+
+ /** A text object's attributes changed.
+ Also see ::IA2_EVENT_OBJECT_ATTRIBUTE_CHANGED.
+ */
+ IA2_EVENT_TEXT_ATTRIBUTE_CHANGED,
+
+ /** The caret has moved to a new position.
+ */
+ IA2_EVENT_TEXT_CARET_MOVED,
+
+ /** <b>Deprecated.</b> This event is equivalent to ::IA2_EVENT_TEXT_UPDATED.
+ */
+ IA2_EVENT_TEXT_CHANGED,
+
+ /** The caret moved from one column to the next.
+ */
+ IA2_EVENT_TEXT_COLUMN_CHANGED,
+
+ /** Text was inserted.
+ */
+ IA2_EVENT_TEXT_INSERTED,
+
+ /** Text was removed.
+ */
+ IA2_EVENT_TEXT_REMOVED,
+
+ /** This event indicates general text changes, i.e. changes to text that are
+ exposed through the IAccessibleText interface. For compatibility with ATK/AT-SPI
+ which does not have an equivalent event, servers can alternatively fire
+ ::IA2_EVENT_TEXT_REMOVED and ::IA2_EVENT_TEXT_INSERTED.
+ */
+ IA2_EVENT_TEXT_UPDATED,
+
+ /** The text selection changed. Later versions of Microsoft development environments
+ have an equivalent event identified, EVENT_OBJECT_TEXTSELECTIONCHANGED. Servers
+ should use that if it is available and use IA2_EVENT_TEXT_SELECTION_CHANGED otherwise.
+ Clients should be prepared to respond to either event.
+
+ */
+ IA2_EVENT_TEXT_SELECTION_CHANGED,
+
+ /** A visible data event indicates the change of the visual appearance
+ of an accessible object. This includes for example most of the
+ attributes available via the IAccessibleComponent interface.
+ */
+ IA2_EVENT_VISIBLE_DATA_CHANGED
+
+};
+/*************************************************************************
+ *
+ * File Name (AccessibleApplication.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2010 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+
+/** @brief This interface gives access to the application's name and version information.
+
+ This interface provides the AT with the information it needs to differentiate
+ this application from other applications, from other versions of this
+ application, or from other versions of this application running on different
+ versions of an accessibility bridge or accessibility toolkit.
+
+ Servers implementing IAccessible2 should provide access to the %IAccessibleApplication
+ interface via QueryService from any object so that ATs can easily determine specific
+ information about the application such as its name or version.
+*/
+[object, uuid(D49DED83-5B25-43F4-9B95-93B44595979E)]
+interface IAccessibleApplication : IUnknown
+{
+
+ /** @brief Returns the application name.
+ @param [out] name
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT appName
+ (
+ [out, retval] BSTR *name
+ );
+
+ /** @brief Returns the application version.
+ @param [out] version
+ The version string must not contain levels when it is know beforehand that
+ this information will never require a change in a client's behavior.
+ For example, use "3.6.0" rather than "3.6.0.v201005131500".
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT appVersion
+ (
+ [out, retval] BSTR *version
+ );
+
+ /** @brief Returns the toolkit/bridge name.
+ @param [out] name
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT toolkitName
+ (
+ [out, retval] BSTR *name
+ );
+
+ /** @brief Returns the toolkit/bridge version.
+ @param [out] version
+ The version string must not contain levels when it is know beforehand that
+ this information will never require a change in a client's behavior.
+ For example, use "3.6.0" rather than "3.6.0.v201005131500".
+ @retval S_OK
+ @retval S_FALSE if there is nothing to return, [out] value is NULL
+ */
+ [propget] HRESULT toolkitVersion
+ (
+ [out, retval] BSTR *version
+ );
+
+}
+
+/*************************************************************************
+ *
+ * File Name (AccessibleDocument.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2013 Linux Foundation
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+
+
+
+
+/** @brief This interface represents documents.
+
+ This interface is used for a representation of documents.
+*/
+[object, uuid(C48C7FCF-4AB5-4056-AFA6-902D6E1D1149)]
+interface IAccessibleDocument : IUnknown
+{
+ /** @brief Returns the most recently used anchor target within a document.
+
+ A document's most recently targeted in-page anchor is returned. A typical use
+ of this method is to fetch the anchor target within an HTML document. In this
+ case anchor targets are those which have been defined with the &lt;a&gt; tag.
+
+ @param [out] accessible
+ @retval S_OK
+ @retval S_FALSE if there are no existing valid anchor targets, [out] value is NULL.
+ */
+ [propget] HRESULT anchorTarget
+ (
+ [out, retval] IUnknown **accessible
+ );
+
+}
+/*************************************************************************
+ *
+ * File Name (IA2TypeLibrary.idl)
+ *
+ * IAccessible2 IDL Specification
+ *
+ * Copyright (c) 2007, 2012 Linux Foundation
+ * Copyright (c) 2006 IBM Corporation
+ * Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3. Neither the name of the Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This BSD License conforms to the Open Source Initiative "Simplified
+ * BSD License" as published at:
+ * http://www.opensource.org/licenses/bsd-license.php
+ *
+ * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2
+ * mark may be used in accordance with the Linux Foundation Trademark
+ * Policy to indicate compliance with the IAccessible2 specification.
+ *
+ ************************************************************************/
+
+// This is not a standalone file. It is to be appended to the end of the
+// merged IDL file.
+
+cpp_quote("")
+cpp_quote("// Type Library Definitions")
+cpp_quote("")
+
+[
+ uuid(CE3F726E-D1D3-44FE-B995-FF1DB3B48B2B),
+ helpstring("IAccessible2 Type Library"),
+ version(1.3),
+ hidden
+]
+
+library IAccessible2Lib
+{
+ importlib ("stdole2.tlb");
+ importlib ("oleacc.dll");
+ interface IAccessible2;
+ interface IAccessible2_2;
+ interface IAccessibleAction;
+ interface IAccessibleApplication;
+ interface IAccessibleComponent;
+ interface IAccessibleDocument;
+ interface IAccessibleEditableText;
+ interface IAccessibleHyperlink;
+ interface IAccessibleHypertext;
+ interface IAccessibleHypertext2;
+ interface IAccessibleImage;
+ interface IAccessibleRelation;
+ interface IAccessibleTable;
+ interface IAccessibleTable2;
+ interface IAccessibleTableCell;
+ interface IAccessibleText;
+ interface IAccessibleText2;
+ interface IAccessibleValue;
+ enum IA2CoordinateType;
+ enum IA2EventID;
+ enum IA2Role;
+ enum IA2ScrollType;
+ enum IA2States;
+ enum IA2TableModelChangeType;
+ enum IA2TextBoundaryType;
+ enum IA2TextSpecialOffsets;
+}
diff --git a/winaccessibility/source/service/AccComponentEventListener.cxx b/winaccessibility/source/service/AccComponentEventListener.cxx
new file mode 100644
index 000000000000..0f0343619766
--- /dev/null
+++ b/winaccessibility/source/service/AccComponentEventListener.cxx
@@ -0,0 +1,336 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccComponentEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccComponentEventListener::AccComponentEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccEventListener(pAcc, Agent)
+{
+}
+
+AccComponentEventListener::~AccComponentEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ *
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccComponentEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::VALUE_CHANGED:
+ handleValueChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::ACTION_CHANGED:
+ handleActionChangedEvent();
+ break;
+ case AccessibleEventId::TEXT_CHANGED:
+ handleTextChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::CARET_CHANGED:
+ handleCaretChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::VISIBLE_DATA_CHANGED:
+ handleVisibleDataChangedEvent();
+ break;
+ case AccessibleEventId::BOUNDRECT_CHANGED:
+ handleBoundrectChangedEvent();
+ break;
+ case AccessibleEventId::SELECTION_CHANGED:
+ handleSelectionChangedEvent();
+ break;
+ //to add TEXT_SELECTION_CHANGED event
+ case AccessibleEventId::TEXT_SELECTION_CHANGED:
+ handleTextSelectionChangedEvent();
+ break;
+ //End
+ default:
+ AccEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the VALUE_CHANGED event
+ *
+ * @param oldValue the old value of the source of event
+ * @param newValue the new value of the source of event
+ */
+void AccComponentEventListener::handleValueChangedEvent(Any oldValue, Any newValue)
+{
+ pAgent->UpdateValue(pAccessible);
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_VALUECHANGE, pAccessible);
+}
+
+/**
+ * handle the NAME_CHANGED event
+ */
+void AccComponentEventListener::handleActionChangedEvent()
+{
+ pAgent->UpdateAction(pAccessible);
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_DEFACTIONCHANGE, pAccessible);
+}
+
+/**
+ * handle the TEXT_CHANGED event
+ *
+ * @param oldValue the old value of the source of event
+ * @param newValue the new value of the source of event
+ */
+void AccComponentEventListener::handleTextChangedEvent(Any oldValue, Any newValue)
+{
+ pAgent->UpdateValue(pAccessible, newValue);
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_VALUECHANGE, pAccessible);
+}
+
+/**
+ * handle the CARET_CHANGED event
+ *
+ * @param oldValue the old value of the source of event
+ * @param newValue the new value of the source of event
+ */
+void AccComponentEventListener::handleCaretChangedEvent(Any oldValue, Any newValue)
+{
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_CARETCHANGE, pAccessible);
+}
+
+/**
+ * handle the VISIBLE_DATA_CHANGED event
+ */
+void AccComponentEventListener::handleVisibleDataChangedEvent()
+{
+ AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ * handle the BOUNDRECT_CHANGED event
+ */
+void AccComponentEventListener::handleBoundrectChangedEvent()
+{
+ AccEventListener::handleBoundrectChangedEvent();
+}
+
+/**
+ * set the new state and fire the MSAA event
+ *
+ * @param state new state id
+ * @param enable true if state is set, false if state is unset
+ */
+void AccComponentEventListener::setComponentState(short state, bool enable )
+{
+ // only the following state can be fired state event.
+ switch (state)
+ {
+ case AccessibleStateType::CHECKED:
+ case AccessibleStateType::PRESSED:
+ case AccessibleStateType::SELECTED:
+ case AccessibleStateType::ARMED:
+ case AccessibleStateType::INDETERMINATE:
+ case AccessibleStateType::SHOWING:
+ fireStatePropertyChange(state, enable);
+ break;
+ case AccessibleStateType::VISIBLE:
+ if (getRole() == AccessibleRole::MENU_ITEM)
+ {
+ if(enable)
+ {
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE);
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSABLE);
+ }
+ else
+ {
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE);
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSABLE);
+ }
+ }
+ else
+ {
+ fireStatePropertyChange(state, enable);
+ }
+ break;
+ break;
+ case AccessibleStateType::FOCUSED:
+ fireStateFocusdChange(enable);
+ break;
+ case AccessibleStateType::ENABLED:
+ if(enable)
+ {
+ pAgent->UpdateState(pAccessible);
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::DEFUNC);
+ // 8. label should have no FOCUSABLE state state, Firefox has READONLY state, we can also have.
+ if( getRole() != AccessibleRole::LABEL
+ && getRole() != AccessibleRole::SCROLL_BAR) //IAccessibility2 Implementation 2009
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSABLE);
+ }
+ else
+ {
+ pAgent->UpdateState(pAccessible);
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::DEFUNC);
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSABLE);
+ }
+ break;
+ case AccessibleStateType::ACTIVE:
+ // Only frames should be active
+ // no msaa state mapping
+ break;
+ default:
+ break;
+ }
+}
+
+/**
+ * fire the MSAA state changed event
+ *
+ * @param state the state id
+ * @param set true if state is set, false if state is unset
+ */
+void AccComponentEventListener::fireStatePropertyChange(short state, bool set)
+{
+ if( set)
+ {
+ // new value
+ switch(state)
+ {
+ case AccessibleStateType::CHECKED:
+ case AccessibleStateType::INDETERMINATE:
+ pAgent->IncreaseState( pAccessible, state);
+ pAgent->UpdateAction( pAccessible );
+
+ if(!pAgent->IsSpecialToolboItem(pAccessible))
+ {
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_CHECKED, pAccessible);
+ }
+ break;
+ case AccessibleStateType::PRESSED:
+ pAgent->IncreaseState( pAccessible, state);
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_PRESSED, pAccessible);
+ break;
+ case AccessibleStateType::SELECTED:
+ pAgent->IncreaseState( pAccessible, state);
+ break;
+ case AccessibleStateType::ARMED:
+ pAgent->IncreaseState( pAccessible, state);
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_ARMED, pAccessible);
+ break;
+ case AccessibleStateType::SHOWING:
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::DEFUNC);
+ // UNO !SHOWING == MSAA OFFSCREEN
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::SHOWING );
+ break;
+ case AccessibleStateType::VISIBLE:
+ // UNO !VISIBLE == MSAA INVISIBLE
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE );
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ // old value
+ switch(state)
+ {
+ case AccessibleStateType::CHECKED:
+ case AccessibleStateType::INDETERMINATE:
+ pAgent->DecreaseState( pAccessible, state );
+ pAgent->UpdateAction( pAccessible );
+
+ if(!pAgent->IsSpecialToolboItem(pAccessible))
+ {
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_CHECKED, pAccessible);
+ }
+ break;
+ case AccessibleStateType::PRESSED:
+ pAgent->DecreaseState( pAccessible, state );
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_PRESSED, pAccessible);
+ break;
+ case AccessibleStateType::SELECTED:
+ pAgent->DecreaseState( pAccessible, state );
+ //if the state is unset, no need to send MSAA SELECTION event
+ //pAgent->NotifyAccEvent(UM_EVENT_STATE_SELECTED, pAccessible);
+ break;
+ case AccessibleStateType::ARMED:
+ {
+ pAgent->DecreaseState( pAccessible, state);
+ //if the state is unset, no need to send MSAA MENU event
+ //pAgent->NotifyAccEvent(UM_EVENT_STATE_ARMED, pAccessible);
+ }
+ break;
+ case AccessibleStateType::SHOWING:
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::DEFUNC);
+ // UNO !SHOWING == MSAA OFFSCREEN
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::SHOWING );
+ break;
+ case AccessibleStateType::VISIBLE:
+ // UNO !VISIBLE == MSAA INVISIBLE
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE );
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+/**
+ * handle the focused event
+ *
+ * @param enable true if get focus, false if lose focus
+ */
+void AccComponentEventListener::fireStateFocusdChange(bool enable)
+{
+ if(enable)
+ {
+ if(getParentRole() != AccessibleRole::COMBO_BOX )
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible);
+ }
+ else
+ {
+ //if lose focus, no need to send MSAA FOCUS event
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED);
+ }
+}
+
+void AccComponentEventListener::handleSelectionChangedEvent()
+{
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAccessible);
+}
+
+//add TEXT_SELECTION_CHANGED event
+void AccComponentEventListener::handleTextSelectionChangedEvent()
+{
+ pAgent->NotifyAccEvent(UM_EVENT_TEXT_SELECTION_CHANGED, pAccessible);
+}
diff --git a/winaccessibility/source/service/AccContainerEventListener.cxx b/winaccessibility/source/service/AccContainerEventListener.cxx
new file mode 100644
index 000000000000..f0a96c475947
--- /dev/null
+++ b/winaccessibility/source/service/AccContainerEventListener.cxx
@@ -0,0 +1,573 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccContainerEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccContainerEventListener::AccContainerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccEventListener(pAcc, Agent)
+{
+}
+
+AccContainerEventListener::~AccContainerEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ *
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccContainerEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ short role = getRole();
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::CHILD:
+ handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::SELECTION_CHANGED:
+ handleSelectionChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::INVALIDATE_ALL_CHILDREN:
+ handleAllChildrenChangedEvent();
+ break;
+ case AccessibleEventId::TEXT_CHANGED:
+ handleTextChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ case AccessibleEventId::VISIBLE_DATA_CHANGED:
+ handleVisibleDataChangedEvent();
+ break;
+ case AccessibleEventId::BOUNDRECT_CHANGED:
+ handleBoundrectChangedEvent();
+ break;
+ case AccessibleEventId::STATE_CHANGED:
+ handleStateChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::VALUE_CHANGED:
+ handleValueChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::SELECTION_CHANGED_ADD:
+ handleSelectionChangedAddEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::SELECTION_CHANGED_REMOVE:
+ handleSelectionChangedRemoveEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::SELECTION_CHANGED_WITHIN:
+ handleSelectionChangedWithinEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::PAGE_CHANGED:
+ handlePageChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::SECTION_CHANGED:
+ handleSectionChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::COLUMN_CHANGED:
+ handleColumnChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ default:
+ AccEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the VISIBLE_DATA_CHANGED event
+ */
+void AccContainerEventListener::handleVisibleDataChangedEvent()
+{
+ AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ * handle the BOUNDRECT_CHANGED event
+ */
+void AccContainerEventListener::handleBoundrectChangedEvent()
+{
+ AccEventListener::handleBoundrectChangedEvent();
+}
+
+void AccContainerEventListener::handleStateChangedEvent(Any oldValue, Any newValue)
+{
+ short State;
+ if( newValue >>= State)
+ {
+ setComponentState( State,true);
+ }
+ else if (oldValue >>= State)
+ {
+ setComponentState( State,false);
+ }
+
+}
+
+/**
+ * handle the CHILD event
+ * @param oldValue the child to be deleted
+ * @param newValue the child to be added
+ */
+void AccContainerEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+ Reference< XAccessible > xChild;
+ if( newValue >>= xChild)
+ {
+ //create a new child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ //add this child
+
+ if(pAgent->InsertAccObj( pAcc,pAccessible))
+ {
+ //add all oldValue's existing children
+ pAgent->InsertChildrenAccObj(pAcc);
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+ }
+ }
+ else
+ {}
+ }
+ else if (oldValue >>= xChild)
+ {
+ //delete a existing child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+ //delete all oldValue's existing children
+ pAgent->DeleteChildrenAccObj( pAcc );
+ //delete this child
+ pAgent->DeleteAccObj( pAcc );
+
+ }
+ else
+ {}
+ }
+
+}
+
+/**
+ * handle the SELECTION_CHANGED event
+ * @param oldValue the old value of the source of event
+ * @param newValue the new value of the source of event
+ */
+void AccContainerEventListener::handleSelectionChangedEvent(const Any& /*oldValue*/, const Any& newValue)
+{
+ if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED,newValue))
+ {
+ return ;
+ }
+
+ //menu bar does not process selection change event,just same as word behavior
+ if(getRole()!=AccessibleRole::MENU_BAR)
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAccessible);
+}
+
+/**
+ * handle the INVALIDATE_ALL_CHILDREN event
+ */
+void AccContainerEventListener::handleAllChildrenChangedEvent()
+{
+ //TODO: update all the children
+ if( pAccessible )
+ {
+ //delete all oldValue's existing children
+ pAgent->DeleteChildrenAccObj( pAccessible );
+ //add all oldValue's existing children
+ pAgent->InsertChildrenAccObj( pAccessible );
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_REORDER , pAccessible);
+ }
+}
+
+/**
+ * handle the TEXT_CHANGED event
+ */
+void AccContainerEventListener::handleTextChangedEvent(Any oldValue, Any newValue)
+{
+ pAgent->UpdateValue(pAccessible, newValue);
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_TEXTCHANGE, pAccessible);
+}
+
+/**
+ * set the new state and fire the MSAA event
+ * @param state new state id
+ * @param enable true if state is set, false if state is unset
+ */
+void AccContainerEventListener::setComponentState(short state, bool enable )
+{
+ // only the following state can be fired state event.
+
+ switch (state)
+ {
+ case AccessibleStateType::SELECTED:
+ case AccessibleStateType::BUSY:
+ case AccessibleStateType::INDETERMINATE:
+ case AccessibleStateType::OFFSCREEN:
+ case AccessibleStateType::FOCUSABLE:
+ case AccessibleStateType::SHOWING:
+ case AccessibleStateType::VISIBLE:
+ fireStatePropertyChange(state, enable);
+ break;
+ case AccessibleStateType::FOCUSED:
+ fireStateFocusdChange(enable);
+ break;
+ case AccessibleStateType::ENABLED:
+ if(enable)
+ {
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::DEFUNC);
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSABLE);
+ pAgent->UpdateState(pAccessible);
+
+ UpdateAllChildrenState(pAccessible);
+ }
+ else
+ {
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::DEFUNC);
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSABLE);
+ pAgent->UpdateState(pAccessible);
+
+ UpdateAllChildrenState(pAccessible);
+ }
+ break;
+ case AccessibleStateType::ACTIVE:
+ // Only frames should be active
+ // no msaa state mapping
+ //for PAGE_TAB_LIST, there will be ACTIVE state, then it should be converted to FOCUSED event.
+ if(getRole() == AccessibleRole::PAGE_TAB_LIST)
+ {
+ if (!enable) /* get the active state */
+ {
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSED);
+ }
+
+ else /* lose the active state */
+ {
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED);
+ }
+ }
+ break;
+
+ case AccessibleStateType::EXPANDED:
+ case AccessibleStateType::COLLAPSE:
+ case AccessibleStateType::CHECKED:
+ {
+ pAgent->UpdateState(pAccessible);
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+/**
+ * fire the MSAA state changed event
+ * @param state the state id
+ * @param set true if state is set, false if state is unset
+ */
+void AccContainerEventListener::fireStatePropertyChange(short state, bool set)
+{
+ if( set )
+ {
+ // new value
+ switch(state)
+ {
+ case AccessibleStateType::SELECTED:
+ pAgent->IncreaseState( pAccessible, state);
+ break;
+ case AccessibleStateType::INDETERMINATE:
+ case AccessibleStateType::BUSY:
+ case AccessibleStateType::FOCUSABLE:
+ case AccessibleStateType::OFFSCREEN:
+ pAgent->IncreaseState( pAccessible, state);
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible);
+ break;
+ case AccessibleStateType::SHOWING:
+ // UNO !SHOWING == MSAA OFFSCREEN
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::SHOWING );
+ break;
+ case AccessibleStateType::VISIBLE:
+ // UNO !VISIBLE == MSAA INVISIBLE
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE );
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ // old value
+ switch(state)
+ {
+ case AccessibleStateType::SELECTED:
+ pAgent->DecreaseState( pAccessible, state );
+ break;
+ case AccessibleStateType::BUSY:
+ case AccessibleStateType::INDETERMINATE:
+ case AccessibleStateType::FOCUSABLE:
+ case AccessibleStateType::OFFSCREEN:
+ pAgent->DecreaseState( pAccessible, state);
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible);
+ break;
+ case AccessibleStateType::SHOWING:
+ // UNO !SHOWING == MSAA OFFSCREEN
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::SHOWING );
+ break;
+ case AccessibleStateType::VISIBLE:
+ // UNO !VISIBLE == MSAA INVISIBLE
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE );
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+/**
+ * handle the focused event
+ * @param enable true if get focus, false if lose focus
+ */
+void AccContainerEventListener::fireStateFocusdChange(bool enable)
+{
+ if(enable)
+ {
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSED);
+ //if the acc role is MENU_BAR, MSAA UM_EVENT_MENU_START event should be sent
+ //if the acc role is POPUP_MENU, MSAA UM_EVENT_MENUPOPUPSTART event should be sent
+ short role = getRole();
+ if(role == AccessibleRole::MENU_BAR)
+ {
+ pAgent->NotifyAccEvent(UM_EVENT_MENU_START, pAccessible);
+ }
+ else if (role == AccessibleRole::POPUP_MENU)
+ pAgent->NotifyAccEvent(UM_EVENT_MENUPOPUPSTART, pAccessible);
+ //Disable the focused event on option_pane and Panel.
+ //only disable option_pane for toolbar has panel to get focus
+ else if (role == AccessibleRole::PANEL || role == AccessibleRole::OPTION_PANE )
+ {
+ //don't send focused event on PANEL & OPTION_PANE if the parent is not toolbar
+ short parentRole = getParentRole();
+ if (parentRole == AccessibleRole::TOOL_BAR
+ || parentRole == AccessibleRole::SCROLL_PANE // sidebar
+ || parentRole == AccessibleRole::PANEL) // sidebar
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible);
+ }
+ //to update ComboBox's description
+ else if (role == AccessibleRole::COMBO_BOX )
+ {
+ pAgent->UpdateDescription(pAccessible);
+ //for editable combobox, send focus event on only edit control,
+ bool bSendFocusOnCombobox = true;
+ //send focused event to the first text child
+ Reference<XAccessibleContext> mxContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+ if(mxContext.is())
+ {
+ Reference<XAccessible> mxChild = mxContext->getAccessibleChild(0);
+ if(mxChild.is())
+ {
+ Reference<XAccessibleContext> mxChildContext(mxChild->getAccessibleContext(),UNO_QUERY);
+ short childrole = mxChildContext->getAccessibleRole();
+ if (childrole == AccessibleRole::TEXT)
+ {
+ if (IsEditable(mxChildContext))
+ {
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED);
+ pAgent->IncreaseState( mxChild.get(), AccessibleStateType::FOCUSED);
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, mxChild.get());
+ bSendFocusOnCombobox = false;
+ }
+ }
+ }
+ }
+ if (bSendFocusOnCombobox)
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible);
+ }
+ else
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible);
+ }
+ else
+ {
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED);
+ //if the acc role is MENU_BAR, MSAA UM_EVENT_MENU_END event should be sent
+ //if the acc role is POPUP_MENU, MSAA UM_EVENT_MENUPOPUPEND event should be sent
+ if(getRole() == AccessibleRole::MENU_BAR)
+ {
+ pAgent->NotifyAccEvent(UM_EVENT_MENU_END, pAccessible);
+ }
+ else if (getRole() == AccessibleRole::POPUP_MENU)
+ {
+ pAgent->NotifyAccEvent(UM_EVENT_MENUPOPUPEND, pAccessible);
+ }
+ }
+}
+
+/**
+ * handle the VALUE_CHANGED event
+ *
+ * @param oldValue the old value of the source of event
+ * @param newValue the new value of the source of event
+ */
+void AccContainerEventListener::handleValueChangedEvent(Any oldValue, Any newValue)
+{
+ pAgent->UpdateValue(pAccessible);
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_VALUECHANGE, pAccessible);
+}
+
+bool AccContainerEventListener::IsEditable(Reference<XAccessibleContext> xContext)
+{
+ bool ret = false;
+ Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet();
+ if( !pRState.is() )
+ return false;
+
+ Sequence<short> pStates = pRState->getStates();
+ int count = pStates.getLength();
+ for( int iIndex = 0;iIndex < count;iIndex++ )
+ {
+ if(pStates[iIndex] == AccessibleStateType::EDITABLE)
+ return true;
+ }
+ return ret;
+}
+
+bool AccContainerEventListener::NotifyChildEvent(short nWinEvent,const Any &Value)
+{
+ Reference< XAccessible > xChild;
+ if(Value >>= xChild )
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->NotifyAccEvent(nWinEvent, pAcc);
+ return true;
+ }
+ }
+ return false;
+}
+
+void AccContainerEventListener::handleSelectionChangedAddEvent(const Any& /*oldValue*/, const Any& newValue)
+{
+ if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_ADD,newValue))
+ {
+ return ;
+ }
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_ADD,pAccessible);
+}
+void AccContainerEventListener::handleSelectionChangedRemoveEvent(const Any& /*oldValue*/, const Any& newValue)
+{
+ if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,newValue))
+ {
+ return ;
+ }
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,pAccessible);
+}
+void AccContainerEventListener::handleSelectionChangedWithinEvent(const Any& /*oldValue*/, const Any& newValue)
+{
+ if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,newValue))
+ {
+ return ;
+ }
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,pAccessible);
+}
+
+void SAL_CALL AccContainerEventListener::UpdateAllChildrenState( com::sun::star::accessibility::XAccessible* pXAccessible )
+{
+ Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pXAccessible->getAccessibleContext(),UNO_QUERY);
+ if(!xContext.is())
+ {
+ return;
+ }
+ com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get();
+ if(pAccessibleContext == NULL)
+ {
+ return;
+ }
+
+ if (pAgent && pAgent->IsStateManageDescendant(pXAccessible))
+ {
+ return;
+ }
+
+ int count = pAccessibleContext->getAccessibleChildCount();
+ for (int i=0;i<count;i++)
+ {
+ Reference<com::sun::star::accessibility::XAccessible> mxAccessible
+ = pAccessibleContext->getAccessibleChild(i);
+
+ com::sun::star::accessibility::XAccessible* mpAccessible = mxAccessible.get();
+ if(mpAccessible != NULL)
+ {
+ pAgent->UpdateState(mpAccessible);
+ UpdateAllChildrenState(mpAccessible);
+ }
+ }
+}
+
+
+void AccContainerEventListener::handlePageChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/)
+{
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_PAGECHANGED, pAccessible);
+}
+
+void AccContainerEventListener::handleSectionChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/ )
+{
+ pAgent->NotifyAccEvent(UM_EVENT_SECTION_CHANGED, pAccessible);
+}
+
+void AccContainerEventListener::handleColumnChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/)
+{
+ pAgent->NotifyAccEvent(UM_EVENT_COLUMN_CHANGED, pAccessible);
+}
+
+//IAccessibility2 Implementation 2009-----
+void AccContainerEventListener::handleNameChangedEvent( Any name )
+{
+ if (getRole() == AccessibleRole::COMBO_BOX)
+ {
+ Reference<XAccessibleContext> mxContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+ if(mxContext.is())
+ {
+ Reference<XAccessible> mxChild = mxContext->getAccessibleChild(0);
+ if(mxChild.is())
+ {
+ Reference<XAccessibleContext> mxChildContext(mxChild->getAccessibleContext(),UNO_QUERY);
+ short childrole = mxChildContext->getAccessibleRole();
+ if (childrole == AccessibleRole::TEXT)
+ {
+ pAgent->UpdateAccName(mxChild.get(), name);
+ }
+ }
+ }
+ }
+ AccEventListener::handleNameChangedEvent(name);
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/winaccessibility/source/service/AccDescendantManagerEventListener.cxx b/winaccessibility/source/service/AccDescendantManagerEventListener.cxx
new file mode 100644
index 000000000000..97bd1b221655
--- /dev/null
+++ b/winaccessibility/source/service/AccDescendantManagerEventListener.cxx
@@ -0,0 +1,226 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccDescendantManagerEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccDescendantManagerEventListener::AccDescendantManagerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccComponentEventListener(pAcc, Agent),
+ pActiveDescendant(NULL)
+{
+}
+
+AccDescendantManagerEventListener::~AccDescendantManagerEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccDescendantManagerEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::SELECTION_CHANGED:
+ handleSelectionChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::CHILD:
+ handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS:
+ handleChildChangedNoFocusEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::SELECTION_CHANGED_ADD:
+ handleSelectionChangedAddEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::SELECTION_CHANGED_REMOVE:
+ handleSelectionChangedRemoveEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::SELECTION_CHANGED_WITHIN:
+ handleSelectionChangedWithinEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ default:
+ AccComponentEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the CHILD event
+ * @param oldValue the child to be deleted
+ * @param newValue the child to be added
+ */
+void AccDescendantManagerEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+
+ Reference< XAccessible > xChild;
+ if( newValue >>= xChild)
+ {
+ //create a new child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->InsertAccObj( pAcc,pAccessible);
+ pAgent->InsertChildrenAccObj(pAcc);
+
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+
+ }
+ else
+ {}
+ }
+
+ if (oldValue >>= xChild)
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+ pAgent->DeleteChildrenAccObj( pAcc );
+ pAgent->DeleteAccObj( pAcc );
+ }
+ else
+ {}
+ }
+
+}
+
+/**
+ * handle the SELECTION_CHANGED event
+ */
+void AccDescendantManagerEventListener::handleSelectionChangedEvent(Any oldValue, Any newValue)
+{
+ bool bSend =false;
+ Reference< XAccessible > xChild;
+ if(newValue >>= xChild )
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ //if the Role is the SC cell ,don't add the selected state.
+ if (pAgent->GetRole(pAcc) != AccessibleRole::TABLE_CELL)
+ {
+ pAgent->IncreaseState( pAcc, AccessibleStateType::SELECTED);
+ }
+
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAcc);
+ bSend=true;
+ }
+ }
+ if(oldValue >>= xChild )
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->DecreaseState( pAcc, AccessibleStateType::SELECTED);
+ }
+ }
+ if (!bSend)
+ {
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAccessible);
+ }
+}
+
+
+void AccDescendantManagerEventListener::handleChildChangedNoFocusEvent(Any oldValue, Any newValue)
+{
+ Reference< XAccessible > xChild;
+ if(newValue >>= xChild )
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+
+ pAgent->InsertAccObj(pAcc,pAccessible);
+ pAgent->InsertChildrenAccObj(pAcc);
+
+ pActiveDescendant= pAcc;
+ }
+ }
+ if (oldValue >>= xChild)
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->DeleteChildrenAccObj( pAcc );
+ pAgent->DeleteAccObj( pAcc );
+ }
+ }
+}
+
+bool AccDescendantManagerEventListener::NotifyChildEvent(short nWinEvent,const Any &Value)
+{
+ Reference< XAccessible > xChild;
+ if(Value >>= xChild )
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->NotifyAccEvent(nWinEvent, pAcc);
+
+ if (pAgent && pAgent->IsStateManageDescendant(pAccessible) && ( nWinEvent == UM_EVENT_SELECTION_CHANGED_REMOVE) )
+ {
+ pAgent->DeleteAccObj( pAcc );
+ }
+ return true;
+ }
+ }
+ return false;
+}
+void AccDescendantManagerEventListener::handleSelectionChangedAddEvent(const Any& /*oldValue*/, const Any &newValue)
+{
+ if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_ADD,newValue))
+ {
+ return ;
+ }
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_ADD,pAccessible);
+}
+void AccDescendantManagerEventListener::handleSelectionChangedRemoveEvent(const Any& /*oldValue*/, const Any &newValue)
+{
+ if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,newValue))
+ {
+ return ;
+ }
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,pAccessible);
+}
+
+void AccDescendantManagerEventListener::handleSelectionChangedWithinEvent(const Any& /*oldValue*/, const Any &newValue)
+{
+ if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,newValue))
+ {
+ return ;
+ }
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,pAccessible);
+}
+
diff --git a/winaccessibility/source/service/AccDialogEventListener.cxx b/winaccessibility/source/service/AccDialogEventListener.cxx
new file mode 100644
index 000000000000..6f78bf7d69a2
--- /dev/null
+++ b/winaccessibility/source/service/AccDialogEventListener.cxx
@@ -0,0 +1,150 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccDialogEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccDialogEventListener::AccDialogEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccEventListener(pAcc, Agent)
+{}
+AccDialogEventListener::~AccDialogEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccDialogEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::CHILD:
+ handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::VISIBLE_DATA_CHANGED:
+ handleVisibleDataChangedEvent();
+ break;
+ case AccessibleEventId::BOUNDRECT_CHANGED:
+ handleBoundrectChangedEvent();
+ break;
+ default:
+ AccEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the VISIBLE_DATA_CHANGED event
+ */
+void AccDialogEventListener::handleVisibleDataChangedEvent()
+{
+ AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ * handle the BOUNDRECT_CHANGED event
+ */
+void AccDialogEventListener::handleBoundrectChangedEvent()
+{
+ AccEventListener::handleBoundrectChangedEvent();
+}
+
+/**
+ * handle the CHILD event
+ * @param oldValue the child to be deleted
+ * @param newValue the child to be added
+ */
+void AccDialogEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+ Reference< XAccessible > xChild;
+ if( newValue >>= xChild)
+ {
+ //create a new child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ //add this child
+ pAgent->InsertAccObj( pAcc,pAccessible);
+ //add all oldValue's existing children
+ pAgent->InsertChildrenAccObj(pAcc);
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+ }
+ else
+ {}
+ }
+ else if (oldValue >>= xChild)
+ {
+ //delete a existing child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+ //delete all oldValue's existing children
+ pAgent->DeleteChildrenAccObj( pAcc );
+ //delete this child
+ pAgent->DeleteAccObj( pAcc );
+ }
+ else
+ {}
+ }
+
+}
+
+/**
+ * set the new state and fire the MSAA event
+ * @param state new state id
+ * @param enable true if state is set, false if state is unset
+ */
+void AccDialogEventListener::setComponentState(short state, bool enable )
+{
+ // only the following state can be fired state event.
+ switch (state)
+ {
+ case AccessibleStateType::ICONIFIED:
+ // no msaa state mapping
+ break;
+ case AccessibleStateType::VISIBLE:
+ // UNO !VISIBLE == MSAA INVISIBLE
+ if( enable )
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE );
+ else
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE );
+ break;
+ case AccessibleStateType::ACTIVE:
+ // Only frames should be active
+ // no msaa state mapping
+ break;
+ default:
+ break;
+ }
+}
diff --git a/winaccessibility/source/service/AccEventListener.cxx b/winaccessibility/source/service/AccEventListener.cxx
new file mode 100644
index 000000000000..1925b8746cd0
--- /dev/null
+++ b/winaccessibility/source/service/AccEventListener.cxx
@@ -0,0 +1,309 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <cppuhelper/bootstrap.hxx>
+#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <toolkit/awt/Vclxwindow.hxx>
+
+#ifndef _SV_SYSDATA_HXX
+#if defined( WIN ) || defined( WNT ) || defined( OS2 )
+typedef sal_Int32 HWND;
+#endif
+#endif
+#include "AccEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+
+#include <stdio.h>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+using namespace rtl;
+using namespace cppu;
+
+AccEventListener::AccEventListener(com::sun::star::accessibility::XAccessible* pAcc,
+ AccObjectManagerAgent* Agent)
+ :pAccessible(pAcc),
+ pAgent(Agent),
+ m_isDisposed(false),
+ m_refcount(0)
+{}
+
+AccEventListener::~AccEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::NAME_CHANGED:
+ handleNameChangedEvent(aEvent.NewValue);
+ break;
+ case AccessibleEventId::DESCRIPTION_CHANGED:
+ handleDescriptionChangedEvent(aEvent.NewValue);
+ break;
+ case AccessibleEventId::STATE_CHANGED:
+ handleStateChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ default:
+ break;
+ }
+}
+
+/**
+ * handle the NAME_CHANGED event
+ * @param name the new name with changed.
+ */
+void AccEventListener::handleNameChangedEvent(Any name)
+{
+ if ( pAgent->IsTopWinAcc( pAccessible ) )
+ {
+ XAccessible* pAccDoc = pAgent->GetAccDocByAccTopWin( pAccessible );
+ if ( pAccDoc )
+ {
+ pAgent->UpdateAccName(pAccDoc);
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_NAMECHANGE, pAccDoc);
+ }
+ }
+
+ pAgent->UpdateAccName(pAccessible, name);
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_NAMECHANGE, pAccessible);
+}
+
+/**
+ * handle the DESCRIPTION_CHANGED event
+ * @param desc the new description
+ */
+void AccEventListener::handleDescriptionChangedEvent(Any desc)
+{
+ pAgent->UpdateDescription(pAccessible, desc);
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_DESCRIPTIONCHANGE, pAccessible);
+}
+
+/**
+ * handle the BOUNDRECT_CHANGED event
+ */
+void AccEventListener::handleBoundrectChangedEvent()
+{
+ pAgent->UpdateLocation(pAccessible);
+ pAgent->NotifyAccEvent(UM_EVENT_BOUNDRECT_CHANGED, pAccessible);
+}
+
+/**
+ * handle the VISIBLE_DATA_CHANGED event
+ */
+void AccEventListener::handleVisibleDataChangedEvent()
+{
+ pAgent->UpdateValue(pAccessible);
+ pAgent->NotifyAccEvent(UM_EVENT_VISIBLE_DATA_CHANGED, pAccessible);
+}
+
+/**
+ * handle the STATE_CHANGED event
+ * @param oldValue the old state of the source of event
+ * @param newValue the new state of the source of event
+ */
+void AccEventListener::handleStateChangedEvent(Any oldValue, Any newValue)
+{
+ short newV, oldV;
+ if( newValue >>= newV)
+ {
+ setComponentState(newV, true);
+ }
+ else if (oldValue >>= oldV)
+ {
+ setComponentState(oldV, false);
+ }
+}
+
+/**
+ * set the new state and fire the MSAA event
+ * @param state new state id
+ * @param enable true if state is set, false if state is unset
+ */
+void AccEventListener::setComponentState(short state, bool enable )
+{
+ switch (state)
+ {
+ case AccessibleStateType::FOCUSED:
+ fireStateFocusdChange(enable);
+ break;
+ default:
+ fireStatePropertyChange(state, enable);
+ break;
+ }
+}
+
+/**
+ * handle the focused event
+ * @param enable true if get focus, false if lose focus
+ */
+void AccEventListener::fireStateFocusdChange(bool enable)
+{
+ if(enable)
+ {
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSED);
+ pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible);
+ }
+ else
+ {
+ // no focus lost event in MSAA
+ }
+}
+
+
+/**
+ * fire the MSAA state changed event
+ * @param state the state id
+ * @param set true if state is set, false if state is unset
+ */
+void AccEventListener::fireStatePropertyChange(short state, bool set )
+{
+ if( set )
+ {
+ //get new state
+ }
+ else
+ {
+ //lose old state
+ }
+}
+
+/**
+ * get the role of accessible object which is observed
+ */
+short AccEventListener::getRole()
+{
+ Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+ if(xContext.is())
+ {
+ return xContext->getAccessibleRole();
+ }
+ return -1;
+}
+
+/**
+ * get the role of accessible parent object which is observed
+ */
+short AccEventListener::getParentRole()
+{
+ if(pAccessible)
+ {
+ return pAgent->GetParentRole(pAccessible);
+ }
+ return -1;
+}
+/**
+ * remove the listener from accessible object
+ */
+void AccEventListener::removeMeFromBroadcaster()
+{
+ try
+ {
+ vos::OGuard aGuard(aRemoveMutex);
+ if(m_isDisposed)
+ return;
+ //get accessible context
+ Reference< XAccessibleContext > pRContext;
+ XAccessibleContext* pContext =NULL;
+
+ if( pAccessible == NULL)
+ {
+ return;
+ }
+ pRContext = pAccessible->getAccessibleContext();
+ if( !pRContext.is() )
+ {
+ return;
+ }
+
+ //get broadcaster from accessible component
+ Reference<XAccessibleComponent> xComponent(pRContext,UNO_QUERY);
+ if(!xComponent.is())
+ {
+ return;
+ }
+ Reference<XAccessibleEventBroadcaster> broadcaster(xComponent,UNO_QUERY);
+ XAccessibleEventBroadcaster* pBroadcaster = broadcaster.get();
+ if (pBroadcaster != NULL)
+ {
+ //remove the lister from accessible object
+ pBroadcaster->removeEventListener(this);
+ m_isDisposed = true;
+ pAgent->NotifyDestroy(pAccessible);
+ }
+ }
+ catch(...)
+ {
+ return;
+ }
+
+}
+
+/**
+ * this method is invoked before listener is disposed
+ */
+void AccEventListener::disposing( const ::com::sun::star::lang::EventObject& Source )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ removeMeFromBroadcaster();
+}
+
+//need to investigate further
+::com::sun::star::uno::Any SAL_CALL AccEventListener::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException)
+{
+ if(aType.equals(::getCppuType( (Reference< com::sun::star::accessibility::XAccessibleEventListener> const *)0 ) ))
+ {
+ Reference< com::sun::star::accessibility::XAccessibleEventListener> xEventListener( static_cast< com::sun::star::accessibility::XAccessibleEventListener* >(this));
+ return makeAny(xEventListener);
+ }
+
+ return Any();
+}
+
+void AccEventListener::acquire( ) throw ()
+{
+ ::osl_incrementInterlockedCount( &m_refcount );
+}
+
+void AccEventListener::release() throw ()
+{
+ // thread-safe decrementation of reference count
+ if (0 == ::osl_decrementInterlockedCount( &m_refcount ))
+ {
+ delete this; // shutdown this object
+ }
+}
diff --git a/winaccessibility/source/service/AccFrameEventListener.cxx b/winaccessibility/source/service/AccFrameEventListener.cxx
new file mode 100644
index 000000000000..bec7cac44005
--- /dev/null
+++ b/winaccessibility/source/service/AccFrameEventListener.cxx
@@ -0,0 +1,173 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccFrameEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+#include <vcl/window.hxx>
+#include <toolkit/awt/Vclxwindow.hxx>
+
+#ifndef _SV_SYSDATA_HXX
+#if defined( WIN ) || defined( WNT ) || defined( OS2 )
+typedef sal_Int32 HWND;
+typedef sal_Int32 HMENU;
+typedef sal_Int32 HDC;
+typedef void *PVOID;
+typedef PVOID HANDLE;
+typedef HANDLE HFONT;
+#endif
+#include <vcl/sysdata.hxx>
+#endif
+
+
+AccFrameEventListener::AccFrameEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccEventListener(pAcc, Agent)
+{
+}
+
+AccFrameEventListener::~AccFrameEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccFrameEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::CHILD:
+ handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::VISIBLE_DATA_CHANGED:
+ handleVisibleDataChangedEvent();
+ break;
+ case AccessibleEventId::BOUNDRECT_CHANGED:
+ handleBoundrectChangedEvent();
+ break;
+ default:
+ AccEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the VISIBLE_DATA_CHANGED event
+ */
+void AccFrameEventListener::handleVisibleDataChangedEvent()
+{
+ AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ * handle the BOUNDRECT_CHANGED event
+ */
+void AccFrameEventListener::handleBoundrectChangedEvent()
+{
+ AccEventListener::handleBoundrectChangedEvent();
+}
+
+/**
+ * handle the CHILD event
+ * @param oldValue the child to be deleted
+ * @param newValue the child to be added
+ */
+void AccFrameEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+ Reference< XAccessible > xChild;
+ if( newValue >>= xChild)
+ {
+ //create a new child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+
+ VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible;
+ Window* window = pvclwindow->GetWindow();
+ const SystemEnvData* systemdata=window->GetSystemData();
+
+ //add this child
+ pAgent->InsertAccObj( pAcc,pAccessible,(HWND)systemdata->hWnd);
+ //add all oldValue's existing children
+ pAgent->InsertChildrenAccObj(pAcc);
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+ }
+ else
+ {}
+ }
+ else if (oldValue >>= xChild)
+ {
+ //delete a existing child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+ //delete all oldValue's existing children
+ pAgent->DeleteChildrenAccObj( pAcc );
+ //delete this child
+ pAgent->DeleteAccObj( pAcc );
+ }
+ else
+ {}
+ }
+
+}
+
+/**
+ * set the new state and fire the MSAA event
+ * @param state new state id
+ * @param enable true if state is set, false if state is unset
+ */
+void AccFrameEventListener::setComponentState(short state, bool enable )
+{
+ // only the following state can be fired state event.
+ switch (state)
+ {
+ case AccessibleStateType::ICONIFIED:
+ // no msaa state
+ break;
+ case AccessibleStateType::VISIBLE:
+ // UNO !VISIBLE == MSAA INVISIBLE
+ if( enable )
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE );
+ else
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE );
+ break;
+ case AccessibleStateType::ACTIVE:
+ // Only frames should be active
+ // no msaa state mapping
+ break;
+ default:
+ break;
+ }
+}
diff --git a/winaccessibility/source/service/AccListEventListener.cxx b/winaccessibility/source/service/AccListEventListener.cxx
new file mode 100644
index 000000000000..4b79a76155fc
--- /dev/null
+++ b/winaccessibility/source/service/AccListEventListener.cxx
@@ -0,0 +1,123 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccListEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccListEventListener::AccListEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccDescendantManagerEventListener(pAcc, Agent),
+ shouldDeleteChild(true)
+{
+}
+
+AccListEventListener::~AccListEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccListEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED:
+ handleActiveDescendantChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::INVALIDATE_ALL_CHILDREN:
+ // Since List items a transient a child events are mostly used
+ // to attach/detach listeners, it is save to ignore it here
+ //TODO: investigate again
+ break;
+ case AccessibleEventId::VALUE_CHANGED:
+ handleValueChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ default:
+ AccDescendantManagerEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the ACTIVE_DESCENDANT_CHANGED event
+ * @param oldValue the child to lose active
+ * @param newValue the child to get active
+ */
+void AccListEventListener::handleActiveDescendantChangedEvent(Any oldValue, Any newValue)
+{
+ Reference< XAccessible > xChild;
+
+ if(newValue >>= xChild )
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+
+ // Valueset has cache the child item xacc,Update state if no insert obj
+ sal_Bool bHasCache = pAgent->InsertAccObj(pAcc,pAccessible);
+ if (!bHasCache)
+ {
+ pAgent->UpdateState(pAcc);
+ }
+
+ pAgent->IncreaseState( pAcc, AccessibleStateType::FOCUSED);
+
+ pAgent->NotifyAccEvent(UM_EVENT_ACTIVE_DESCENDANT_CHANGED, pAcc);
+ pActiveDescendant= pAcc;
+ }
+ }
+ if (oldValue >>= xChild)
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->DeleteAccObj( pAcc );
+ }
+ }
+}
+
+/**
+ * handle the VALUE_CHANGED event
+ *
+ * @param oldValue the old value of the source of event
+ * @param newValue the new value of the source of event
+ */
+void AccListEventListener::handleValueChangedEvent(Any oldValue, Any newValue)
+{
+ //to enable value changed event
+ if(getParentRole() == AccessibleRole::COMBO_BOX)
+ {
+ XAccessible* pParentAcc = pAgent->GetParentXAccessible(pAccessible);
+ pAgent->UpdateValue(pParentAcc);
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_VALUECHANGE, pParentAcc);
+ }
+}
diff --git a/winaccessibility/source/service/AccMenuEventListener.cxx b/winaccessibility/source/service/AccMenuEventListener.cxx
new file mode 100644
index 000000000000..342d5335de85
--- /dev/null
+++ b/winaccessibility/source/service/AccMenuEventListener.cxx
@@ -0,0 +1,151 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccMenuEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccMenuEventListener::AccMenuEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccComponentEventListener(pAcc, Agent)
+{}
+AccMenuEventListener::~AccMenuEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccMenuEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::CHILD:
+ handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::SELECTION_CHANGED:
+ //don't need to process anything,just same as word behavior
+ //handleSelectionChangedEvent();
+ break;
+ default:
+ AccComponentEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the CHILD event
+ * @param oldValue the child to be deleted
+ * @param newValue the child to be added
+ */
+void AccMenuEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+
+ Reference< XAccessible > xChild;
+ if( newValue >>= xChild)
+ {
+ //create a new child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ //add this child
+ pAgent->InsertAccObj( pAcc,pAccessible);
+ //add all oldValue's existing children
+ pAgent->InsertChildrenAccObj(pAcc);
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+ }
+ else
+ {}
+ }
+ else if (oldValue >>= xChild)
+ {
+ //delete an existing child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+ //delete all oldValue's existing children
+ pAgent->DeleteChildrenAccObj( pAcc );
+ //delete this child
+ pAgent->DeleteAccObj( pAcc );
+ }
+ else
+ {}
+ }
+
+}
+
+/**
+ * handle the SELECTION_CHANGED event
+ */
+void AccMenuEventListener::handleSelectionChangedEvent()
+{
+ pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAccessible);
+}
+
+/**
+ * handle the Menu_popup event
+ */
+void AccMenuEventListener::fireStatePropertyChange(short state, bool set)
+{
+ if( set )
+ {
+ // new value
+ switch(state)
+ {
+ //for sub menu is popup, there is a menu selected event.
+ case AccessibleStateType::SELECTED:
+ pAgent->IncreaseState( pAccessible, state);
+
+ pAgent->UpdateChildState(pAccessible);
+ break;
+ default:
+ AccComponentEventListener::fireStatePropertyChange(state, set
+ );
+ break;
+ }
+ }
+ else
+ {
+ switch(state)
+ {
+ //for sub menu is popup, there is a menu selected event.
+ case AccessibleStateType::SELECTED:
+ pAgent->DecreaseState( pAccessible, state );
+
+ break;
+ default:
+ AccComponentEventListener::fireStatePropertyChange(state, set
+ );
+ break;
+ }
+ }
+}
diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx
new file mode 100644
index 000000000000..c73ce4a7f0d2
--- /dev/null
+++ b/winaccessibility/source/service/AccObject.cxx
@@ -0,0 +1,1109 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+
+#include <stdlib.h>
+#include <memory.h>
+#include <stdio.h>
+#include <memory.h>
+#include <algorithm>
+#include <assert.h>
+
+#include "AccObject.hxx"
+#include "AccEventListener.hxx"
+#include "UAccCOM_i.c"
+#include "AccResource.hxx"
+
+#include "act.hxx"
+
+using namespace std;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::accessibility::AccessibleRole;
+using namespace com::sun::star::accessibility::AccessibleStateType;
+
+
+/**
+ * Constructor.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @param Agent The agent kept in all listeners,it's the sole interface by which
+ * listener communicate with windows manager.
+ * @param listener listener that registers in UNO system.
+ * @return.
+ */
+AccObject::AccObject(XAccessible* pAcc,AccObjectManagerAgent* pAgent ,AccEventListener* listener) :
+ m_pIMAcc (NULL),
+ m_resID (NULL),
+ m_pParantID (NULL),
+ m_pParentObj(NULL),
+ m_accListener (listener),
+ m_bShouldDestroy(sal_False),
+ m_xAccRef( pAcc )
+{
+ sal_Bool bRet = ImplInitilizeCreateObj();
+
+ m_xAccContextRef = m_xAccRef->getAccessibleContext();
+ m_xAccActionRef = Reference< XAccessibleAction > (m_xAccContextRef,UNO_QUERY);
+ m_accRole = m_xAccContextRef -> getAccessibleRole();
+ if( m_pIMAcc )
+ {
+ m_pIMAcc->SetXAccessible((long) m_xAccRef.get());
+ m_pIMAcc->Put_XAccAgent((long)pAgent);
+ m_pIMAcc->SetDefaultAction((long)m_xAccActionRef.get());
+ }
+}
+/**
+ * Destructor.
+ * @param
+ * @return
+ */
+AccObject::~AccObject()
+{
+ m_pIMAcc = NULL;
+ m_xAccRef = NULL;
+ m_xAccActionRef = NULL;
+ m_xAccContextRef = NULL;
+}
+
+
+
+/**
+ * Insert a child element.
+ * @param pChild Child element that should be inserted into child list.
+ * @param pos Insert postion.
+ * @return
+ */
+void AccObject::InsertChild( AccObject* pChild,short pos )
+{
+
+ std::vector<AccObject*>::iterator iter;
+ iter = std::find(m_childrenList.begin(),m_childrenList.end(),pChild);
+ if(iter!=m_childrenList.end())
+ return;
+ if(LAST_CHILD==pos)
+ {
+ m_childrenList.push_back(pChild);
+ }
+ else
+ {
+ std::vector<AccObject*>::iterator iter=m_childrenList.begin()+pos;
+ m_childrenList.insert(iter,pChild);
+ }
+
+ pChild->SetParentObj(this);
+}
+
+/**
+ * Delete a child element
+ * @param pChild Child element that should be inserted into child list.
+ * @param pos Insert postion.
+ * @return
+ */
+void AccObject::DeleteChild( AccObject* pChild )
+{
+ std::vector<AccObject*>::iterator iter;
+ iter = std::find(m_childrenList.begin(),m_childrenList.end(),pChild);
+ if(iter!=m_childrenList.end())
+ {
+ m_childrenList.erase(iter);
+ if(m_pIMAcc)
+ pChild->SetParentObj(NULL);
+ }
+}
+
+/**
+ * In order to windows API WindowFromAccessibleObject,we sometimes to set a pure
+ * top window accessible object created by windows system as top ancestor.
+ * @param.
+ * @return
+ */
+void AccObject::UpdateValidWindow()
+{
+ if(m_pIMAcc)
+ m_pIMAcc->Put_XAccWindowHandle(m_pParantID);
+}
+
+/**
+ * Translate all UNO basic information into MSAA com information.
+ * @param
+ * @return If the method is correctly processed.
+ */
+sal_Bool AccObject::ImplInitilizeCreateObj()
+{
+ ActivateActContext();
+ HRESULT hr = CoCreateInstance( CLSID_MAccessible, NULL, CLSCTX_ALL ,
+ IID_IMAccessible,
+ (void **)&m_pIMAcc);
+ DeactivateActContext();
+
+ if ( S_OK != hr )
+ {
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+/**
+ * Update name property to com object.
+ * @param
+ * @return
+ */
+void AccObject::UpdateName( )
+{
+ if (!m_pIMAcc)
+ {
+ return;
+ }
+
+ if( ( TEXT_FRAME == m_accRole ) && ( m_pParentObj !=NULL )&& ( SCROLL_PANE == m_pParentObj -> m_accRole ) )
+ m_pIMAcc->Put_XAccName( m_pParentObj->m_xAccContextRef->getAccessibleName().getStr() );
+ //IAccessibility2 Implementation 2009-----
+ if ( PARAGRAPH == m_accRole)
+ {
+ ::rtl::OUString emptyStr = ::rtl::OUString::createFromAscii("");
+ m_pIMAcc->Put_XAccName(emptyStr.getStr());
+ }
+ //-----IAccessibility2 Implementation 2009
+ else
+ m_pIMAcc->Put_XAccName(m_xAccContextRef->getAccessibleName().getStr());
+
+ return ;
+}
+/**
+ * Update description property to com object.
+ * no content for update description
+ * @param
+ * @return
+ */
+void AccObject::UpdateDescription()
+{
+ if (!m_pIMAcc)
+ {
+ return;
+ }
+
+ m_pIMAcc->Put_XAccDescription(m_xAccContextRef->getAccessibleDescription().getStr());
+ return ;
+}
+
+/**
+ * Update default action property to com object.
+ * @param
+ * @return
+ */
+void AccObject::UpdateAction()
+{
+ m_xAccActionRef = Reference< XAccessibleAction > (m_xAccContextRef,UNO_QUERY);
+
+ if( m_xAccActionRef.is() && m_pIMAcc )
+ {
+ if( m_xAccActionRef->getAccessibleActionCount() > 0 )
+ {
+ UpdateDefaultAction( );
+ m_pIMAcc->SetDefaultAction((long)m_xAccActionRef.get());
+ }
+ }
+}
+
+/**
+ * Update value property to com object.
+ * @param
+ * @return
+ */
+void AccObject::UpdateValue()
+{
+ if( NULL == m_pIMAcc || !m_xAccContextRef.is() )
+ {
+ assert(false);
+ return ;
+ }
+
+ Reference< XAccessibleValue > pRValue(m_xAccContextRef.get(),UNO_QUERY);
+ Any pAny;
+ if( pRValue.is() )
+ {
+ pAny = pRValue->getCurrentValue();
+ }
+
+ SetValue( pAny );
+}
+
+/**
+ * Set special default action description string via UNO role.
+ * @param Role UNO role
+ * @return
+ */
+void AccObject::UpdateDefaultAction( )
+{
+ if(!m_xAccActionRef.is())
+ return ;
+
+ switch(m_accRole)
+ {
+ case PUSH_BUTTON:
+ case TOGGLE_BUTTON:
+ case RADIO_BUTTON:
+ case MENU_ITEM:
+ case RADIO_MENU_ITEM:
+ case CHECK_MENU_ITEM:
+ case LIST_ITEM:
+ case CHECK_BOX:
+ case TREE_ITEM:
+ case BUTTON_DROPDOWN:
+ m_pIMAcc->Put_ActionDescription( m_xAccActionRef->getAccessibleActionDescription((sal_Int32)0).getStr() );
+ return;
+ }
+}
+
+/**
+ * Set value property via pAny.
+ * @param pAny New value.
+ * @return
+ */
+void AccObject::SetValue( Any pAny )
+{
+ unsigned short pUNumberString[100];
+ memset( pUNumberString, 0 , sizeof( pUNumberString) );
+
+ if( NULL == m_pIMAcc || !m_xAccContextRef.is() )
+ {
+ assert(false);
+ return ;
+ }
+ Reference< XAccessibleText > pRText(m_xAccContextRef,UNO_QUERY);
+ ::rtl::OUString val;
+ int index = 0 ;
+ switch(m_accRole)
+ {
+ case SPIN_BOX:
+ // 3. date editor's msaa value should be the same as spinbox
+ case DATE_EDITOR:
+ case TEXT:
+ case PARAGRAPH:
+ case HEADING:
+
+ if(pRText.get())
+ {
+ val = pRText->getText();
+ }
+ m_pIMAcc->Put_XAccValue( val.getStr() );
+ break;
+ case TREE_ITEM:
+ //IAccessibility2 Implementation 2009-----
+ //case CHECK_BOX: //Commented by Li Xing to disable the value for general checkbox
+ case COMBO_BOX:
+ case TABLE_CELL:
+ case NOTE:
+ case SCROLL_BAR:
+ m_pIMAcc->Put_XAccValue( GetMAccessibleValueFromAny(pAny).getStr() );
+ break ;
+ // Added by Li Xing, only the checkbox in tree should have the value.
+ case CHECK_BOX:
+ if( ( m_pParentObj !=NULL ) && (TREE == m_pParentObj->m_accRole || TREE_ITEM == m_pParentObj->m_accRole ))
+ m_pIMAcc->Put_XAccValue( GetMAccessibleValueFromAny(pAny).getStr() );
+ //-----IAccessibility2 Implementation 2009
+ break;
+ default:
+ break;
+ }
+
+ return;
+
+
+}
+::rtl::OUString AccObject::GetMAccessibleValueFromAny(Any pAny)
+{
+ ::rtl::OUString strValue;
+
+ if(NULL == m_pIMAcc)
+ return strValue;
+
+ if(pAny.getValueType() == getCppuType( (sal_uInt16 *)0 ) )
+ {
+ sal_uInt16 val;
+ if (pAny >>= val)
+ {
+ strValue=::rtl::OUString::valueOf((sal_Int32)val);
+
+ }
+ }
+ else if(pAny.getValueType() == getCppuType( (::rtl::OUString *)0 ) )
+ {
+
+ pAny >>= strValue ;
+
+ }
+ else if(pAny.getValueType() == getCppuType( (Sequence< ::rtl::OUString > *)0 ) )
+ {
+ Sequence< ::rtl::OUString > val;
+ if (pAny >>= val)
+ {
+
+ int count = val.getLength();
+
+ for( int iIndex = 0;iIndex < count;iIndex++ )
+ {
+ strValue += val[iIndex];
+ }
+
+ }
+ }
+ else if(pAny.getValueType() == getCppuType( (double *)0 ) )
+ {
+ double val;
+ if (pAny >>= val)
+ {
+ strValue=::rtl::OUString::valueOf(val);
+ }
+ }
+ else if(pAny.getValueType() == getCppuType( (sal_Int32 *)0 ) )
+ {
+ sal_Int32 val;
+ if (pAny >>= val)
+ {
+ strValue=::rtl::OUString::valueOf(val);
+ }
+ }
+ else if (pAny.getValueType() == getCppuType( (com::sun::star::accessibility::TextSegment *)0 ) )
+ {
+ com::sun::star::accessibility::TextSegment val;
+ if (pAny >>= val)
+ {
+ ::rtl::OUString realVal(val.SegmentText);
+ strValue = realVal;
+
+ }
+ }
+
+ return strValue;
+}
+/**
+ * Set name property via pAny.
+ * @param pAny New accessible name.
+ * @return
+ */
+void AccObject::SetName( Any pAny)
+{
+ if( NULL == m_pIMAcc )
+ return ;
+
+ m_pIMAcc->Put_XAccName( GetMAccessibleValueFromAny(pAny).getStr() );
+
+}
+
+/**
+ * Set description property via pAny.
+ * @param pAny New accessible description.
+ * @return
+ */
+void AccObject::SetDescription( Any pAny )
+{
+ if( NULL == m_pIMAcc )
+ return ;
+ m_pIMAcc->Put_XAccDescription( GetMAccessibleValueFromAny(pAny).getStr() );
+}
+
+/**
+ * Set role property via pAny
+ * @param Role New accessible role.
+ * @return
+ */
+void AccObject::SetRole( short Role )
+{
+ if( NULL == m_pIMAcc )
+ return ;
+ m_pIMAcc->Put_XAccRole( Role );
+}
+
+/**
+* Get role property via pAny
+* @param
+* @return accessible role
+*/
+short AccObject::GetRole() const
+{
+ return m_accRole;
+}
+
+/**
+ * Get MSAA state from UNO state
+ * @Role xState UNO state.
+ * @return
+ */
+DWORD AccObject::GetMSAAStateFromUNO(short xState)
+{
+ DWORD IState = UNO_MSAA_UNMAPPING;
+
+ if( !m_xAccContextRef.is() )
+ {
+ assert(false);
+ return IState;
+ }
+ short Role = m_accRole;
+
+ switch( xState )
+ {
+ case BUSY:
+ IState = STATE_SYSTEM_BUSY;
+ break;
+ case CHECKED:
+ if( Role == PUSH_BUTTON || Role == TOGGLE_BUTTON )
+ {
+ IState = STATE_SYSTEM_PRESSED;
+ }
+ else
+ IState = STATE_SYSTEM_CHECKED;
+ break;
+ case DEFUNC:
+ IState = STATE_SYSTEM_UNAVAILABLE;
+ break;
+ case EXPANDED:
+ IState = STATE_SYSTEM_EXPANDED;
+ break;
+ case FOCUSABLE:
+ IState = STATE_SYSTEM_FOCUSABLE;
+ break;
+ case FOCUSED:
+ IState = STATE_SYSTEM_FOCUSED;
+ break;
+ case INDETERMINATE:
+ IState = STATE_SYSTEM_MIXED;
+ break;
+ case MULTI_SELECTABLE:
+ IState = STATE_SYSTEM_MULTISELECTABLE;
+ break;
+ case PRESSED:
+ IState = STATE_SYSTEM_PRESSED;
+ break;
+ case RESIZABLE:
+ IState = STATE_SYSTEM_SIZEABLE;
+ break;
+ case SELECTABLE:
+ if( m_accRole == MENU || m_accRole == MENU_ITEM)
+ {
+ IState = UNO_MSAA_UNMAPPING;
+ }
+ else
+ {
+ IState = STATE_SYSTEM_SELECTABLE;
+ }
+ break;
+ case SELECTED:
+ if( m_accRole == MENU || m_accRole == MENU_ITEM )
+ {
+ IState = UNO_MSAA_UNMAPPING;
+ }
+ else
+ {
+ IState = STATE_SYSTEM_SELECTED;
+ }
+ break;
+ case ARMED:
+ IState = STATE_SYSTEM_FOCUSED;
+ break;
+ case EXPANDABLE:
+ {
+ sal_Bool isExpanded = sal_True;
+ sal_Bool isExpandable = sal_True;
+ if( Role == PUSH_BUTTON || Role == TOGGLE_BUTTON || BUTTON_DROPDOWN == Role )
+ {
+ IState = STATE_SYSTEM_HASPOPUP;
+ }
+ else
+ {
+ GetExpandedState(&isExpandable,&isExpanded);
+ if(!isExpanded)
+ IState = STATE_SYSTEM_COLLAPSED;
+ }
+ }
+ break;
+ //Remove the SENSITIVE state mapping. There is no corresponding MSAA state.
+ //case SENSITIVE:
+ // IState = STATE_SYSTEM_PROTECTED;
+ case EDITABLE:
+ if( m_pIMAcc )
+ {
+ m_pIMAcc->DecreaseState( STATE_SYSTEM_READONLY );
+ }
+ break;
+ case OFFSCREEN:
+ IState = STATE_SYSTEM_OFFSCREEN;
+ break;
+ case MOVEABLE:
+ IState = STATE_SYSTEM_MOVEABLE;
+ break;
+ case COLLAPSE:
+ IState = STATE_SYSTEM_COLLAPSED;
+ break;
+ case DEFAULT:
+ IState = STATE_SYSTEM_DEFAULT;
+ break;
+ default:
+ break;
+ }
+
+ return IState;
+}
+
+/**
+ * Decrease state of com object
+ * @param xState The lost state.
+ * @return
+ */
+void AccObject::DecreaseState( short xState )
+{
+ if( NULL == m_pIMAcc )
+ {
+ return;
+ }
+
+ if( xState == FOCUSABLE)
+ {
+ short Role = m_accRole ;
+ if(Role == MENU_ITEM
+ || Role == RADIO_MENU_ITEM
+ || Role == CHECK_MENU_ITEM)
+ return;
+ else
+ {
+ if (Role == TOGGLE_BUTTON || Role == PUSH_BUTTON || BUTTON_DROPDOWN == Role)
+ {
+ if( ( m_pParentObj !=NULL ) && (TOOL_BAR == m_pParentObj->m_accRole ) )
+ return;
+ }
+ }
+ }
+
+ else if( xState == AccessibleStateType::VISIBLE )
+ {
+ m_pIMAcc->IncreaseState( STATE_SYSTEM_INVISIBLE );
+ }
+ else if( xState == AccessibleStateType::SHOWING )
+ {
+ m_pIMAcc->IncreaseState( STATE_SYSTEM_OFFSCREEN );
+ }
+
+ DWORD msState = GetMSAAStateFromUNO(xState);
+ if(msState!=UNO_MSAA_UNMAPPING)
+ m_pIMAcc->DecreaseState(msState);
+}
+
+/**
+ * Increase state of com object
+ * @param xState The new state.
+ * @return
+ */
+void AccObject::IncreaseState( short xState )
+{
+ if( NULL == m_pIMAcc )
+ {
+ assert(false);
+ return;
+ }
+
+
+ if( xState == AccessibleStateType::VISIBLE )
+ {
+ m_pIMAcc->DecreaseState( STATE_SYSTEM_INVISIBLE );
+ }
+ else if( xState == AccessibleStateType::SHOWING )
+ {
+ m_pIMAcc->DecreaseState( STATE_SYSTEM_OFFSCREEN );
+ }
+
+
+ DWORD msState = GetMSAAStateFromUNO(xState);
+ if(msState!=UNO_MSAA_UNMAPPING)
+ m_pIMAcc->IncreaseState( msState );
+}
+
+/**
+ * Get next child element
+ * @param
+ * @return AccObject Object interface.
+ */
+AccObject* AccObject::NextChild()
+{
+ IAccChildList::iterator pInd = m_childrenList.begin();
+ if( pInd != m_childrenList.end() )
+ return *pInd;
+ return NULL;
+}
+/**
+ * update action desciption desc
+ * @param
+ * @return
+ */
+void AccObject::UpdateActionDesc()
+{
+ if (!m_pIMAcc)
+ {
+ return;
+ }
+
+ ::rtl::OUString pXString = m_xAccContextRef->getAccessibleDescription();
+ m_pIMAcc->Put_XAccDescription(pXString.getStr());
+ long Role = m_accRole;
+
+ if( Role == PUSH_BUTTON || Role == RADIO_BUTTON || Role == MENU_ITEM ||
+ Role == LIST_ITEM || Role == CHECK_BOX || Role == TREE_ITEM ||
+ Role == CHECK_MENU_ITEM || Role == RADIO_MENU_ITEM )
+ {
+ UpdateDefaultAction( );
+ }
+ else
+ {
+
+ if( m_xAccActionRef.is() )
+ {
+ if( m_xAccActionRef->getAccessibleActionCount() > 0 )
+ {
+ if (!(Role == SPIN_BOX || Role == COMBO_BOX || Role == DATE_EDITOR ||
+ Role == EDIT_BAR || Role == PASSWORD_TEXT || Role == TEXT))
+ {
+ pXString = m_xAccActionRef->getAccessibleActionDescription( 0 );
+ //Solution:If string length is more than zero,action will will be set.
+ if( pXString.getLength() > 0)
+ m_pIMAcc->Put_ActionDescription( pXString.getStr() );
+ }
+ }
+ }
+ }
+
+}
+/**
+ * update role information from uno to com
+ * @param
+ * @return
+ */
+void AccObject::UpdateRole()
+{
+ if (!m_pIMAcc)
+ {
+ return;
+ }
+
+ XAccessibleContext* pContext = m_xAccContextRef.get();
+ m_pIMAcc->Put_XAccRole( ROLE_SYSTEM_WINDOW );
+ short iRoleIndex = pContext->getAccessibleRole();
+ if (( 0 <= iRoleIndex) && ( iRoleIndex <= (sizeof(ROLE_TABLE)/(sizeof(short)*2))))
+ {
+ short iIA2Role = ROLE_TABLE[iRoleIndex][1] ;
+ m_pIMAcc->Put_XAccRole( iIA2Role );
+ }
+
+}
+/**
+ * update state information from uno to com
+ * @param
+ * @return
+ */
+void AccObject::UpdateState()
+{
+ if (!m_pIMAcc)
+ {
+ return;
+ }
+
+ XAccessibleContext* pContext = m_xAccContextRef.get();
+ Reference< XAccessibleStateSet > pRState = pContext->getAccessibleStateSet();
+ if( !pRState.is() )
+ {
+ assert(false);
+ return ;
+ }
+
+ m_pIMAcc->SetState(0L);
+
+ if ( m_accRole == POPUP_MENU )
+ {
+ return;
+ }
+
+ Sequence<short> pStates = pRState->getStates();
+ int count = pStates.getLength();
+
+ sal_Bool isEnable = sal_False;
+ sal_Bool isShowing = sal_False;
+ sal_Bool isEditable = sal_False;
+ sal_Bool isVisible = sal_False;
+ sal_Bool isFocusable = sal_False;
+
+ for( int iIndex = 0;iIndex < count;iIndex++ )
+ {
+ if( pStates[iIndex] == ENABLED )
+ isEnable = sal_True;
+ else if( pStates[iIndex] == SHOWING)
+ isShowing = sal_True;
+ else if( pStates[iIndex] == VISIBLE)
+ isVisible = sal_True;
+ else if( pStates[iIndex] == EDITABLE )
+ isEditable = sal_True;
+ else if (pStates[iIndex] == FOCUSABLE)
+ isFocusable = sal_True;
+ IncreaseState( pStates[iIndex]);
+ }
+ sal_Bool bIsMenuItem = m_accRole == MENU_ITEM || m_accRole == RADIO_MENU_ITEM || m_accRole == CHECK_MENU_ITEM;
+
+ if(bIsMenuItem)
+ {
+ if(!(isShowing && isVisible) )
+ {
+ m_pIMAcc->IncreaseState( STATE_SYSTEM_INVISIBLE );
+ m_pIMAcc->DecreaseState( STATE_SYSTEM_FOCUSABLE );
+ }
+ }
+ else
+ {
+ if(!(isShowing || isVisible) )
+ m_pIMAcc->IncreaseState( STATE_SYSTEM_INVISIBLE );
+ }
+
+ short Role = m_accRole;
+
+ if( m_pIMAcc )
+ {
+ switch(m_accRole)
+ {
+ case LABEL:
+ m_pIMAcc->IncreaseState( STATE_SYSTEM_READONLY );
+ break;
+ case TEXT:
+ // 2. editable combobox -> readonly ------ bridge
+ case EMBEDDED_OBJECT:
+ case END_NOTE:
+ case FOOTER:
+ case FOOTNOTE:
+ case GRAPHIC:
+ case HEADER:
+ case HEADING:
+
+ //Image Map
+ case PARAGRAPH:
+ case PASSWORD_TEXT:
+ case SHAPE:
+ case SPIN_BOX:
+ case TABLE:
+ case TABLE_CELL:
+ case TEXT_FRAME:
+ case DATE_EDITOR:
+ case DOCUMENT:
+ case COLUMN_HEADER:
+ {
+ if(!isEditable)
+ m_pIMAcc->IncreaseState( STATE_SYSTEM_READONLY );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if( isEnable )
+ {
+
+ if(!(Role == FILLER || Role == END_NOTE || Role == FOOTER || Role == FOOTNOTE || Role == GROUP_BOX || Role == RULER
+ || Role == HEADER || Role == ICON || Role == INTERNAL_FRAME || Role == LABEL || Role == LAYERED_PANE
+ || Role == SCROLL_BAR || Role == SCROLL_PANE || Role == SPLIT_PANE || Role == STATUS_BAR || Role == TOOL_TIP))
+ {
+ if( SEPARATOR == Role )
+ {
+ if( ( m_pParentObj != NULL ) && ( MENU == m_pParentObj->m_accRole || POPUP_MENU == m_pParentObj->m_accRole ))
+ IncreaseState( FOCUSABLE );
+ }
+
+ else if (TABLE_CELL == Role || TABLE == Role || PANEL == Role || OPTION_PANE == Role ||
+ COLUMN_HEADER == Role)
+ {
+ if (isFocusable)
+ IncreaseState( FOCUSABLE );
+ }
+ else
+ {
+ if(bIsMenuItem)
+ {
+ if ( isShowing && isVisible)
+ {
+ IncreaseState( FOCUSABLE );
+ }
+ }
+ else
+ {
+ IncreaseState( FOCUSABLE );
+ }
+ }
+ }
+ }
+ else
+ {
+ m_pIMAcc->IncreaseState( STATE_SYSTEM_UNAVAILABLE );
+ sal_Bool isDecreaseFocusable = sal_False;
+ if( !((Role == MENU_ITEM) ||
+ (Role == RADIO_MENU_ITEM) ||
+ (Role == CHECK_MENU_ITEM)) )
+ {
+ if ( Role == TOGGLE_BUTTON || Role == PUSH_BUTTON || BUTTON_DROPDOWN == Role)
+ {
+ if(( m_pParentObj != NULL )&& (TOOL_BAR == m_pParentObj->m_accRole ) )
+ IncreaseState( FOCUSABLE );
+ else
+ DecreaseState( FOCUSABLE );
+ }
+ else
+ DecreaseState( FOCUSABLE );
+ }
+ else if( isShowing || isVisible )
+ {
+ IncreaseState( FOCUSABLE );
+ }
+ }
+
+ if( m_pIMAcc )
+ {
+ switch(m_accRole)
+ {
+ case POPUP_MENU:
+ case MENU:
+ if( pContext->getAccessibleChildCount() > 0 )
+ m_pIMAcc->IncreaseState( STATE_SYSTEM_HASPOPUP );
+ break;
+ case PASSWORD_TEXT:
+ m_pIMAcc->IncreaseState( STATE_SYSTEM_PROTECTED );
+ break;
+ default:
+ break;
+ }
+ }
+
+}
+/**
+ * update location information from uno to com
+ * @param
+ * @return
+ */
+void AccObject::UpdateLocation()
+{
+ if (!m_pIMAcc)
+ {
+ return;
+ }
+ XAccessibleContext* pContext = m_xAccContextRef.get();
+
+ Reference< XAccessibleComponent > pRComponent(pContext,UNO_QUERY);
+ if( pRComponent.is() )
+ {
+ ::com::sun::star::awt::Point pCPoint = pRComponent->getLocationOnScreen();
+ ::com::sun::star::awt::Size pCSize = pRComponent->getSize();
+ Location tempLocation;
+ tempLocation.m_dLeft = pCPoint.X;
+ tempLocation.m_dTop = pCPoint.Y;
+ tempLocation.m_dWidth = pCSize.Width;
+ tempLocation.m_dHeight = pCSize.Height;
+ m_pIMAcc->Put_XAccLocation( tempLocation );
+ }
+
+}
+
+
+/**
+ * Public method to mapping information between MSAA and UNO.
+ * @param
+ * @return If the method is correctly processed.
+ */
+sal_Bool AccObject:: UpdateAccessibleInfoFromUnoToMSAA ( )
+{
+ if( NULL == m_pIMAcc || !m_xAccContextRef.is() )
+ {
+ assert(false);
+ return sal_False;
+ }
+
+ UpdateName();
+
+ UpdateValue();
+
+ UpdateActionDesc();
+
+ UpdateRole();
+
+ UpdateLocation();
+
+ UpdateState();
+
+ return sal_True;
+}
+
+/*
+ * Add a child selected element.
+ * @param pAccObj Child object pointer.
+ * @return
+ */
+void AccObject::AddSelect( long index, AccObject* accObj)
+{
+ m_selectionList.insert(IAccSelectionList::value_type(index,accObj));
+}
+
+IAccSelectionList& AccObject::GetSelection()
+{
+ return m_selectionList;
+}
+
+
+/**
+ * Set self to focus object in parant child list
+ * @param
+ * @return
+ */
+void AccObject::setFocus()
+{
+ if(m_pIMAcc)
+ {
+ IncreaseState(FOCUSED);
+ m_pIMAcc->Put_XAccFocus(CHILDID_SELF);
+
+ UpdateRole();
+ }
+}
+
+/**
+ * Unset self from focus object in parant child list.
+ * @param
+ * @return
+ */
+void AccObject::unsetFocus()
+{
+ if(m_pIMAcc)
+ {
+ DecreaseState( FOCUSED );
+ m_pIMAcc->Put_XAccFocus(UACC_NO_FOCUS);
+ }
+}
+
+void AccObject::GetExpandedState( sal_Bool* isExpandable, sal_Bool* isExpanded)
+{
+ *isExpanded = sal_False;
+ *isExpandable = sal_False;
+
+ if( !m_xAccContextRef.is() )
+ {
+ return;
+ }
+ Reference< XAccessibleStateSet > pRState = m_xAccContextRef->getAccessibleStateSet();
+ if( !pRState.is() )
+ {
+ return;
+ }
+
+ Sequence<short> pStates = pRState->getStates();
+ int count = pStates.getLength();
+
+ for( int iIndex = 0;iIndex < count;iIndex++ )
+ {
+ if( EXPANDED == pStates[iIndex] )
+ {
+ *isExpanded = sal_True;
+ }
+ else if( EXPANDABLE == pStates[iIndex] )
+ {
+ *isExpandable = sal_True;
+ }
+ }
+}
+
+void AccObject::NotifyDestroy(sal_Bool ifDelete)
+{
+ m_bShouldDestroy=ifDelete;
+ if(m_pIMAcc)
+ m_pIMAcc->NotifyDestroy(m_bShouldDestroy);
+}
+
+void AccObject::SetParentObj(AccObject* pParentAccObj)
+{
+ m_pParentObj = pParentAccObj;
+
+ if(m_pIMAcc)
+ {
+ if(m_pParentObj)
+ {
+ m_pIMAcc->Put_XAccParent(m_pParentObj->GetIMAccessible());
+ }
+ else
+ {
+ m_pIMAcc->Put_XAccParent(NULL);
+ }
+ }
+}
+//ResID means ChildID in MSAA
+void AccObject::SetResID(long id)
+{
+ m_resID = id;
+ if(m_pIMAcc)
+ m_pIMAcc->Put_XAccChildID(m_resID);
+}
+//return COM interface in acc object
+IMAccessible* AccObject::GetIMAccessible()
+{
+ return m_pIMAcc;
+}
+
+Reference < XAccessible > AccObject::GetXAccessible()
+{
+ return m_xAccRef;
+}
+
+void AccObject::SetParentHWND(HWND hWnd)
+{
+ m_pParantID = hWnd;
+}
+void AccObject::SetListener( AccEventListener* Listener )
+{
+ m_accListener = Listener;
+}
+AccEventListener* AccObject::getListener()
+{
+ return m_accListener;
+}
+
+long AccObject::GetResID()
+{
+ return m_resID;
+}
+
+HWND AccObject::GetParentHWND()
+{
+ return m_pParantID;
+}
+
+AccObject* AccObject::GetParentObj()
+{
+ return m_pParentObj;
+}
+sal_Bool AccObject::ifShouldDestroy()
+{
+ return m_bShouldDestroy;
+}
diff --git a/winaccessibility/source/service/AccObjectContainerEventListener.cxx b/winaccessibility/source/service/AccObjectContainerEventListener.cxx
new file mode 100644
index 000000000000..8aea67670426
--- /dev/null
+++ b/winaccessibility/source/service/AccObjectContainerEventListener.cxx
@@ -0,0 +1,72 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// AccObjectContainerEventListener.cpp: implementation of the AccContainerEventListener class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccObjectContainerEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccObjectContainerEventListener::AccObjectContainerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccContainerEventListener(pAcc, Agent)
+{}
+AccObjectContainerEventListener::~AccObjectContainerEventListener()
+{
+}
+
+/**
+ * handle the STATE_CHANGED event
+ */
+void AccObjectContainerEventListener::handleStateChangedEvent(Any oldValue, Any newValue)
+{
+ //set the accessible name before process for there is no NAME_CHANGED event when change
+ //the text in drawing objects.
+ short newV;
+ if( newValue >>= newV)
+ {
+ if (newV == AccessibleStateType::FOCUSED)
+ {
+ pAgent->UpdateAccName(pAccessible);
+
+ pAgent->UpdateDescription(pAccessible);
+ }
+ }
+ AccContainerEventListener::handleStateChangedEvent(oldValue, newValue);
+}
+/**
+ * handle the VISIBLE_DATA_CHANGED event
+ * For SHAPES, the visiable_data_changed event should be mapped to LOCATION_CHANGED event
+ */
+void AccObjectContainerEventListener::handleVisibleDataChangedEvent()
+{
+ AccContainerEventListener::handleBoundrectChangedEvent();
+}
diff --git a/winaccessibility/source/service/AccObjectManagerAgent.cxx b/winaccessibility/source/service/AccObjectManagerAgent.cxx
new file mode 100644
index 000000000000..1b29480dd04b
--- /dev/null
+++ b/winaccessibility/source/service/AccObjectManagerAgent.cxx
@@ -0,0 +1,386 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "AccObjectManagerAgent.hxx"
+#include "AccObjectWinManager.hxx"
+
+#include "UAccCOM2.h"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+/**
+ * Construction/Destruction.
+ * @param
+ * @return
+ */
+AccObjectManagerAgent::AccObjectManagerAgent():
+ pWinManager(NULL)
+{
+ if( pWinManager == NULL )
+ {
+ pWinManager = AccObjectWinManager::CreateAccObjectWinManagerInstance(this);
+ }
+}
+
+AccObjectManagerAgent::~AccObjectManagerAgent()
+{
+ delete pWinManager;
+ pWinManager = NULL;
+}
+
+/**
+ * Interface of updating MSAA name when UNO name_changed event occurs.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @return
+ */
+void AccObjectManagerAgent::UpdateAccName( XAccessible* pXAcc )
+{
+ if( pWinManager )
+ pWinManager->UpdateAccName( pXAcc );
+}
+
+/**
+ * Interface of updating MSAA name when UNO action changed event occurs.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @return
+ */
+void AccObjectManagerAgent::UpdateAction( XAccessible* pXAcc )
+{
+ if( pWinManager )
+ pWinManager->UpdateAction( pXAcc );
+}
+
+/**
+ * Interface of updating MSAA value when UNO value_changed event occurs.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @param pAny New value.
+ * @return
+ */
+void AccObjectManagerAgent::UpdateValue( XAccessible* pXAcc, Any pAny )
+{
+ if( pWinManager )
+ pWinManager->SetValue( pXAcc, pAny );
+}
+
+/**
+ * Interface of updating MSAA value when UNO value_changed event occurs.If we can not
+ * find new value,we'll get new value from pXAcc to update com value.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @return
+ */
+void AccObjectManagerAgent::UpdateValue( XAccessible* pXAcc )
+{
+ if( pWinManager )
+ pWinManager->UpdateValue( pXAcc );
+}
+
+/**
+ * Interface of updating MSAA name when UNO name_changed event occurs.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @param newName New UNO accessible name.
+ * @return
+ */
+void AccObjectManagerAgent::UpdateAccName( XAccessible* pXAcc, Any newName)
+{
+ if( pWinManager )
+ pWinManager->SetAccName( pXAcc, newName );
+}
+
+
+/**
+ * Interface of updating MSAA location when UNO location_changed event occurs.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @param pXAcc Uno The top position of new location.
+ * @param pXAcc Uno The left position of new location.
+ * @param pXAcc Uno The width of new location.
+ * @param pXAcc Uno The width of new location.
+ * @return
+ */
+void AccObjectManagerAgent::UpdateLocation( XAccessible* /* pXAcc */, long /*top*/, long /*left*/, long /*width*/, long /*height*/ )
+{
+#ifdef _IMPL_WIN
+ if( pWinManager )
+ pWinManager->SetLocation( pXAcc, top, left, width, height );
+#endif
+}
+
+/**
+ * Interface of updating MSAA name when UNO description_changed event occurs.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @param newDesc New UNO accessible description.
+ * @return
+ */
+void AccObjectManagerAgent::UpdateDescription( XAccessible* pXAcc, Any newDesc )
+{
+ if( pWinManager )
+ pWinManager->SetDescription( pXAcc, newDesc );
+}
+
+/**
+ * When a new UNO XAccessible object is found by listener,we'll create a corresponding
+ * com object and insert it to our manager list.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @param pWnd The top window handle containing control.
+ * @return If the method is correctly processed.
+ */
+unsigned char AccObjectManagerAgent::InsertAccObj( XAccessible* pXAcc,XAccessible* pParentXAcc,long pWnd)
+{
+ if( pWinManager )
+ return (unsigned char)pWinManager->InsertAccObj( pXAcc, pParentXAcc,HWND((void*)pWnd) );
+
+ return sal_False;
+}
+
+/**
+ * save the pair <topwindowhandle, XAccessible>
+ * @param hWnd, top window handle
+ * @param pXAcc XAccessible interface for top window
+ * @return void
+ */
+void AccObjectManagerAgent::SaveTopWindowHandle(long hWnd, com::sun::star::accessibility::XAccessible* pXAcc)
+{
+ if( pWinManager )
+ pWinManager->SaveTopWindowHandle( HWND((void*)hWnd), pXAcc );
+}
+
+
+/**
+ * When a UNO XAccessible object's new children are found by listener,we'll create
+ * corresponding com objects and insert them to our manager list.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @param pWnd The top window handle containing control.
+ * @return If the method is correctly processed.
+ */
+unsigned char AccObjectManagerAgent::InsertChildrenAccObj( XAccessible* pXAcc,
+ long pWnd)
+{
+ if( pWinManager )
+ return (unsigned char)pWinManager->InsertChildrenAccObj( pXAcc, HWND((void*)pWnd) );
+
+ return sal_False;
+}
+
+/**
+ * When a new UNO XAccessible object is destroied,we'll delete its corresponding
+ * com object and remove it from our manager list.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @return
+ */
+void AccObjectManagerAgent::DeleteAccObj( XAccessible* pXAcc )
+{
+ if( pWinManager )
+ pWinManager->DeleteAccObj( pXAcc );
+}
+
+/**
+ * When new UNO children XAccessible objects are destroyed,we'll delete their
+ * corresponding com objects and remove them from our manager list.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @return
+ */
+void AccObjectManagerAgent::DeleteChildrenAccObj( XAccessible* pXAcc )
+{
+ if( pWinManager )
+ pWinManager->DeleteChildrenAccObj( pXAcc );
+}
+
+/**
+ * Interface of decreasing MSAA state when some UNO state is decreased.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @param pState The lost state of control.
+ * @return
+ */
+void AccObjectManagerAgent::DecreaseState( XAccessible* pXAcc,unsigned short pState )
+{
+ if(pWinManager)
+ {
+ pWinManager->DecreaseState( pXAcc, pState );
+ }
+}
+
+/**
+ * Interface of increasing MSAA name when some UNO state is increased.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @param pState The new state of control.
+ * @return
+ */
+void AccObjectManagerAgent::IncreaseState( XAccessible* pXAcc,unsigned short pState )
+{
+ if(pWinManager)
+ {
+ pWinManager->IncreaseState( pXAcc, pState );
+ }
+}
+
+void AccObjectManagerAgent::UpdateState( com::sun::star::accessibility::XAccessible* pXAcc )
+{
+ if(pWinManager)
+ pWinManager->UpdateState(pXAcc);
+}
+
+/**
+ * Interface of notify MSAA event when some UNO event occured.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @param pEvent UNO event ID.
+ * @return If the method is correctly processed.
+ */
+unsigned char AccObjectManagerAgent::NotifyAccEvent( short pEvent,XAccessible* pXAcc )
+{
+ if(pWinManager)
+ return (unsigned char)pWinManager->NotifyAccEvent(pXAcc,pEvent);
+
+ return sal_False;
+}
+
+/**
+ * Judge whether a XAccessible object is a container object.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @return If the method is correctly processed.
+ */
+unsigned short AccObjectManagerAgent::IsContainer( XAccessible* pXAcc )
+{
+ if(pWinManager)
+ return (unsigned char)pWinManager->IsContainer(pXAcc);
+
+ return sal_False;
+}
+
+/**
+ * Return com object interface by querying XAccessible interface.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @return Com interface.
+ */
+IMAccessible* AccObjectManagerAgent::GetIMAccByXAcc(XAccessible* pXAcc)
+{
+ if(pWinManager)
+ return pWinManager->GetIMAccByXAcc(pXAcc);
+
+ return NULL;
+}
+
+/**
+ * Notify manger when a XAccessible object is destroying.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @return.
+ */
+void AccObjectManagerAgent::NotifyDestroy(XAccessible* pXAcc)
+{
+ if(pWinManager)
+ pWinManager->NotifyDestroy(pXAcc);
+}
+
+/**
+ * Return com object interface by querying child id.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @return Com interface.
+ */
+void AccObjectManagerAgent::GetIAccessibleFromResID(long childID,IMAccessible** pIMAcc)
+{
+ if(pWinManager)
+ *pIMAcc = pWinManager->GetIAccessibleFromResID(childID);
+}
+
+/**
+ * Return object interface by querying interface.
+ * @param pXAcc Uno XAccessible interface of control.
+ * @return Com interface.
+ */
+unsigned char AccObjectManagerAgent::GetIAccessibleFromXAccessible(XAccessible* pXAcc, IAccessible** ppXI)
+{
+ if(pWinManager)
+ {
+ *ppXI = (IAccessible*)pWinManager->GetIMAccByXAcc(pXAcc);
+ if(*ppXI)
+ return sal_True;
+ }
+ return sal_False;
+}
+
+XAccessible* AccObjectManagerAgent::GetParentXAccessible( XAccessible* pXAcc )
+{
+ if(pWinManager)
+ return pWinManager->GetParentXAccessible( pXAcc );
+
+ return NULL;
+}
+
+short AccObjectManagerAgent::GetParentRole( XAccessible* pXAcc )
+{
+ if(pWinManager)
+ return pWinManager->GetParentRole( pXAcc );
+
+ return -1;
+}
+
+void AccObjectManagerAgent::UpdateDescription( XAccessible* pXAcc )
+{
+ if(pWinManager)
+ pWinManager->UpdateDescription( pXAcc );
+}
+
+void AccObjectManagerAgent::UpdateChildState(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+ if(pWinManager)
+ pWinManager->UpdateChildState( pXAcc );
+}
+
+
+bool AccObjectManagerAgent::IsSpecialToolboItem(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+ if(pWinManager)
+ return pWinManager->IsSpecialToolboItem( pXAcc );
+
+ return false;
+}
+
+short AccObjectManagerAgent::GetRole(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+ if(pWinManager)
+ return pWinManager->GetRole( pXAcc );
+
+ return -1;
+}
+
+XAccessible* AccObjectManagerAgent::GetAccDocByAccTopWin( XAccessible* pXAcc )
+{
+ if (pWinManager)
+ {
+ return pWinManager->GetAccDocByAccTopWin( pXAcc );
+ }
+ return NULL;
+}
+bool AccObjectManagerAgent::IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc )
+{
+ if (pWinManager)
+ {
+ return pWinManager->IsTopWinAcc( pXAcc );
+ }
+ return NULL;
+}
+
+bool AccObjectManagerAgent::IsStateManageDescendant(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+ if(pWinManager)
+ return pWinManager->IsStateManageDescendant( pXAcc );
+
+ return sal_False;
+}
diff --git a/winaccessibility/source/service/AccObjectWinManager.cxx b/winaccessibility/source/service/AccObjectWinManager.cxx
new file mode 100644
index 000000000000..08ed3efd2b43
--- /dev/null
+++ b/winaccessibility/source/service/AccObjectWinManager.cxx
@@ -0,0 +1,1321 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <cassert>
+
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+#include <oleacc.h>
+#ifndef _SV_AccObjectWinManager_HXX
+#include "AccObjectWinManager.hxx"
+#endif
+#include "AccEventListener.hxx"
+#include "AccComponentEventListener.hxx"
+#include "AccContainerEventListener.hxx"
+#include "AccDialogEventListener.hxx"
+#include "AccWindowEventListener.hxx"
+#include "AccFrameEventListener.hxx"
+#include "AccMenuEventListener.hxx"
+#include "AccObjectContainerEventListener.hxx"
+#include "AccParagraphEventListener.hxx"
+#include "AccTextComponentEventListener.hxx"
+#include "AccListEventListener.hxx"
+#include "AccTreeEventListener.hxx"
+#include "AccTableEventListener.hxx"
+#include "AccObject.hxx"
+#include "unomsaaevent.hxx"
+#include "checkmt.hxx"
+
+#define CHILDID_SELF 0
+
+
+using namespace std;
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+AccObjectWinManager* g_acc_manager = NULL;
+AccObjectWinManager* AccObjectWinManager::me = NULL;
+
+/**
+ * Implementation of interface XMSAAService's method getAccObjectPtr() that return the
+ * corresponding com interface with the MS event.
+ *
+ * @param
+ * @return Com interface.
+ */
+long GetMSComPtr(long hWnd, long lParam, long wParam)
+{
+ if( g_acc_manager )
+ return (long)g_acc_manager->Get_ToATInterface(HWND((void*)hWnd),lParam,wParam );
+ return NULL;
+}
+
+/**
+ * constructor
+ * @param Agent The agent kept in all listeners,it's the sole interface by which
+ * listener communicate with windows manager.
+ * pEventAccObj The present event accobject.
+ * oldFocus Last focused object.
+ * isSelectionChanged flag that identifies if there is selection changed.
+ * selectionChildObj Selected object.
+ * dChildID Chile resource ID.
+ * hAcc TopWindowHWND
+ * @return
+ */
+AccObjectWinManager::AccObjectWinManager( AccObjectManagerAgent* Agent ):
+ pAgent( Agent ),
+ oldFocus( NULL )
+{
+}
+
+/**
+ * Public method to produce manager
+ * @param Agent The agent kept in all listeners,it's the sole interface by which
+ * listener communicate with windows manager.
+ * @return
+ */
+AccObjectWinManager* AccObjectWinManager::CreateAccObjectWinManagerInstance( AccObjectManagerAgent* Agent )
+{
+ if( me == NULL )
+ {
+ me = new AccObjectWinManager( Agent );
+ g_acc_manager = me;
+ return me;
+ }
+
+ return me;
+}
+
+
+/**
+ * Destructor,clear all resource.
+ * @param
+ * @return
+ */
+AccObjectWinManager::~AccObjectWinManager()
+{
+ XIdAccList.clear();
+ HwndXAcc.clear();
+ XResIdAccList.clear();
+ XHWNDDocList.clear();
+#ifdef ACC_DEBUG
+
+ fclose( pFile );
+#endif
+}
+
+
+/**
+ * Get valid com object interface when notifying some MSAA event
+ * @param pWND The top window handle that contains that event control.
+ * @param wParam Windows system interface.
+ * @return Com interface with event.
+ */
+
+long AccObjectWinManager::Get_ToATInterface( HWND hWnd, long lParam, long wParam)
+{
+ vos::OGuard localGuard(maATInterfaceMutex);//
+
+ IMAccessible* pRetIMAcc = NULL;
+
+ if(lParam == OBJID_CLIENT )
+ {
+ AccObject* topWindowAccObj = GetTopWindowAccObj(hWnd);
+ if(topWindowAccObj)
+ {
+ pRetIMAcc = topWindowAccObj->GetIMAccessible();
+ if(pRetIMAcc)
+ pRetIMAcc->AddRef();//increase COM reference count
+ }
+ }
+
+ if ( pRetIMAcc && lParam == OBJID_CLIENT )
+ {
+ IAccessible* pTemp = dynamic_cast<IAccessible*>( pRetIMAcc );
+ HRESULT result = LresultFromObject(IID_IAccessible, wParam, pTemp);
+ pTemp->Release();
+ return result;
+ }
+ return 0;
+}
+
+/**
+ * Search AccObject by XAccessible pointer from our container.
+ * @param pXAcc XAccessible interface.
+ * @return Pointer of accObject that is found.
+ */
+AccObject* AccObjectWinManager::GetAccObjByXAcc( XAccessible* pXAcc)
+{
+ if( pXAcc == NULL)
+ return NULL;
+
+ XIdToAccObjHash::iterator pIndTemp = XIdAccList.find( (void*)pXAcc );
+ if ( pIndTemp == XIdAccList.end() )
+ return NULL;
+
+ return &(pIndTemp->second);
+}
+
+/**
+ * Search XAccessible by AccObject pointer from our container.
+ * @param pAccObj AccObject pointer.
+ * @return Pointer of XAccessible Interface.
+ */
+XAccessible* AccObjectWinManager::GetXAccByAccObj(AccObject* pAccObj)
+{
+ XIdToAccObjHash::iterator iter = XIdAccList.begin();
+ while(iter!=XIdAccList.end())
+ {
+ AccObject* tmp = &(iter->second);
+ if(tmp== pAccObj)
+ return (XAccessible*)(iter->first);
+ iter++;
+ }
+ return NULL;
+}
+
+/**
+ * get acc object of top window by its handle
+ * @param hWnd, top window handle
+ * @return pointer to AccObject
+ */
+AccObject* AccObjectWinManager::GetTopWindowAccObj(HWND hWnd)
+{
+ XHWNDToXAccHash::iterator iterResult =HwndXAcc.find(hWnd);
+ if(iterResult == HwndXAcc.end())
+ return NULL;
+ XAccessible* pXAcc = (XAccessible*)(iterResult->second);
+ return GetAccObjByXAcc(pXAcc);
+}
+
+/**
+ * Simulate MSAA event via XAccessible interface and event type.
+ * @param pXAcc XAccessible interface.
+ * @param state Customize Interface
+ * @return The terminate result that identifies if the call is successful.
+ */
+sal_Bool AccObjectWinManager::NotifyAccEvent(XAccessible* pXAcc,short state)
+{
+ vos::OGuard aGuard(aNotifyMutex);
+
+ if (!IsInMainThread())
+ {
+ return sal_False;
+ }
+
+ Reference< XAccessibleContext > pRContext;
+
+ if( pXAcc == NULL)
+ return sal_False;
+
+
+ pRContext = pXAcc->getAccessibleContext();
+ if( !pRContext.is() )
+ return sal_False;
+
+
+ AccObject* selfAccObj= GetAccObjByXAcc(pXAcc);
+
+ if(selfAccObj==NULL)
+ return sal_False;
+
+ int selectNum =0;
+
+ long dChildID = selfAccObj->GetResID();
+ HWND hAcc = selfAccObj->GetParentHWND();
+
+ switch(state)
+ {
+ case UM_EVENT_STATE_FOCUSED:
+ {
+ UpdateAccFocus(pXAcc);
+ if( selfAccObj )
+ selfAccObj->UpdateDefaultAction( );
+ UpdateValue(pXAcc);
+ NotifyWinEvent( EVENT_OBJECT_FOCUS,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ }
+ case UM_EVENT_STATE_BUSY:
+ NotifyWinEvent( EVENT_OBJECT_STATECHANGE,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_STATE_CHECKED:
+ NotifyWinEvent( EVENT_OBJECT_STATECHANGE,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_STATE_PRESSED:
+ NotifyWinEvent( EVENT_OBJECT_STATECHANGE,hAcc, OBJID_CLIENT,dChildID );
+ break;
+
+ //Removed fire out selected event
+ //case UM_EVENT_STATE_SELECTED:
+ // NotifyWinEvent( EVENT_OBJECT_STATECHANGE,hAcc, OBJID_CLIENT,dChildID );
+ // break;
+ case UM_EVENT_STATE_ARMED:
+ UpdateAccFocus(pXAcc);
+ NotifyWinEvent( EVENT_OBJECT_FOCUS,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_MENU_START:
+ NotifyWinEvent( EVENT_SYSTEM_MENUSTART,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_MENU_END:
+ NotifyWinEvent( EVENT_SYSTEM_MENUEND,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_MENUPOPUPSTART:
+ NotifyWinEvent( EVENT_SYSTEM_MENUPOPUPSTART,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_MENUPOPUPEND:
+ NotifyWinEvent( EVENT_SYSTEM_MENUPOPUPEND,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_SELECTION_CHANGED:
+ NotifyWinEvent( EVENT_OBJECT_SELECTION,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_SELECTION_CHANGED_ADD:
+ NotifyWinEvent( EVENT_OBJECT_SELECTIONADD,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_SELECTION_CHANGED_REMOVE:
+ NotifyWinEvent( EVENT_OBJECT_SELECTIONREMOVE,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_SELECTION_CHANGED_WITHIN:
+ NotifyWinEvent( EVENT_OBJECT_SELECTIONWITHIN,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_OBJECT_VALUECHANGE:
+ UpdateValue(pXAcc);
+ NotifyWinEvent( EVENT_OBJECT_VALUECHANGE,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_OBJECT_NAMECHANGE:
+ NotifyWinEvent( EVENT_OBJECT_NAMECHANGE,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_OBJECT_DESCRIPTIONCHANGE:
+ NotifyWinEvent( EVENT_OBJECT_DESCRIPTIONCHANGE,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_OBJECT_DEFACTIONCHANGE:
+ NotifyWinEvent( IA2_EVENT_ACTION_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_OBJECT_CARETCHANGE:
+ NotifyWinEvent( IA2_EVENT_TEXT_CARET_MOVED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_OBJECT_TEXTCHANGE:
+ NotifyWinEvent( IA2_EVENT_TEXT_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_ACTIVE_DESCENDANT_CHANGED:
+ UpdateAccFocus(pXAcc);
+ NotifyWinEvent( EVENT_OBJECT_FOCUS,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_BOUNDRECT_CHANGED:
+ NotifyWinEvent( EVENT_OBJECT_LOCATIONCHANGE,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_VISIBLE_DATA_CHANGED:
+ NotifyWinEvent( IA2_EVENT_VISIBLE_DATA_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_SHOW :
+ NotifyWinEvent( EVENT_OBJECT_SHOW,hAcc, OBJID_CLIENT,dChildID );
+ NotifyWinEvent( EVENT_SYSTEM_FOREGROUND,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_TABLE_CAPTION_CHANGED:
+ NotifyWinEvent( IA2_EVENT_TABLE_CAPTION_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED:
+ NotifyWinEvent( IA2_EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_TABLE_COLUMN_HEADER_CHANGED:
+ NotifyWinEvent( IA2_EVENT_TABLE_COLUMN_HEADER_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_TABLE_MODEL_CHANGED:
+ NotifyWinEvent( IA2_EVENT_TABLE_MODEL_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_TABLE_ROW_HEADER_CHANGED:
+ NotifyWinEvent( IA2_EVENT_TABLE_ROW_HEADER_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_TABLE_SUMMARY_CHANGED:
+ NotifyWinEvent( IA2_EVENT_TABLE_SUMMARY_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_TABLE_ROW_DESCRIPTION_CHANGED:
+ NotifyWinEvent( IA2_EVENT_TABLE_ROW_DESCRIPTION_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_OBJECT_REORDER:
+ NotifyWinEvent( EVENT_OBJECT_REORDER,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_PAGE_CHANGED:
+ NotifyWinEvent( IA2_EVENT_PAGE_CHANGED,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_CHILD_REMOVED:
+ NotifyWinEvent( EVENT_OBJECT_DESTROY,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_CHILD_ADDED:
+ NotifyWinEvent( EVENT_OBJECT_CREATE ,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_OBJECT_PAGECHANGED:
+ NotifyWinEvent( IA2_EVENT_PAGE_CHANGED ,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_TEXT_SELECTION_CHANGED:
+ NotifyWinEvent( IA2_EVENT_TEXT_SELECTION_CHANGED ,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_SECTION_CHANGED:
+ NotifyWinEvent( IA2_EVENT_SECTION_CHANGED ,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ case UM_EVENT_COLUMN_CHANGED:
+ NotifyWinEvent( IA2_EVENT_TEXT_COLUMN_CHANGED ,hAcc, OBJID_CLIENT,dChildID );
+ break;
+ default:
+ break;
+ }
+
+ return sal_True;
+}
+
+/**
+ * Get Parent XAccessible interface by XAccessible interface.
+ * @param pXAcc XAccessible interface.
+ * @return Parent XAccessible interface.
+ */
+XAccessible* AccObjectWinManager::GetParentXAccessible( XAccessible* pXAcc )
+{
+ AccObject* pObj= GetAccObjByXAcc(pXAcc);
+ if( pObj ==NULL )
+ return NULL;
+ if(pObj->GetParentObj())
+ {
+ pObj = pObj->GetParentObj();
+ return pObj->GetXAccessible().get();
+ }
+ return NULL;
+}
+
+/**
+ * Get Parent role by XAccessible interface.
+ * @param pXAcc XAccessible interface.
+ * @return Parent role.
+ */
+short AccObjectWinManager::GetParentRole( XAccessible* pXAcc )
+{
+ AccObject* pObj= GetAccObjByXAcc(pXAcc);
+ if( pObj ==NULL )
+ return -1;
+ if(pObj->GetParentObj())
+ {
+ pObj = pObj->GetParentObj();
+ if(pObj->GetXAccessible().is())
+ {
+ XAccessible* pXAcc = pObj->GetXAccessible().get();
+ Reference< XAccessibleContext > pRContext = pXAcc->getAccessibleContext();
+ if(pRContext.is())
+ return pRContext->getAccessibleRole();
+ }
+ }
+ return -1;
+}
+
+/**
+ * Update focus objcet by new focused XAccessible interface.
+ * @param newFocus New XAccessible interface that gets focus.
+ * @return
+ */
+void AccObjectWinManager::UpdateAccFocus(XAccessible* newFocus)
+{
+ AccObject* pAccObjNew = GetAccObjByXAcc(newFocus);
+ if(pAccObjNew)
+ {
+ AccObject* pAccObjOld = GetAccObjByXAcc(oldFocus);
+ oldFocus = newFocus;
+ pAccObjNew->setFocus();
+ //if old == new, the pAccObjNew will be without focused state
+ if (pAccObjOld && pAccObjOld != pAccObjNew)
+ pAccObjOld->unsetFocus();
+ }
+}
+
+/**
+ * Update selected objcet by new focused XAccessible interface.
+ * @param pXAcc XAccessible interface that has selected child changed.
+ * @return Selected children count.
+ */
+int AccObjectWinManager::UpdateAccSelection(XAccessible* pXAcc)
+{
+ XAccessibleSelection* pSelection = NULL;
+ Reference< XAccessibleContext > pRContext;
+
+ if( pXAcc == NULL)
+ return sal_False;
+
+ pRContext = pXAcc->getAccessibleContext();
+ if( !pRContext.is() )
+ return sal_False;
+
+ Reference< XAccessibleSelection > pRSelection(pRContext,UNO_QUERY);
+ if( !pRSelection.is() )
+ return sal_False;
+
+ AccObject* pAccObj = GetAccObjByXAcc(pXAcc);
+ if(pAccObj==NULL)
+ return sal_False;
+
+ Reference<XAccessible> pRChild = NULL;
+ AccObject* pAccChildObj = NULL;
+ int selectNum= pRSelection->getSelectedAccessibleChildCount();
+
+ IAccSelectionList oldSelection = pAccObj->GetSelection();
+
+ if(selectNum > 4)//for selected.
+ return selectNum;
+ if(selectNum == 1 && oldSelection.size() == 0)
+ return 1;
+
+ for (int i=0;i<selectNum;i++)
+ {
+ pRChild = pRSelection->getSelectedAccessibleChild(i);
+ if(!pRChild.is())
+ {
+ continue;
+ }
+ Reference<XAccessibleContext> pRChildContext = pRChild->getAccessibleContext();
+ if(!pRChildContext.is())
+ {
+ continue;
+ }
+ long index = pRChildContext->getAccessibleIndexInParent();
+ IAccSelectionList::iterator temp = oldSelection.find(index);
+ if ( temp != oldSelection.end() )
+ {
+ oldSelection.erase(index);
+ continue;
+ }
+
+ pAccChildObj = NULL;
+ pAccChildObj = GetAccObjByXAcc(pRChild.get());
+ if(!pAccChildObj)
+ {
+ InsertAccObj(pRChild.get(), pXAcc,pAccObj->GetParentHWND());
+ pAccChildObj = GetAccObjByXAcc(pRChild.get());
+ }
+
+ pAccObj->AddSelect(index, pAccChildObj);
+
+ if(pAccChildObj != NULL)
+ NotifyWinEvent(EVENT_OBJECT_SELECTIONADD,pAccObj->GetParentHWND(), OBJID_CLIENT,pAccChildObj->GetResID());
+ }
+
+ IAccSelectionList::iterator iter = oldSelection.begin();
+ while(iter!=oldSelection.end())
+ {
+ pAccObj->GetSelection().erase(iter->first);
+ pAccChildObj = (AccObject*)(iter->second);
+ if(pAccChildObj != NULL)
+ NotifyWinEvent(EVENT_OBJECT_SELECTIONREMOVE,pAccObj->GetParentHWND(), OBJID_CLIENT,pAccChildObj->GetResID());
+ iter++;
+ }
+ return 0;
+
+}
+
+/**
+ * Delete child element from children list.
+ * @param pObj Child element that should be removed from parant child list.
+ * @return
+ */
+void AccObjectWinManager::DeleteAccChildNode( AccObject* pObj )
+{
+ AccObject *parentAccObj = pObj->GetParentObj();
+ if( parentAccObj )
+ parentAccObj->DeleteChild( pObj );
+}
+
+/**
+ * Delete XAccessible items in top window handle hashtable
+ * @param pXAcc XAccessible interface.
+ * @return
+ */
+void AccObjectWinManager::DeleteFromHwndXAcc(XAccessible* pXAcc )
+{
+ XHWNDToXAccHash::iterator iter = HwndXAcc.begin();
+ while(iter!=HwndXAcc.end())
+ {
+ if(iter->second == pXAcc )
+ {
+ HwndXAcc.erase(iter);
+ return;
+ }
+ iter++;
+ }
+}
+
+/**
+ * Delete Delete all children with the tree root of XAccessible pointer
+ * @param pXAcc Tree root XAccessible interface.
+ * @return
+ */
+void AccObjectWinManager::DeleteChildrenAccObj(XAccessible* pXAcc)
+{
+ vos::OGuard aGuard( aDeleteMutex );
+ AccObject* currentObj=NULL;
+ AccObject* childObj=NULL;
+ XAccessible* pTmpXAcc=NULL;
+
+ currentObj = GetAccObjByXAcc( pXAcc);
+ if(currentObj)
+ {
+ childObj = currentObj->NextChild();
+ while(childObj)
+ {
+ pTmpXAcc = GetXAccByAccObj(childObj);
+ if(pTmpXAcc)
+ {
+ DeleteChildrenAccObj(pTmpXAcc);
+ DeleteAccObj(pTmpXAcc);
+ }
+ childObj = currentObj->NextChild();
+ }
+ }
+}
+
+/**
+ * Delete Delete Acc object self.
+ * @param pXAcc The XAccessible interface.
+ * @return
+ */
+void AccObjectWinManager::DeleteAccObj( XAccessible* pXAcc )
+{
+ vos::OGuard aGuard( aDeleteMutex );
+ if( pXAcc == NULL )
+ return;
+ XIdToAccObjHash::iterator temp = XIdAccList.find(pXAcc);
+ if( temp != XIdAccList.end() )
+ {
+ ResIdGen.SetSub( temp->second.GetResID() );
+ }
+ else
+ {
+ return;
+ }
+
+ AccObject& accObj = temp->second;
+ DeleteAccChildNode( &accObj );
+ DeleteAccListener( &accObj );
+ if( accObj.GetIMAccessible() )
+ {
+ accObj.GetIMAccessible()->Release();
+ }
+ XIdAccList.erase( pXAcc );
+ XResIdAccList.erase( accObj.GetResID() );
+ DeleteFromHwndXAcc(pXAcc);
+}
+
+/**
+ * Delete listener that inspects some XAccessible object
+ * @param pAccObj Accobject pointer.
+ * @return
+ */
+void AccObjectWinManager::DeleteAccListener( AccObject* pAccObj )
+{
+ AccEventListener* listener = pAccObj->getListener();
+ if( listener==NULL )
+ return;
+ listener->removeMeFromBroadcaster();
+ pAccObj->SetListener(NULL);
+}
+
+/**
+ * Generate a child ID, which is used for AT
+ * @param
+ * @return New resource ID.
+ */
+inline long AccObjectWinManager::ImpleGenerateResID()
+{
+ return ResIdGen.GenerateNewResID();
+}
+
+/**
+ * Insert all children of the current acc object
+ * @param pXAcc XAccessible interface
+ * @param pWnd Top Window handle
+ * @return The calling result.
+ */
+sal_Bool AccObjectWinManager::InsertChildrenAccObj( com::sun::star::accessibility::XAccessible* pXAcc,
+ HWND pWnd)
+{
+ if(!IsContainer(pXAcc))
+ return sal_False;
+
+ Reference< XAccessibleContext > pRContext;
+
+ if( pXAcc == NULL)
+ return sal_False;
+ pRContext = pXAcc->getAccessibleContext();
+ if( !pRContext.is() )
+ return sal_False;
+
+ short role = pRContext->getAccessibleRole();
+
+ if(com::sun::star::accessibility::AccessibleRole::DOCUMENT == role )
+ {
+ if(IsStateManageDescendant(pXAcc))
+ {
+ return sal_True;
+ }
+ }
+
+ int count = pRContext->getAccessibleChildCount();
+ for (int i=0;i<count;i++)
+ {
+ Reference<XAccessible> mxAccessible
+ = pRContext->getAccessibleChild(i);
+ XAccessible* mpAccessible = mxAccessible.get();
+ if(mpAccessible != NULL)
+ {
+ InsertAccObj( mpAccessible,pXAcc,pWnd );
+ InsertChildrenAccObj(mpAccessible,pWnd);
+ }
+ }
+
+ return sal_True;
+}
+
+/**
+ * Insert child object.
+ * @param pCurObj The child object
+ * @param pParentObj The parant object
+ * @param pWnd Top window handle.
+ * @return
+ */
+void AccObjectWinManager::InsertAccChildNode( AccObject* pCurObj, AccObject* pParentObj, HWND /* pWnd */ )
+{
+ if(pCurObj)
+ {
+ if(pParentObj)
+ {
+ pParentObj->InsertChild(pCurObj);
+ }
+ else
+ {
+ pCurObj->UpdateValidWindow();
+ }
+ }
+}
+
+/**
+ * Insert child object.
+ * @param pCurObj The child object
+ * @param pParentObj The parant object
+ * @param pWnd Top window handle.
+ * @return
+ */
+sal_Bool AccObjectWinManager::InsertAccObj( XAccessible* pXAcc,XAccessible* pParentXAcc,HWND pWnd )
+{
+ XIdToAccObjHash::iterator itXacc = XIdAccList.find( (void*)pXAcc );
+ if (itXacc != XIdAccList.end() )
+ {
+ short nCurRole =GetRole(pXAcc);
+ if (AccessibleRole::SHAPE == nCurRole)
+ {
+ AccObject &objXacc = itXacc->second;
+ AccObject *pObjParent = objXacc.GetParentObj();
+ if (pObjParent &&
+ pObjParent->GetXAccessible().is() &&
+ pObjParent->GetXAccessible().get() != pParentXAcc)
+ {
+ XIdToAccObjHash::iterator itXaccParent = XIdAccList.find( (void*)pParentXAcc );
+ if(itXaccParent != XIdAccList.end())
+ {
+ objXacc.SetParentObj(&(itXaccParent->second));
+ }
+ }
+ }
+ return sal_False;
+ }
+
+
+ Reference< XAccessibleContext > pRContext;
+
+ if( pXAcc == NULL)
+ return sal_False;
+
+ pRContext = pXAcc->getAccessibleContext();
+ if( !pRContext.is() )
+ return sal_False;
+
+ if( pWnd == NULL )
+ {
+ if(pParentXAcc)
+ {
+ AccObject* pObj = GetAccObjByXAcc(pParentXAcc);
+ if(pObj)
+ pWnd = pObj->GetParentHWND();
+ }
+ if( pWnd == NULL )
+ return sal_False;
+ }
+
+ AccObject pObj( pXAcc,pAgent );
+ if( pObj.GetIMAccessible() == NULL )
+ return sal_False;
+ pObj.SetResID( this->ImpleGenerateResID());
+ pObj.SetParentHWND( pWnd );
+
+ //for file name support
+ if ( pObj.GetRole() == DOCUMENT )
+ {
+ XHWNDToDocumentHash::iterator aIter = XHWNDDocList.find( (long)pWnd );
+ if ( aIter != XHWNDDocList.end() )
+ {
+ XHWNDDocList.erase( aIter );
+ }
+ XHWNDDocList.insert( XHWNDToDocumentHash::value_type( (long)pWnd, pXAcc ) );
+
+ }
+ //end of file name
+
+ AccEventListener* listener = createAccEventListener(pXAcc, pAgent);
+ if(listener==NULL)
+ return sal_False;
+ Reference<XAccessibleComponent> xComponent(pRContext,UNO_QUERY);
+ Reference<XAccessibleEventBroadcaster> broadcaster(xComponent,UNO_QUERY);
+ if (broadcaster.is())
+ {
+ Reference <XAccessibleEventListener> pp (
+ static_cast< XAccessibleEventListener* >(listener),UNO_QUERY );
+ if(pp.is())
+ {
+ broadcaster->addEventListener(pp);
+ }
+ else
+ {
+ delete listener;
+ return sal_False;
+ }
+ }
+ else
+ return sal_False;
+
+ XIdAccList.insert( XIdToAccObjHash::value_type( (void*)pXAcc, pObj ));
+ XIdToAccObjHash::iterator pIndTemp = XIdAccList.find( (void*)pXAcc );
+ XResIdAccList.insert(XResIdToAccObjHash::value_type(pObj.GetResID(),&(pIndTemp->second)));
+
+ AccObject* pCurObj = GetAccObjByXAcc(pXAcc);
+ if( pCurObj )
+ {
+ pCurObj->SetListener( listener );
+ if(listener != NULL)
+ listener->acquire();
+ }
+
+ AccObject* pParentObj = GetAccObjByXAcc(pParentXAcc);
+ InsertAccChildNode(pCurObj,pParentObj,pWnd);
+ if( pCurObj )
+ pCurObj->UpdateAccessibleInfoFromUnoToMSAA();
+ return sal_True;
+}
+
+
+/**
+ * save the pair <topwindowhandle, XAccessible>
+ * @param hWnd, top window handle
+ * @param pXAcc XAccessible interface for top window
+ * @return void
+ */
+void AccObjectWinManager::SaveTopWindowHandle(HWND hWnd, com::sun::star::accessibility::XAccessible* pXAcc)
+{
+ HwndXAcc.insert( XHWNDToXAccHash::value_type( hWnd,(void*)pXAcc ) );
+}
+
+
+/**
+ * create the corresponding listener.
+ * @param pXAcc XAccessible interface.
+ * @param Agent The agent kept in all listeners,it's the sole interface by which
+ * listener communicate with windows manager.
+ * @return
+ */
+AccEventListener* AccObjectWinManager::createAccEventListener(XAccessible* pXAcc, AccObjectManagerAgent* /* Agent */ )
+{
+ AccEventListener* listener = NULL;
+ Reference<XAccessibleContext> xContext(pXAcc->getAccessibleContext(),UNO_QUERY);
+ if(xContext.is())
+ {
+ switch( xContext->getAccessibleRole() )
+ {
+ case /*AccessibleRole::*/DIALOG:
+ listener = new AccDialogEventListener(pXAcc,pAgent);
+ break;
+ case /*AccessibleRole::*/FRAME:
+ listener = new AccFrameEventListener(pXAcc,pAgent);
+ break;
+ case /*AccessibleRole::*/WINDOW:
+ listener = new AccWindowEventListener(pXAcc,pAgent);
+ break;
+ case /*AccessibleRole::*/ROOT_PANE:
+ listener = new AccFrameEventListener(pXAcc,pAgent);
+ break;
+ //Container
+ case /*AccessibleRole::*/CANVAS:
+ case /*AccessibleRole::*/COMBO_BOX:
+ case /*AccessibleRole::*/DOCUMENT:
+ case /*AccessibleRole::*/END_NOTE:
+ case /*AccessibleRole::*/FILLER:
+ case /*AccessibleRole::*/FOOTNOTE:
+ case /*AccessibleRole::*/FOOTER:
+ case /*AccessibleRole::*/HEADER:
+ case /*AccessibleRole::*/LAYERED_PANE:
+ case /*AccessibleRole::*/MENU_BAR:
+ case /*AccessibleRole::*/POPUP_MENU:
+ case /*AccessibleRole::*/OPTION_PANE:
+ case /*AccessibleRole::*/PAGE_TAB:
+ case /*AccessibleRole::*/PAGE_TAB_LIST:
+ case /*AccessibleRole::*/PANEL:
+ case /*AccessibleRole::*/SCROLL_PANE:
+ case /*AccessibleRole::*/SPLIT_PANE:
+ case /*AccessibleRole::*/STATUS_BAR:
+ case /*AccessibleRole::*/TABLE_CELL:
+ case /*AccessibleRole::*/TOOL_BAR:
+ case /*AccessibleRole::*/VIEW_PORT:
+ listener = new AccContainerEventListener(pXAcc,pAgent);
+ break;
+ case /*AccessibleRole::*/PARAGRAPH:
+ case /*AccessibleRole::*/HEADING:
+ listener = new AccParagraphEventListener(pXAcc,pAgent);
+ break;
+ //Component
+ case /*AccessibleRole::*/CHECK_BOX:
+ case /*AccessibleRole::*/ICON:
+ case /*AccessibleRole::*/LABEL:
+ case /*AccessibleRole::*/MENU_ITEM:
+ case /*AccessibleRole::*/CHECK_MENU_ITEM:
+ case /*AccessibleRole::*/RADIO_MENU_ITEM:
+ case /*AccessibleRole::*/PUSH_BUTTON:
+ case /*AccessibleRole::*/RADIO_BUTTON:
+ case /*AccessibleRole::*/SCROLL_BAR:
+ case /*AccessibleRole::*/SEPARATOR:
+ case /*AccessibleRole::*/TOGGLE_BUTTON:
+ case /*AccessibleRole::*/BUTTON_DROPDOWN:
+ case /*AccessibleRole::*/TOOL_TIP:
+ case /*AccessibleRole::*/SPIN_BOX:
+ case DATE_EDITOR:
+ listener = new AccComponentEventListener(pXAcc,pAgent);
+ break;
+ //text component
+ case /*AccessibleRole::*/TEXT:
+ listener = new AccTextComponentEventListener(pXAcc,pAgent);
+ break;
+ //menu
+ case /*AccessibleRole::*/MENU:
+ listener = new AccMenuEventListener(pXAcc,pAgent);
+ break;
+ //object container
+ case /*AccessibleRole::*/SHAPE:
+
+ case /*AccessibleRole::*/EMBEDDED_OBJECT:
+ case /*AccessibleRole::*/GRAPHIC:
+ case /*AccessibleRole::*/TEXT_FRAME:
+ listener = new AccObjectContainerEventListener(pXAcc,pAgent);
+ break;
+ //descendmanager
+ case /*AccessibleRole::*/LIST:
+ listener = new AccListEventListener(pXAcc,pAgent);
+ break;
+ case /*AccessibleRole::*/TREE:
+ listener = new AccTreeEventListener(pXAcc,pAgent);
+ break;
+ //special
+ case /*AccessibleRole::*/COLUMN_HEADER:
+ case /*AccessibleRole::*/TABLE:
+ listener = new AccTableEventListener(pXAcc,pAgent);
+ break;
+ default:
+ listener = new AccContainerEventListener(pXAcc,pAgent);
+ break;
+ }
+ }
+
+ return listener;
+}
+
+/**
+ * state is a combination integer, each bit of which represents a single state,
+ * such as focused,1 for the state on,0 for the state off. Here call COM interface
+ * to modify the state value, including DecreaseState.
+ * @param pXAcc XAccessible interface.
+ * @param pState Changed state.
+ * @return
+ */
+void AccObjectWinManager::DecreaseState( XAccessible* pXAcc,unsigned short pState )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if( pAccObj )
+ pAccObj->DecreaseState( pState );
+}
+
+/**
+ * state is a combination integer, each bit of which represents a single state,such as focused,1 for
+ * the state on,0 for the state off. Here call COM interface to modify the state value, including
+ * IncreaseState.
+ * @param pXAcc XAccessible interface.
+ * @param pState Changed state.
+ * @return
+ */
+void AccObjectWinManager::IncreaseState( XAccessible* pXAcc,unsigned short pState )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if( pAccObj )
+ pAccObj->IncreaseState( pState );
+}
+
+void AccObjectWinManager::UpdateState( com::sun::star::accessibility::XAccessible* pXAcc )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if( pAccObj )
+ pAccObj->UpdateState( );
+}
+
+/**
+ * Set corresponding com object's accessible name via XAccessilbe interface and new
+ * name
+ * @param pXAcc XAccessible interface.
+ * @return
+ */
+void AccObjectWinManager::UpdateAccName( XAccessible* pXAcc )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if( pAccObj )
+ pAccObj->UpdateName();
+}
+
+void AccObjectWinManager::UpdateAction( XAccessible* pXAcc )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if( pAccObj )
+ pAccObj->UpdateAction();
+}
+
+void AccObjectWinManager::UpdateDescription( XAccessible* pXAcc )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if ( pAccObj )
+ pAccObj->UpdateDescription();
+}
+
+/**
+ * Set corresponding com object's accessible location via XAccessilbe interface and new
+ * location.
+ * @param pXAcc XAccessible interface.
+ * @return
+ */
+void AccObjectWinManager::SetLocation( XAccessible* pXAcc, long /*top*/, long /*left*/, long /*width*/, long /*height*/ )
+{
+ AccObject* pObj = GetAccObjByXAcc( pXAcc );
+ //get the location from XComponent.
+ Reference< XAccessibleContext > pRContext = pXAcc->getAccessibleContext();
+ if( pObj )
+ pObj->UpdateLocation();
+}
+
+/**
+ * Set corresponding com object's value via XAccessilbe interface and new value.
+ * @param pXAcc XAccessible interface.
+ * @param pAny new value.
+ * @return
+ */
+void AccObjectWinManager::SetValue( XAccessible* pXAcc, Any pAny )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if( pAccObj )
+ pAccObj->SetValue( pAny );
+}
+
+/**
+ * Set corresponding com object's value via XAccessilbe interface.
+ * @param pXAcc XAccessible interface.
+ * @return
+ */
+void AccObjectWinManager::UpdateValue( XAccessible* pXAcc )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if( pAccObj )
+ pAccObj->UpdateValue();
+}
+
+/**
+ * Set corresponding com object's name via XAccessilbe interface and new name.
+ * @param pXAcc XAccessible interface.
+ * @param newName new name
+ * @return
+ */
+void AccObjectWinManager::SetAccName( XAccessible* pXAcc, Any newName)
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if( pAccObj )
+ pAccObj->SetName( newName );
+}
+
+/**
+ * Set corresponding com object's description via XAccessilbe interface and new description.
+ * @param pXAcc XAccessible interface.
+ * @param newDesc new description
+ * @return
+ */
+void AccObjectWinManager::SetDescription( XAccessible* pXAcc, Any newDesc )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if( pAccObj )
+ pAccObj->SetDescription( newDesc );
+}
+
+/**
+ * Set corresponding com object's role via XAccessilbe interface and new role.
+ * @param pXAcc XAccessible interface.
+ * @param Role new role
+ * @return
+ */
+void AccObjectWinManager::SetRole( XAccessible* pXAcc, long Role )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if( pAccObj )
+ pAccObj->SetRole( (short)Role );
+}
+
+/**
+ * Judge if a XAccessible object is a container object.
+ * @param pAccessible XAccessible interface.
+ * @return If XAccessible object is container.
+ */
+sal_Bool AccObjectWinManager::IsContainer(XAccessible* pAccessible)
+{
+ try
+ {
+ if(pAccessible)
+ {
+ Reference<XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+ if(xContext.is())
+ {
+ switch( xContext->getAccessibleRole() )
+ {
+ case /*AccessibleRole::*/DIALOG:
+ case /*AccessibleRole::*/FRAME:
+ case /*AccessibleRole::*/WINDOW:
+ case /*AccessibleRole::*/ROOT_PANE:
+ case /*AccessibleRole::*/CANVAS:
+ case /*AccessibleRole::*/COMBO_BOX:
+ case /*AccessibleRole::*/DOCUMENT:
+ case /*AccessibleRole::*/EMBEDDED_OBJECT:
+ case /*AccessibleRole::*/END_NOTE:
+ case /*AccessibleRole::*/FILLER:
+ case /*AccessibleRole::*/FOOTNOTE:
+ case /*AccessibleRole::*/FOOTER:
+ case /*AccessibleRole::*/GRAPHIC:
+ case /*AccessibleRole::*/GROUP_BOX:
+ case /*AccessibleRole::*/HEADER:
+ case /*AccessibleRole::*/LAYERED_PANE:
+ case /*AccessibleRole::*/MENU_BAR:
+ case /*AccessibleRole::*/POPUP_MENU:
+ case /*AccessibleRole::*/OPTION_PANE:
+ case /*AccessibleRole::*/PAGE_TAB:
+ case /*AccessibleRole::*/PAGE_TAB_LIST:
+ case /*AccessibleRole::*/PANEL:
+ case /*AccessibleRole::*/SCROLL_PANE:
+ case /*AccessibleRole::*/SPLIT_PANE:
+ case /*AccessibleRole::*/STATUS_BAR:
+ case /*AccessibleRole::*/TABLE_CELL:
+ case /*AccessibleRole::*/TEXT_FRAME:
+ case /*AccessibleRole::*/TOOL_BAR:
+ case /*AccessibleRole::*/VIEW_PORT:
+ case /*AccessibleRole::*/SHAPE:
+ return sal_True;
+ break;
+ case /*AccessibleRole::*/COLUMN_HEADER:
+ case /*AccessibleRole::*/TABLE:
+ if(!IsStateManageDescendant(pAccessible))
+ return sal_True;
+ break;
+ case /*AccessibleRole::*/MENU:
+ return sal_True;
+ break;
+ default:
+ return sal_False;
+ }
+ }
+ }
+ }
+ catch(...)
+ {
+ return sal_False;
+ }
+ return sal_False;
+}
+
+/**
+ * Judge if a XAccessible object has ManageDescendant event.
+ * @param pAccessible XAccessible interface.
+ * @return If XAccessible object is managedescendant.
+ */
+bool AccObjectWinManager::IsStateManageDescendant(XAccessible* pAccessible)
+{
+ if(pAccessible)
+ {
+ Reference<XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+ if(xContext.is())
+ {
+ Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet();
+ if( !pRState.is() )
+ return sal_False;
+
+ Sequence<short> pStates = pRState->getStates();
+ int count = pStates.getLength();
+ for( int iIndex = 0;iIndex < count;iIndex++ )
+ {
+ if(pStates[iIndex] == /*AccessibleStateType::*/MANAGES_DESCENDANTS)
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+
+/**
+ * Query and get IAccessible interface by XAccessible interface from list.
+ * @param pXAcc XAccessible interface.
+ * @return Com accobject interface.
+ */
+IMAccessible* AccObjectWinManager::GetIMAccByXAcc(XAccessible* pXAcc)
+{
+ AccObject* pAccObj = GetAccObjByXAcc(pXAcc);
+ if(pAccObj)
+ {
+ return pAccObj->GetIMAccessible();
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+/**
+ * Query and get IAccessible interface by child id from list.
+ * @param resID, childID.
+ * @return Com accobject interface.
+ */
+IMAccessible * AccObjectWinManager::GetIAccessibleFromResID(long resID)
+{
+ XResIdToAccObjHash::iterator pIndTemp = XResIdAccList.find( resID );
+ if ( pIndTemp == XResIdAccList.end() )
+ return NULL;
+
+ AccObject* pObj = pIndTemp->second;
+
+ if(pObj->GetIMAccessible())
+ return pObj->GetIMAccessible();
+ return NULL;
+}
+/**
+ * Notify some object will be destroyed.
+ * @param pXAcc XAccessible interface.
+ * @return Com accobject interface.
+ */
+void AccObjectWinManager::NotifyDestroy(XAccessible* pXAcc)
+{
+ AccObject* accObj = GetAccObjByXAcc(pXAcc);
+ if(accObj)
+ {
+ accObj->NotifyDestroy(sal_True);
+ }
+}
+
+
+void AccObjectWinManager::UpdateChildState(com::sun::star::accessibility::XAccessible* pAccSubMenu)
+{
+ Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccSubMenu,UNO_QUERY);
+ if (!xContext.is())
+ {
+ return;
+ }
+ sal_Int32 nCount = xContext->getAccessibleChildCount();
+ for (sal_Int32 i = 0 ; i < nCount ; ++i)
+ {
+ Reference<com::sun::star::accessibility::XAccessible> xChild = xContext->getAccessibleChild(i);
+ if (xChild.is())
+ {
+ AccObject *pObj = GetAccObjByXAcc(xChild.get());
+ if (pObj)
+ {
+ pObj->UpdateState();
+ }
+ }
+ }
+}
+
+
+bool AccObjectWinManager::IsSpecialToolboItem(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+ if (pXAcc && oldFocus != pXAcc)
+ {
+ if(GetParentRole(pXAcc) == TOOL_BAR)
+ {
+ Reference< XAccessibleContext > pRContext(pXAcc->getAccessibleContext());
+ if (pRContext.is())
+ {
+ if(pRContext->getAccessibleRole() == TOGGLE_BUTTON)
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+short AccObjectWinManager::GetRole(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+ assert(pXAcc != NULL);
+ Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pXAcc->getAccessibleContext(),UNO_QUERY);
+ if(xContext.is())
+ {
+ return xContext->getAccessibleRole();
+ }
+ return -1;
+}
+
+XAccessible* AccObjectWinManager::GetAccDocByHWND( long pWnd )
+{
+ XHWNDToDocumentHash::iterator aIter;
+ aIter = XHWNDDocList.find( pWnd );
+ if ( aIter != XHWNDDocList.end() )
+ {
+ return aIter->second;
+ }
+
+ return NULL;
+}
+
+XAccessible* AccObjectWinManager::GetAccDocByAccTopWin( XAccessible* pXAcc )
+{
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ long pWnd = (long)( pAccObj->GetParentHWND() );
+ return GetAccDocByHWND( pWnd );
+}
+
+bool AccObjectWinManager::IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc )
+{
+ bool bRet = false;
+ AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+ if ( pAccObj )
+ {
+ bRet = ( pAccObj->GetParentObj() == NULL );
+ }
+ return bRet;
+} \ No newline at end of file
diff --git a/winaccessibility/source/service/AccParagraphEventListener.cxx b/winaccessibility/source/service/AccParagraphEventListener.cxx
new file mode 100644
index 000000000000..fbbc8753b986
--- /dev/null
+++ b/winaccessibility/source/service/AccParagraphEventListener.cxx
@@ -0,0 +1,145 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccParagraphEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccParagraphEventListener::AccParagraphEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccContainerEventListener(pAcc, Agent)
+{}
+AccParagraphEventListener::~AccParagraphEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccParagraphEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::CARET_CHANGED:
+ handleCaretChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::VISIBLE_DATA_CHANGED:
+ handleVisibleDataChangedEvent();
+ break;
+ case AccessibleEventId::BOUNDRECT_CHANGED:
+ handleBoundrectChangedEvent();
+ break;
+ //Added for paragraph selected state.
+ case AccessibleEventId::STATE_CHANGED:
+ {
+ short State;
+ if( (aEvent.NewValue >>= State) && (State == AccessibleStateType::SELECTED) )
+ {
+ pAgent->IncreaseState( pAccessible, State);
+ break;
+ }
+ else if( (aEvent.OldValue >>= State) && (State == AccessibleStateType::SELECTED) )
+ {
+ pAgent->DecreaseState( pAccessible, State);
+ break;
+ }
+
+ AccContainerEventListener::notifyEvent(aEvent);
+ break;
+ }
+
+ case AccessibleEventId::TEXT_SELECTION_CHANGED:
+ handleTextSelectionChangedEvent();
+ break;
+
+ default:
+ AccContainerEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the CARET_CHANGED event
+ * @param oldValue in UNO, this parameter is always NULL
+ * @param newValue in UNO, this parameter is always NULL
+ */
+void AccParagraphEventListener::handleCaretChangedEvent(Any oldValue, Any newValue)
+{
+ pAgent->UpdateLocation(pAccessible);
+ pAgent->NotifyAccEvent(UM_EVENT_OBJECT_CARETCHANGE, pAccessible);
+}
+
+/**
+ * handle the VISIBLE_DATA_CHANGED event
+ */
+void AccParagraphEventListener::handleVisibleDataChangedEvent()
+{
+ AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ * handle the BOUNDRECT_CHANGED event
+ */
+void AccParagraphEventListener::handleBoundrectChangedEvent()
+{
+ AccEventListener::handleBoundrectChangedEvent();
+}
+
+/**
+ * set the new state and fire the MSAA event
+ * @param state new state id
+ * @param enable true if state is set, false if state is unset
+ */
+void AccParagraphEventListener::setComponentState(short state, bool enable )
+{
+ // only the following state can be fired state event.
+ switch (state)
+ {
+ case AccessibleStateType::EDITABLE:
+ // no msaa state
+ break;
+ case AccessibleStateType::MULTI_LINE:
+ // no msaa state mapping
+ break;
+ case AccessibleStateType::SINGLE_LINE:
+ // no msaa state mapping
+ break;
+ default:
+ AccContainerEventListener::setComponentState(state, enable);
+ break;
+ }
+}
+
+void AccParagraphEventListener::handleTextSelectionChangedEvent()
+{
+ pAgent->NotifyAccEvent(UM_EVENT_TEXT_SELECTION_CHANGED, pAccessible);
+}
+
diff --git a/winaccessibility/source/service/AccResource.cxx b/winaccessibility/source/service/AccResource.cxx
new file mode 100644
index 000000000000..374da6baf0af
--- /dev/null
+++ b/winaccessibility/source/service/AccResource.cxx
@@ -0,0 +1,85 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "AccResource.hxx"
+
+#include <tools/simplerm.hxx>
+
+// ---- needed as long as we have no contexts for components ---
+#include <vcl/svapp.hxx>
+
+//2009.04. Comment the following code because the acc resource is not necessary now. Can open them if necessary
+//#ifndef _TOOLS_INTN_HXX
+//#include <tools/intn.hxx>
+//#endif
+//#ifndef _SOLAR_HRC
+//#include <svtools/solar.hrc>
+//#endif
+
+//.........................................................................
+
+//==================================================================
+//= ResourceManager
+//==================================================================
+SimpleResMgr* ResourceManager::m_pImpl = NULL;
+
+//------------------------------------------------------------------
+ResourceManager::EnsureDelete::~EnsureDelete()
+{
+ delete ResourceManager::m_pImpl;
+}
+
+//------------------------------------------------------------------
+void ResourceManager::ensureImplExists()
+{
+ //Comment the following code because the acc resource is not necessary now. Can open them if necessary
+ /*
+ if (m_pImpl)
+ return;
+
+ LanguageType nType = Application::GetSettings().GetUILanguage();
+
+ ByteString sFileName("winaccessibility");
+ sFileName += ByteString::CreateFromInt32( (sal_Int32)SOLARUPD );
+
+ m_pImpl = SimpleResMgr::Create(sFileName.GetBuffer(), nType);
+
+ if (m_pImpl)
+ {
+ // no that we have a impl class make sure it's deleted on unloading the library
+ static ResourceManager::EnsureDelete s_aDeleteTheImplClas;
+ }
+ */
+}
+
+//------------------------------------------------------------------
+::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId)
+{
+ ::rtl::OUString sReturn;
+
+ ensureImplExists();
+ if (m_pImpl)
+ sReturn = m_pImpl->ReadString(_nResId);
+
+ return sReturn;
+}
+
+
diff --git a/winaccessibility/source/service/AccTableEventListener.cxx b/winaccessibility/source/service/AccTableEventListener.cxx
new file mode 100644
index 000000000000..4042a5412dae
--- /dev/null
+++ b/winaccessibility/source/service/AccTableEventListener.cxx
@@ -0,0 +1,146 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
+
+#include "AccTableEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccTableEventListener::AccTableEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccDescendantManagerEventListener(pAcc, Agent)
+{}
+AccTableEventListener::~AccTableEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccTableEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED:
+ handleActiveDescendantChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+
+ case AccessibleEventId::TABLE_CAPTION_CHANGED:
+ {
+
+ pAgent->NotifyAccEvent(UM_EVENT_TABLE_CAPTION_CHANGED, pAccessible);
+ break;
+ }
+ case AccessibleEventId::TABLE_COLUMN_DESCRIPTION_CHANGED:
+ {
+
+ pAgent->NotifyAccEvent(UM_EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED, pAccessible);
+ break;
+ }
+ case AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED:
+ {
+
+ pAgent->NotifyAccEvent(UM_EVENT_TABLE_COLUMN_HEADER_CHANGED, pAccessible);
+ break;
+ }
+ case AccessibleEventId::TABLE_ROW_HEADER_CHANGED:
+ {
+
+ pAgent->NotifyAccEvent(UM_EVENT_TABLE_ROW_HEADER_CHANGED, pAccessible);
+ break;
+ }
+ case AccessibleEventId::TABLE_MODEL_CHANGED:
+ {
+
+ handleTableModelChangeEvent(aEvent.NewValue);
+ break;
+ }
+ case AccessibleEventId::TABLE_SUMMARY_CHANGED:
+ {
+
+ pAgent->NotifyAccEvent(UM_EVENT_TABLE_SUMMARY_CHANGED, pAccessible);
+ break;
+ }
+ case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED:
+ {
+
+ pAgent->NotifyAccEvent(UM_EVENT_TABLE_ROW_DESCRIPTION_CHANGED, pAccessible);
+ break;
+ }
+ default:
+ AccDescendantManagerEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the ACTIVE_DESCENDANT_CHANGED event
+ * @param oldValue the child to lose active
+ * @param newValue the child to get active
+ */
+void AccTableEventListener::handleActiveDescendantChangedEvent(Any oldValue, Any newValue)
+{
+ Reference< XAccessible > xChild;
+ if(newValue >>= xChild )
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->InsertAccObj(pAcc,pAccessible);
+ pAgent->NotifyAccEvent(UM_EVENT_ACTIVE_DESCENDANT_CHANGED, pAcc);
+ }
+ }
+ else if (oldValue >>= xChild)
+ {
+ //delete an existing child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->DeleteAccObj( pAcc );
+ }
+ }
+
+}
+void AccTableEventListener::handleTableModelChangeEvent(Any newValue)
+{
+ AccessibleTableModelChange aModelChange;
+ if (newValue >>= aModelChange)
+ {
+ if( pAccessible )
+ {
+ //delete all oldValue's existing children
+ pAgent->DeleteChildrenAccObj( pAccessible );
+ //add all oldValue's existing children
+ pAgent->InsertChildrenAccObj( pAccessible );
+ }
+ pAgent->NotifyAccEvent(UM_EVENT_TABLE_MODEL_CHANGED, pAccessible);
+ }
+}
diff --git a/winaccessibility/source/service/AccTextComponentEventListener.cxx b/winaccessibility/source/service/AccTextComponentEventListener.cxx
new file mode 100644
index 000000000000..2d8254b144da
--- /dev/null
+++ b/winaccessibility/source/service/AccTextComponentEventListener.cxx
@@ -0,0 +1,65 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccTextComponentEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccTextComponentEventListener::AccTextComponentEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccComponentEventListener(pAcc, Agent)
+{}
+AccTextComponentEventListener::~AccTextComponentEventListener()
+{
+}
+
+/**
+ * set the new state and fire the MSAA event
+ * @param state new state id
+ * @param enable true if state is set, false if state is unset
+ */
+void AccTextComponentEventListener::setComponentState(short state, bool enable )
+{
+ // only the following state can be fired state event.
+ switch (state)
+ {
+ case AccessibleStateType::EDITABLE:
+ // no msaa state mapping
+ break;
+ case AccessibleStateType::MULTI_LINE:
+ // no msaa state mapping
+ break;
+ case AccessibleStateType::SINGLE_LINE:
+ // no msaa state mapping
+ break;
+ default:
+ AccComponentEventListener::setComponentState(state, enable);
+ break;
+ }
+}
diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx
new file mode 100644
index 000000000000..2cf92bcdb757
--- /dev/null
+++ b/winaccessibility/source/service/AccTopWindowListener.cxx
@@ -0,0 +1,321 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <cppuhelper/bootstrap.hxx>
+#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <vcl/window.hxx>
+#include <toolkit/awt/Vclxwindow.hxx>
+
+#ifndef _SV_SYSDATA_HXX
+#if defined( WIN ) || defined( WNT ) || defined( OS2 )
+typedef sal_Int32 HWND;
+typedef sal_Int32 HMENU;
+typedef sal_Int32 HDC;
+typedef void *PVOID;
+typedef PVOID HANDLE;
+typedef HANDLE HFONT;
+#endif
+#include <vcl/sysdata.hxx>
+#endif
+
+#include "AccTopWindowListener.hxx"
+#include "unomsaaevent.hxx"
+
+#include <com/sun/star/awt/XExtendedToolkit.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::bridge;
+using namespace com::sun::star::awt;
+using namespace rtl;
+using namespace cppu;
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+AccTopWindowListener* g_pTop = NULL;
+//when proccess exit, call FreeTopWindowListener() in svmain
+void FreeTopWindowListener()
+{
+ if( g_pTop )
+ {
+ g_pTop->release();
+ g_pTop = NULL;
+ }
+}
+
+/**
+ * As a global method to invoke the handleWindowOpened() method
+ */
+void handleWindowOpened_impl(long pAcc)
+{
+ if( g_pTop && pAcc != NULL )
+ g_pTop->handleWindowOpened( (com::sun::star::accessibility::XAccessible*)((void*)pAcc) );
+}
+
+/**
+ * For the new opened window, generate all the UNO accessible's object, COM object and add
+ * accessible listener to monitor all these objects.
+ * @param pAccessible the accessible of the new opened window
+ */
+void AccTopWindowListener::handleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible )
+{
+ //get SystemData from window
+ VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible;
+ Window* window = pvclwindow->GetWindow();
+ // The SalFrame of window may be destructed at this time
+ const SystemEnvData* systemdata = NULL;
+ try
+ {
+ systemdata = window->GetSystemData();
+ }
+ catch(...)
+ {
+ systemdata = NULL;
+ }
+ Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+ if(!xContext.is())
+ {
+ return;
+ }
+ com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get();
+ //Only AccessibleContext exist, add all listeners
+ if(pAccessibleContext != NULL && systemdata != NULL)
+ {
+ accManagerAgent.SaveTopWindowHandle((HWND)systemdata->hWnd, pAccessible);
+
+ AddAllListeners(pAccessible,NULL,(HWND)systemdata->hWnd);
+
+ if( window->GetStyle() & WB_MOVEABLE )
+ accManagerAgent.IncreaseState( pAccessible, -1 /* U_MOVEBLE */ );
+
+ short role = pAccessibleContext->getAccessibleRole();
+
+
+ if (role == com::sun::star::accessibility::AccessibleRole::POPUP_MENU ||
+ role == com::sun::star::accessibility::AccessibleRole::MENU )
+ {
+ accManagerAgent.NotifyAccEvent(UM_EVENT_MENUPOPUPSTART, pAccessible);
+ }
+
+ if (role == com::sun::star::accessibility::AccessibleRole::FRAME ||
+ role == com::sun::star::accessibility::AccessibleRole::DIALOG ||
+ role == com::sun::star::accessibility::AccessibleRole::WINDOW ||
+ role == com::sun::star::accessibility::AccessibleRole::ALERT)
+ {
+ accManagerAgent.NotifyAccEvent(UM_EVENT_SHOW, pAccessible);
+ }
+ }
+}
+
+AccTopWindowListener::AccTopWindowListener():
+ accManagerAgent(),
+ m_refcount(1)
+{
+}
+
+AccTopWindowListener::~AccTopWindowListener()
+{
+}
+
+/**
+ * It is invoked when a new window is opened, the source of this EventObject is the window
+ */
+void AccTopWindowListener::windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( !e.Source.is())
+ {
+ return;
+ }
+
+ Reference< com::sun::star::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY );
+ com::sun::star::accessibility::XAccessible* pAccessible = xAccessible.get();
+ if ( pAccessible == NULL)
+ {
+ return;
+ }
+
+ handleWindowOpened(pAccessible);
+
+}
+
+/**
+ * Add the accessible event listener to object and all its children objects.
+ * @param pAccessible the accessible object
+ * @param pParentXAcc the parent of current accessible object
+ * @param pWND the handle of top window which current object resides
+ */
+void AccTopWindowListener::AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible, com::sun::star::accessibility::XAccessible* pParentXAcc, HWND pWND)
+{
+ Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+ if(!xContext.is())
+ {
+ return;
+ }
+ com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get();
+ if(pAccessibleContext == NULL)
+ {
+ return;
+ }
+
+ accManagerAgent.InsertAccObj( pAccessible, pParentXAcc,pWND );
+
+ if (!accManagerAgent.IsContainer(pAccessible))
+ {
+ return;
+ }
+
+
+ short role = pAccessibleContext->getAccessibleRole();
+ if(com::sun::star::accessibility::AccessibleRole::DOCUMENT == role )
+ {
+ if(accManagerAgent.IsStateManageDescendant(pAccessible))
+ {
+ return ;
+ }
+ }
+
+
+ int count = pAccessibleContext->getAccessibleChildCount();
+ for (int i=0;i<count;i++)
+ {
+ Reference<com::sun::star::accessibility::XAccessible> mxAccessible
+ = pAccessibleContext->getAccessibleChild(i);
+
+ com::sun::star::accessibility::XAccessible* mpAccessible = mxAccessible.get();
+ if(mpAccessible != NULL)
+ {
+ Reference<com::sun::star::accessibility::XAccessibleContext> mxAccessibleContext
+ = mpAccessible->getAccessibleContext();
+ com::sun::star::accessibility::XAccessibleContext* mpContext = mxAccessibleContext.get();
+ if(mpContext != NULL)
+ {
+ //fprintf(output, "go on add child's children event listener\n");
+ AddAllListeners(mpAccessible,pAccessible,pWND);
+ }
+ }
+ }
+}
+
+void AccTopWindowListener::windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+/**
+ * Invoke this method when the top window is closed, remove all the objects and its children
+ * from current manager's cache, and remove the COM object and the accessible event listener
+ * assigned to the accessible objects.
+ */
+void AccTopWindowListener::windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( !e.Source.is())
+ {
+ return;
+ }
+ Reference< com::sun::star::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY );
+ com::sun::star::accessibility::XAccessible* pAccessible = xAccessible.get();
+ if ( pAccessible == NULL)
+ {
+ return;
+ }
+
+
+ VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible;
+ Window* window = pvclwindow->GetWindow();
+ const SystemEnvData* systemdata=window->GetSystemData();
+
+ Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+ if(!xContext.is())
+ {
+ return;
+ }
+ com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get();
+
+ short role = -1;
+ if(pAccessibleContext != NULL)
+ {
+ role = pAccessibleContext->getAccessibleRole();
+
+ if (role == com::sun::star::accessibility::AccessibleRole::POPUP_MENU ||
+ role == com::sun::star::accessibility::AccessibleRole::MENU)
+ {
+ accManagerAgent.NotifyAccEvent(UM_EVENT_MENUPOPUPEND, pAccessible);
+ }
+ }
+
+
+ accManagerAgent.DeleteChildrenAccObj( pAccessible );
+ if( role != com::sun::star::accessibility::AccessibleRole::POPUP_MENU )
+ accManagerAgent.DeleteAccObj( pAccessible );
+
+}
+
+void AccTopWindowListener::windowMinimized( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+void AccTopWindowListener::windowNormalized( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+void AccTopWindowListener::windowActivated( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+void AccTopWindowListener::windowDeactivated( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+void AccTopWindowListener::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+//need to investigate further
+::com::sun::star::uno::Any SAL_CALL AccTopWindowListener::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException)
+{
+ if (aType.equals( ::getCppuType( (Reference< com::sun::star::awt::XTopWindowListener> const *)0 ) ))
+ {
+ Reference< com::sun::star::awt::XTopWindowListener> xTopListener( static_cast< com::sun::star::awt::XTopWindowListener* >(this));
+ return makeAny(xTopListener);
+ }
+ return Any();
+}
+
+void AccTopWindowListener::acquire( ) throw ()
+{
+ ::osl_incrementInterlockedCount( &m_refcount );
+}
+
+void AccTopWindowListener::release() throw ()
+{
+ // thread-safe decrementation of reference count
+ if (0 == ::osl_decrementInterlockedCount( &m_refcount ))
+ {
+ delete this; // shutdown this object
+ }
+}
diff --git a/winaccessibility/source/service/AccTreeEventListener.cxx b/winaccessibility/source/service/AccTreeEventListener.cxx
new file mode 100644
index 000000000000..6cde4e5979e0
--- /dev/null
+++ b/winaccessibility/source/service/AccTreeEventListener.cxx
@@ -0,0 +1,87 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccTreeEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccTreeEventListener::AccTreeEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccDescendantManagerEventListener(pAcc, Agent)
+{}
+AccTreeEventListener::~AccTreeEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject the event object which contains information about event
+ */
+void AccTreeEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED:
+ handleActiveDescendantChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ default:
+ AccDescendantManagerEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the ACTIVE_DESCENDANT_CHANGED event
+ * @param oldValue the child to lose active
+ * @param newValue the child to get active
+ */
+void AccTreeEventListener::handleActiveDescendantChangedEvent(Any oldValue, Any newValue)
+{
+ Reference< XAccessible > xChild;
+ if(newValue >>= xChild )
+ {
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->InsertAccObj(pAcc,pAccessible);
+ pAgent->NotifyAccEvent(UM_EVENT_ACTIVE_DESCENDANT_CHANGED, pAcc);
+ pActiveDescendant = pAcc;
+ }
+ }
+ if (oldValue >>= xChild)
+ {
+ //delete an existing child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->DeleteAccObj( pAcc );
+ }
+ }
+
+}
diff --git a/winaccessibility/source/service/AccWindowEventListener.cxx b/winaccessibility/source/service/AccWindowEventListener.cxx
new file mode 100644
index 000000000000..7f9e3ba99494
--- /dev/null
+++ b/winaccessibility/source/service/AccWindowEventListener.cxx
@@ -0,0 +1,152 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+
+#include "AccWindowEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccWindowEventListener::AccWindowEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+ :AccEventListener(pAcc, Agent)
+{}
+AccWindowEventListener::~AccWindowEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject: the event object which contains information about event
+ */
+void AccWindowEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException)
+{
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId::CHILD:
+ handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+ break;
+ case AccessibleEventId::VISIBLE_DATA_CHANGED:
+ handleVisibleDataChangedEvent();
+ break;
+ case AccessibleEventId::BOUNDRECT_CHANGED:
+ handleBoundrectChangedEvent();
+ break;
+ default:
+ AccEventListener::notifyEvent(aEvent);
+ break;
+ }
+}
+
+/**
+ * handle the VISIBLE_DATA_CHANGED event
+ */
+void AccWindowEventListener::handleVisibleDataChangedEvent()
+{
+ AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ * handle the BOUNDRECT_CHANGED event
+ */
+void AccWindowEventListener::handleBoundrectChangedEvent()
+{
+ AccEventListener::handleBoundrectChangedEvent();
+}
+
+/**
+ * handle the CHILD event
+ * @param oldValue the child to be deleted
+ * @param newValue the child to be added
+ */
+void AccWindowEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+ Reference< XAccessible > xChild;
+ if( newValue >>= xChild)
+ {
+ //create a new child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ //add this child
+ pAgent->InsertAccObj( pAcc,pAccessible);
+ //add all oldValue's existing children
+ pAgent->InsertChildrenAccObj(pAcc);
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+ }
+ else
+ {}
+ }
+ else if (oldValue >>= xChild)
+ {
+ //delete a existing child
+ if(xChild.is())
+ {
+ XAccessible* pAcc = xChild.get();
+ pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+ pAgent->DeleteChildrenAccObj( pAcc );
+ //delete this child
+ pAgent->DeleteAccObj( pAcc );
+ }
+ else
+ {}
+ }
+}
+
+/**
+ * set the new state and fire the MSAA event
+ * @param state new state id
+ * @param enable true if state is set, false if state is unset
+ */
+void AccWindowEventListener::setComponentState(short state, bool enable )
+{
+ // only the following state can be fired state event.
+ switch (state)
+ {
+ case AccessibleStateType::ICONIFIED:
+ // no msaa state
+ break;
+ case AccessibleStateType::VISIBLE:
+ // UNO !VISIBLE == MSAA INVISIBLE
+ if( enable )
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE );
+ else
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE );
+ break;
+ case AccessibleStateType::SHOWING:
+ // UNO !SHOWING == MSAA OFFSCREEN
+ if( enable )
+ {
+ pAgent->IncreaseState( pAccessible, AccessibleStateType::SHOWING );
+ }
+ else
+ pAgent->DecreaseState( pAccessible, AccessibleStateType::SHOWING );
+ break;
+ default:
+ break;
+ }
+}
diff --git a/winaccessibility/source/service/ResIDGenerator.cxx b/winaccessibility/source/service/ResIDGenerator.cxx
new file mode 100644
index 000000000000..26e1bac4c5f0
--- /dev/null
+++ b/winaccessibility/source/service/ResIDGenerator.cxx
@@ -0,0 +1,54 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "ResIDGenerator.hxx"
+
+/**
+ * Destructor
+ *
+ * @param
+ * @return
+ */
+ResIDGenerator::~ResIDGenerator()
+{
+}
+
+/**
+ * SubList stores those IDs that were ever generated and deleted, the method
+ * return the ID from subList first if subList is not empty,else return ++max.
+ * Add the obsolete IDs by calling SetSub method
+ *
+ * @param
+ * @return new resource ID.
+ */
+long ResIDGenerator::GenerateNewResID()
+{
+ if (max == LONG_MAX)
+ {
+ if (!subList.empty())
+ {
+ long nRes = *(subList.begin());
+ subList.pop_front();
+ return nRes;
+ }
+ }
+ return -(++max);
+}
diff --git a/winaccessibility/source/service/checkmt.cxx b/winaccessibility/source/service/checkmt.cxx
new file mode 100644
index 000000000000..258a6f61489a
--- /dev/null
+++ b/winaccessibility/source/service/checkmt.cxx
@@ -0,0 +1,36 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "checkmt.hxx"
+#include <vcl/svapp.hxx>
+
+bool IsInMainThread()
+{
+ if( Application::GetMainThreadIdentifier() == ::vos::OThread::getCurrentIdentifier())
+ return true;
+ else
+ return false;
+}
+
+vos::IMutex& GetSolarMutex()
+{
+ return Application::GetSolarMutex();
+}
diff --git a/winaccessibility/source/service/checkmt.hxx b/winaccessibility/source/service/checkmt.hxx
new file mode 100644
index 000000000000..6374bd93f6c4
--- /dev/null
+++ b/winaccessibility/source/service/checkmt.hxx
@@ -0,0 +1,28 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#pragma once
+
+#include <vos/mutex.hxx>
+
+bool IsInMainThread();
+
+vos::IMutex& GetSolarMutex();
diff --git a/winaccessibility/source/service/exports.dxp b/winaccessibility/source/service/exports.dxp
new file mode 100644
index 000000000000..f0e1c69934bc
--- /dev/null
+++ b/winaccessibility/source/service/exports.dxp
@@ -0,0 +1,2 @@
+component_getImplementationEnvironment
+component_getFactory
diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx
new file mode 100644
index 000000000000..3148c9713914
--- /dev/null
+++ b/winaccessibility/source/service/msaaservice_impl.cxx
@@ -0,0 +1,289 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/accessibility/XMSAAService.hpp>
+
+#include <com/sun/star/awt/XExtendedToolkit.hpp>
+#include <vcl/svapp.hxx>
+
+using namespace ::rtl; // for OUString
+using namespace ::com::sun::star; // for odk interfaces
+using namespace ::com::sun::star::uno; // for basic types
+using namespace ::com::sun::star::accessibility;
+
+using namespace ::com::sun::star::awt;
+
+typedef sal_Int32 HWND;
+
+#include "AccTopWindowListener.hxx"
+#include "g_msacc.hxx"
+
+extern void FreeTopWindowListener();
+extern long GetMSComPtr(long hWnd, long lParam, long wParam);
+extern void handleWindowOpened_impl( long pAcc);
+
+
+namespace my_sc_impl
+{
+
+extern Sequence< OUString > SAL_CALL getSupportedServiceNames_MSAAServiceImpl();
+extern OUString SAL_CALL getImplementationName_MSAAServiceImpl();
+extern Reference< XInterface > SAL_CALL create_MSAAServiceImpl(
+ Reference< XComponentContext > const & xContext )
+ SAL_THROW( () );
+/**
+ * Method that returns the service name.
+ * @param
+ * @return Name sequence.
+ */
+static Sequence< OUString > getSupportedServiceNames_MSAAServiceImpl()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ // MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.MSAAService"));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+/**
+ * Method that returns the service name.
+ * @param
+ * @return Name sequence.
+ */
+static OUString getImplementationName_MSAAServiceImpl()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ // MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.my_sc_implementation.MSAAService") );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
+
+class MSAAServiceImpl : public ::cppu::WeakImplHelper3<
+ XMSAAService, lang::XServiceInfo, lang::XInitialization >
+{
+ OUString m_arg;
+public:
+ // focus on three given interfaces,
+ // no need to implement XInterface, XTypeProvider, XWeak
+ MSAAServiceImpl ();
+ virtual ~MSAAServiceImpl( void );
+ // XInitialization will be called upon createInstanceWithArguments[AndContext]()
+ virtual void SAL_CALL initialize( Sequence< Any > const & args )
+ throw (Exception);
+ // XMSAAService
+ virtual sal_Int32 SAL_CALL getAccObjectPtr (long hWnd, long lParam, long wParam)
+ throw (RuntimeException);
+ virtual void SAL_CALL handleWindowOpened(sal_Int32)
+ throw (RuntimeException);
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName()
+ throw (RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( OUString const & serviceName )
+ throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames()
+ throw (RuntimeException);
+};
+
+/**
+ * Implemention of XInitialization.
+ * @param
+ * @return.
+ */
+void MSAAServiceImpl::initialize( Sequence< Any > const & args ) throw (Exception)
+{
+ if (1 != args.getLength())
+ {
+ throw lang::IllegalArgumentException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("give a string instanciating this component!") ),
+ (::cppu::OWeakObject *)this, // resolve to XInterface reference
+ 0 ); // argument pos
+ }
+ if (! (args[ 0 ] >>= m_arg))
+ {
+ throw lang::IllegalArgumentException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("no string given as argument!") ),
+ (::cppu::OWeakObject *)this, // resolve to XInterface reference
+ 0 ); // argument pos
+ }
+}
+
+/**
+ * Implemention of getAccObjectPtr.
+ * @param
+ * @return Com interface.
+ */
+sal_Int32 MSAAServiceImpl::getAccObjectPtr ( long hWnd, long lParam, long wParam) throw (RuntimeException)
+{
+ return GetMSComPtr(hWnd, lParam, wParam);
+}
+
+/**
+ * Implemention of handleWindowOpened,the method will be invoked when a top window
+ * opened and AT starts up.
+ * @param
+ * @return
+ */
+void MSAAServiceImpl::handleWindowOpened( sal_Int32 pAcc)
+{
+ handleWindowOpened_impl(pAcc);
+}
+
+/**
+ * Implemention of XServiceInfo.
+ * @param
+ * @return Implementataion name.
+ */
+OUString MSAAServiceImpl::getImplementationName() throw (RuntimeException)
+{
+ // unique implementation name
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.my_sc_impl.MSAAService") );
+}
+
+/**
+ * Implemention of XServiceInfo,return support service name.
+ * @param Service name.
+ * @return If the service name is supported.
+ */
+sal_Bool MSAAServiceImpl::supportsService( OUString const & serviceName ) throw (RuntimeException)
+{
+ // this object only supports one service, so the test is simple
+ return serviceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.accessibility.MSAAService") );
+}
+
+/**
+ * Implemention of XServiceInfo,return all service names.
+ * @param.
+ * @return service name sequence.
+ */
+Sequence< OUString > MSAAServiceImpl::getSupportedServiceNames() throw (RuntimeException)
+{
+ return getSupportedServiceNames_MSAAServiceImpl();
+}
+
+/**
+ * Static method that can create an entity of our MSAA Service
+ * @param xContext No use here.
+ * @return The object interface.
+ */
+Reference< XInterface > SAL_CALL create_MSAAServiceImpl( Reference< XComponentContext > const & /*xContext*/ ) SAL_THROW( () )
+{
+ MSAAServiceImpl* xxx = new MSAAServiceImpl();
+ //return static_cast< lang::XTypeProvider * >( xxx );
+ Reference< XMSAAService > p( xxx );
+ return p;
+}
+
+/**
+ * Constructor.
+ * @param
+ * @return
+ */
+MSAAServiceImpl::MSAAServiceImpl()
+{
+ Reference< XExtendedToolkit > xToolkit =
+ Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
+
+ if(xToolkit.is())
+ {
+ AccTopWindowListener *accListener;
+ accListener = new AccTopWindowListener();
+ g_pTop = accListener;
+ Reference< XTopWindowListener> x(accListener);
+ xToolkit->addTopWindowListener(x);
+ }
+}
+
+/**
+ * Static method that can create an entity of our MSAA Service
+ * @param Destructor
+ * @return
+ */
+MSAAServiceImpl::~MSAAServiceImpl()
+{
+
+ // As all folders and streams contain references to their parents,
+ // we must remove these references so that they will be deleted when
+ // the hash_map of the root folder is cleared, releasing all subfolders
+ // and substreams which in turn release theirs, etc. When xRootFolder is
+ // released when this destructor completes, the folder tree should be
+ // deleted fully (and automagically).
+ FreeTopWindowListener();
+
+
+}
+
+}
+
+/* shared lib exports implemented without helpers in service_impl1.cxx */
+namespace my_sc_impl
+{
+static struct ::cppu::ImplementationEntry s_component_entries [] =
+ {
+ {
+ create_MSAAServiceImpl, getImplementationName_MSAAServiceImpl,
+ getSupportedServiceNames_MSAAServiceImpl, ::cppu::createSingleComponentFactory,
+ 0, 0
+ },
+ {
+ create_MSAAServiceImpl, getImplementationName_MSAAServiceImpl,
+ getSupportedServiceNames_MSAAServiceImpl, ::cppu::createSingleComponentFactory,
+ 0, 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+ };
+}
+
+extern "C"
+{
+ void SAL_CALL component_getImplementationEnvironment(
+ sal_Char const ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
+ {
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+ void * SAL_CALL component_getFactory(
+ sal_Char const * implName, lang::XMultiServiceFactory * xMgr,
+ registry::XRegistryKey * xRegistry )
+ {
+ return ::cppu::component_getFactoryHelper(
+ implName, xMgr, xRegistry, ::my_sc_impl::s_component_entries );
+ }
+}
diff --git a/winaccessibility/source/service/winaccessibility.component b/winaccessibility/source/service/winaccessibility.component
new file mode 100644
index 000000000000..d2dfe39573ed
--- /dev/null
+++ b/winaccessibility/source/service/winaccessibility.component
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--**********************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+**********************************************************************-->
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.accessibility.my_sc_implementation.MSAAService">
+ <service name="com.sun.star.accessibility.MSAAService"/>
+ </implementation>
+</component>