Kaydet (Commit) fabca737 authored tarafından Michael Stahl's avatar Michael Stahl

winaccessibility: remove global g_acc_manager

It is possible to retrieve it via the AccTopWindowListener.

Change-Id: I6cc5ab25bc937d0d9f4de54a1bed09a76ce27491
üst b54d441a
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
#ifndef __ACCOBJECTMANAGERAGENT_HXX #ifndef __ACCOBJECTMANAGERAGENT_HXX
#define __ACCOBJECTMANAGERAGENT_HXX #define __ACCOBJECTMANAGERAGENT_HXX
#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_ #include <boost/scoped_ptr.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessible.hpp>
#endif
struct IMAccessible; struct IMAccessible;
struct IAccessible; struct IAccessible;
...@@ -37,7 +37,7 @@ class AccObjectManagerAgent ...@@ -37,7 +37,7 @@ class AccObjectManagerAgent
{ {
private: private:
AccObjectWinManager* pWinManager; boost::scoped_ptr<AccObjectWinManager> pWinManager;
public: public:
...@@ -96,6 +96,9 @@ public: ...@@ -96,6 +96,9 @@ public:
bool IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc ); bool IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc );
bool IsStateManageDescendant(com::sun::star::accessibility::XAccessible* pXAcc); bool IsStateManageDescendant(com::sun::star::accessibility::XAccessible* pXAcc);
sal_Int64 Get_ToATInterface(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam);
}; };
#endif #endif
......
...@@ -97,8 +97,6 @@ public: ...@@ -97,8 +97,6 @@ public:
void DeleteAccObj( com::sun::star::accessibility::XAccessible* pXAcc ); void DeleteAccObj( com::sun::star::accessibility::XAccessible* pXAcc );
void DeleteChildrenAccObj(com::sun::star::accessibility::XAccessible* pAccObj); 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 ); sal_Bool NotifyAccEvent( com::sun::star::accessibility::XAccessible* pXAcc,short state = 0 );
LPARAM Get_ToATInterface(HWND hWnd, long lParam, WPARAM wParam); LPARAM Get_ToATInterface(HWND hWnd, long lParam, WPARAM wParam);
......
...@@ -59,6 +59,8 @@ public: ...@@ -59,6 +59,8 @@ public:
virtual void AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWND ); virtual void AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWND );
//for On-Demand load. //for On-Demand load.
virtual void HandleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible ); virtual void HandleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible );
sal_Int64 GetMSComPtr(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam);
}; };
#endif #endif
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#ifndef __G_MSACC_HXX
#define __G_MSACC_HXX
extern sal_Int64 GetMSComPtr(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam);
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -30,19 +30,13 @@ using namespace com::sun::star::accessibility; ...@@ -30,19 +30,13 @@ using namespace com::sun::star::accessibility;
* @param * @param
* @return * @return
*/ */
AccObjectManagerAgent::AccObjectManagerAgent(): AccObjectManagerAgent::AccObjectManagerAgent()
pWinManager(NULL) : pWinManager(new AccObjectWinManager(this))
{ {
if( pWinManager == NULL )
{
pWinManager = AccObjectWinManager::CreateAccObjectWinManagerInstance(this);
}
} }
AccObjectManagerAgent::~AccObjectManagerAgent() AccObjectManagerAgent::~AccObjectManagerAgent()
{ {
delete pWinManager;
pWinManager = NULL;
} }
/** /**
...@@ -388,4 +382,16 @@ bool AccObjectManagerAgent::IsStateManageDescendant(XAccessible* pXAcc) ...@@ -388,4 +382,16 @@ bool AccObjectManagerAgent::IsStateManageDescendant(XAccessible* pXAcc)
return false; return false;
} }
/**
* Implementation of interface XMSAAService's method getAccObjectPtr()
* that returns the corresponding COM interface with the MS event.
* @return Com interface.
*/
sal_Int64 AccObjectManagerAgent::Get_ToATInterface(
sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam)
{
return static_cast<sal_Int64>(pWinManager->Get_ToATInterface(
static_cast<HWND>(reinterpret_cast<void*>(hWnd)), lParam, wParam));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -53,23 +53,6 @@ using namespace com::sun::star::accessibility::AccessibleRole; ...@@ -53,23 +53,6 @@ using namespace com::sun::star::accessibility::AccessibleRole;
using namespace com::sun::star::accessibility::AccessibleStateType; using namespace com::sun::star::accessibility::AccessibleStateType;
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
AccObjectWinManager* g_acc_manager = NULL;
/**
* Implementation of interface XMSAAService's method getAccObjectPtr() that return the
* corresponding com interface with the MS event.
*
* @param
* @return Com interface.
*/
sal_Int64 GetMSComPtr(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam)
{
if (!g_acc_manager)
return 0;
return static_cast<sal_Int64>(g_acc_manager->Get_ToATInterface(
static_cast<HWND>(reinterpret_cast<void*>(hWnd)), lParam, wParam));
}
/** /**
* constructor * constructor
* @param Agent The agent kept in all listeners,it's the sole interface by which * @param Agent The agent kept in all listeners,it's the sole interface by which
...@@ -88,22 +71,6 @@ AccObjectWinManager::AccObjectWinManager( AccObjectManagerAgent* Agent ): ...@@ -88,22 +71,6 @@ AccObjectWinManager::AccObjectWinManager( AccObjectManagerAgent* Agent ):
{ {
} }
/**
* 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 (!g_acc_manager)
{
g_acc_manager = new AccObjectWinManager( Agent );
}
return g_acc_manager;
}
/** /**
* Destructor,clear all resource. * Destructor,clear all resource.
* @param * @param
......
...@@ -255,4 +255,10 @@ void AccTopWindowListener::disposing( const ::com::sun::star::lang::EventObject& ...@@ -255,4 +255,10 @@ void AccTopWindowListener::disposing( const ::com::sun::star::lang::EventObject&
{ {
} }
sal_Int64 AccTopWindowListener::GetMSComPtr(
sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam)
{
return accManagerAgent.Get_ToATInterface(hWnd, lParam, wParam);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -42,7 +42,6 @@ using namespace ::com::sun::star::accessibility; ...@@ -42,7 +42,6 @@ using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::awt; using namespace ::com::sun::star::awt;
#include "AccTopWindowListener.hxx" #include "AccTopWindowListener.hxx"
#include "g_msacc.hxx"
namespace my_sc_impl namespace my_sc_impl
{ {
...@@ -96,7 +95,11 @@ throw (RuntimeException) ...@@ -96,7 +95,11 @@ throw (RuntimeException)
{ {
SolarMutexGuard g; SolarMutexGuard g;
return GetMSComPtr( hWnd, lParam, wParam ); if (!m_pTopWindowListener.is())
{
return 0;
}
return m_pTopWindowListener->GetMSComPtr(hWnd, lParam, wParam);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment