openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stev...@apache.org
Subject svn commit: r1420522 [10/12] - in /openoffice/branches/ia2/main/winaccessibility: ./ inc/ prj/ source/ source/UAccCOM/ source/UAccCOMIDL/ source/service/
Date Wed, 12 Dec 2012 04:41:33 GMT
Added: openoffice/branches/ia2/main/winaccessibility/source/service/AccFrameEventListener.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/winaccessibility/source/service/AccFrameEventListener.cxx?rev=1420522&view=auto
==============================================================================
--- openoffice/branches/ia2/main/winaccessibility/source/service/AccFrameEventListener.cxx (added)
+++ openoffice/branches/ia2/main/winaccessibility/source/service/AccFrameEventListener.cxx Wed Dec 12 04:41:12 2012
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 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;
+    }
+}

Added: openoffice/branches/ia2/main/winaccessibility/source/service/AccListEventListener.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/winaccessibility/source/service/AccListEventListener.cxx?rev=1420522&view=auto
==============================================================================
--- openoffice/branches/ia2/main/winaccessibility/source/service/AccListEventListener.cxx (added)
+++ openoffice/branches/ia2/main/winaccessibility/source/service/AccListEventListener.cxx Wed Dec 12 04:41:12 2012
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 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);
+    }
+}

Added: openoffice/branches/ia2/main/winaccessibility/source/service/AccMenuEventListener.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/winaccessibility/source/service/AccMenuEventListener.cxx?rev=1420522&view=auto
==============================================================================
--- openoffice/branches/ia2/main/winaccessibility/source/service/AccMenuEventListener.cxx (added)
+++ openoffice/branches/ia2/main/winaccessibility/source/service/AccMenuEventListener.cxx Wed Dec 12 04:41:12 2012
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 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;
+        }
+    }
+}

Added: openoffice/branches/ia2/main/winaccessibility/source/service/AccObject.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/winaccessibility/source/service/AccObject.cxx?rev=1420522&view=auto
==============================================================================
--- openoffice/branches/ia2/main/winaccessibility/source/service/AccObject.cxx (added)
+++ openoffice/branches/ia2/main/winaccessibility/source/service/AccObject.cxx Wed Dec 12 04:41:12 2012
@@ -0,0 +1,1117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 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 "AccessibleRole.h"
+
+
+
+
+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()
+{
+
+    if ( S_OK != CoCreateInstance( CLSID_MAccessible, NULL, CLSCTX_ALL ,
+                                   IID_IMAccessible,
+                                   (void **)&m_pIMAcc
+                                 )
+       )
+    {
+        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;
+}

Added: openoffice/branches/ia2/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx?rev=1420522&view=auto
==============================================================================
--- openoffice/branches/ia2/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx (added)
+++ openoffice/branches/ia2/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx Wed Dec 12 04:41:12 2012
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 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();
+}

Added: openoffice/branches/ia2/main/winaccessibility/source/service/AccObjectManagerAgent.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/winaccessibility/source/service/AccObjectManagerAgent.cxx?rev=1420522&view=auto
==============================================================================
--- openoffice/branches/ia2/main/winaccessibility/source/service/AccObjectManagerAgent.cxx (added)
+++ openoffice/branches/ia2/main/winaccessibility/source/service/AccObjectManagerAgent.cxx Wed Dec 12 04:41:12 2012
@@ -0,0 +1,393 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 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;
+}



Mime
View raw message