13a700b0aSSteve Yin /************************************************************** 23a700b0aSSteve Yin * 33a700b0aSSteve Yin * Licensed to the Apache Software Foundation (ASF) under one 43a700b0aSSteve Yin * or more contributor license agreements. See the NOTICE file 53a700b0aSSteve Yin * distributed with this work for additional information 63a700b0aSSteve Yin * regarding copyright ownership. The ASF licenses this file 73a700b0aSSteve Yin * to you under the Apache License, Version 2.0 (the 83a700b0aSSteve Yin * "License"); you may not use this file except in compliance 93a700b0aSSteve Yin * with the License. You may obtain a copy of the License at 103a700b0aSSteve Yin * 113a700b0aSSteve Yin * http://www.apache.org/licenses/LICENSE-2.0 123a700b0aSSteve Yin * 133a700b0aSSteve Yin * Unless required by applicable law or agreed to in writing, 143a700b0aSSteve Yin * software distributed under the License is distributed on an 153a700b0aSSteve Yin * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 163a700b0aSSteve Yin * KIND, either express or implied. See the License for the 173a700b0aSSteve Yin * specific language governing permissions and limitations 183a700b0aSSteve Yin * under the License. 193a700b0aSSteve Yin * 20*b0a7a3cfSSteve Yin *************************************************************/ 215fdc4257SSteve Yin 225fdc4257SSteve Yin #ifndef __ACCOBJECTWINMANAGER_HXX 23*b0a7a3cfSSteve Yin #define __ACCOBJECTWINMANAGER_HXX 245fdc4257SSteve Yin 255fdc4257SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_ 265fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessible.hpp> 275fdc4257SSteve Yin #endif 285fdc4257SSteve Yin #include <map> 295fdc4257SSteve Yin #include <windows.h> 305fdc4257SSteve Yin #include <vos/mutex.hxx> 313a700b0aSSteve Yin #include <vcl/dllapi.h> 325fdc4257SSteve Yin #include "ResIDGenerator.hxx" 335fdc4257SSteve Yin #include "UAccCOM2.h" 345fdc4257SSteve Yin 355fdc4257SSteve Yin class ResIDGenerator; 365fdc4257SSteve Yin class AccObjectManagerAgent; 375fdc4257SSteve Yin class AccEventListener; 385fdc4257SSteve Yin class AccObject; 395fdc4257SSteve Yin 405fdc4257SSteve Yin /******************************************************************* 415fdc4257SSteve Yin AccObjectWinManager complete the functions: 425fdc4257SSteve Yin 1. Insert, delete,query,update Acc objects 435fdc4257SSteve Yin 2. Create, delete,fire AccEventLister, the lifecycle of AccEventListener is as same as 445fdc4257SSteve Yin Acc Object 455fdc4257SSteve Yin 3.Return COM interface for AT,by the call back in salframe 465fdc4257SSteve Yin 4.Pass accessible information to Acc objects 475fdc4257SSteve Yin *******************************************************************/ 485fdc4257SSteve Yin class AccObjectWinManager 495fdc4257SSteve Yin { 505fdc4257SSteve Yin friend class AccObjectManagerAgent; 51*b0a7a3cfSSteve Yin 525fdc4257SSteve Yin private: 535fdc4257SSteve Yin struct ltstr1 545fdc4257SSteve Yin { operator ()AccObjectWinManager::ltstr1555fdc4257SSteve Yin bool operator()(const void* s1, const void* s2) const 565fdc4257SSteve Yin { 575fdc4257SSteve Yin return long(s1)<long(s2); 585fdc4257SSteve Yin } 595fdc4257SSteve Yin }; 605fdc4257SSteve Yin struct ltstr2 615fdc4257SSteve Yin { operator ()AccObjectWinManager::ltstr2625fdc4257SSteve Yin bool operator()(const HWND s1, const HWND s2) const 635fdc4257SSteve Yin { 645fdc4257SSteve Yin return long(s1)<long(s2); 655fdc4257SSteve Yin } 665fdc4257SSteve Yin }; 675fdc4257SSteve Yin struct ltstr3 685fdc4257SSteve Yin { operator ()AccObjectWinManager::ltstr3695fdc4257SSteve Yin bool operator()(const long s1, const long s2) const 705fdc4257SSteve Yin { 715fdc4257SSteve Yin return long(s1)<long(s2); 725fdc4257SSteve Yin } 735fdc4257SSteve Yin }; 745fdc4257SSteve Yin typedef std::map< void*, AccObject,ltstr1 > XIdToAccObjHash; 755fdc4257SSteve Yin typedef std::map< HWND,void*,ltstr2 > XHWNDToXAccHash; 765fdc4257SSteve Yin typedef std::map< const long, AccObject*,ltstr3 > XResIdToAccObjHash; 775fdc4257SSteve Yin 785fdc4257SSteve Yin typedef std::map< const long, com::sun::star::accessibility::XAccessible*,ltstr3 > XHWNDToDocumentHash; 795fdc4257SSteve Yin 805fdc4257SSteve Yin 815fdc4257SSteve Yin //XAccessible to AccObject 825fdc4257SSteve Yin XIdToAccObjHash XIdAccList; 835fdc4257SSteve Yin 845fdc4257SSteve Yin //HWND to All XAccessible pointer 855fdc4257SSteve Yin XHWNDToXAccHash HwndXAcc; 865fdc4257SSteve Yin 875fdc4257SSteve Yin //id_Child to AccObject 885fdc4257SSteve Yin XResIdToAccObjHash XResIdAccList; 895fdc4257SSteve Yin 905fdc4257SSteve Yin //for file name support 915fdc4257SSteve Yin XHWNDToDocumentHash XHWNDDocList; 925fdc4257SSteve Yin 935fdc4257SSteve Yin com::sun::star::accessibility::XAccessible* oldFocus; 945fdc4257SSteve Yin 955fdc4257SSteve Yin AccObjectManagerAgent* pAgent; 965fdc4257SSteve Yin static AccObjectWinManager* me; 975fdc4257SSteve Yin ResIDGenerator ResIdGen; 985fdc4257SSteve Yin mutable ::vos::OMutex aDeleteMutex; 995fdc4257SSteve Yin mutable ::vos::OMutex aNotifyMutex; 1005fdc4257SSteve Yin mutable ::vos::OMutex maATInterfaceMutex; 1015fdc4257SSteve Yin 1025fdc4257SSteve Yin AccObjectWinManager(AccObjectManagerAgent* Agent=NULL); 1035fdc4257SSteve Yin 1045fdc4257SSteve Yin private: 1055fdc4257SSteve Yin long ImpleGenerateResID(); 1065fdc4257SSteve Yin AccObject* GetAccObjByXAcc( com::sun::star::accessibility::XAccessible* pXAcc); 1075fdc4257SSteve Yin 1085fdc4257SSteve Yin com::sun::star::accessibility::XAccessible* GetXAccByAccObj(AccObject* pAccObj); 1095fdc4257SSteve Yin 1105fdc4257SSteve Yin AccObject* GetTopWindowAccObj(HWND hWnd); 1115fdc4257SSteve Yin 1125fdc4257SSteve Yin com::sun::star::accessibility::XAccessible* GetAccDocByHWND( long pWnd ); 1135fdc4257SSteve Yin 1145fdc4257SSteve Yin void DeleteAccListener( AccObject* pAccObj ); 1155fdc4257SSteve Yin void InsertAccChildNode(AccObject* pCurObj,AccObject* pParentObj,HWND pWnd); 1165fdc4257SSteve Yin void DeleteAccChildNode(AccObject* pChild); 1175fdc4257SSteve Yin void DeleteFromHwndXAcc(com::sun::star::accessibility::XAccessible* pXAcc ); 1185fdc4257SSteve Yin int UpdateAccSelection(com::sun::star::accessibility::XAccessible* pXAcc); 1195fdc4257SSteve Yin 1205fdc4257SSteve Yin AccEventListener* createAccEventListener(com::sun::star::accessibility::XAccessible* pXAcc, AccObjectManagerAgent* Agent); 1215fdc4257SSteve Yin public: 1225fdc4257SSteve Yin virtual ~AccObjectWinManager(); 1235fdc4257SSteve Yin sal_Bool InsertAccObj( com::sun::star::accessibility::XAccessible* pXAcc,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWnd); 1245fdc4257SSteve Yin sal_Bool InsertChildrenAccObj( com::sun::star::accessibility::XAccessible* pXAcc,HWND pWnd=0); 1255fdc4257SSteve Yin void DeleteAccObj( com::sun::star::accessibility::XAccessible* pXAcc ); 1265fdc4257SSteve Yin void DeleteChildrenAccObj(com::sun::star::accessibility::XAccessible* pAccObj); 1275fdc4257SSteve Yin 1285fdc4257SSteve Yin static AccObjectWinManager* CreateAccObjectWinManagerInstance(AccObjectManagerAgent* Agent); 1295fdc4257SSteve Yin 1305fdc4257SSteve Yin sal_Bool NotifyAccEvent( com::sun::star::accessibility::XAccessible* pXAcc,short state = 0 ); 1315fdc4257SSteve Yin 1325fdc4257SSteve Yin long Get_ToATInterface( HWND hWnd, long lParam, long wParam); 1335fdc4257SSteve Yin 1345fdc4257SSteve Yin void DecreaseState( com::sun::star::accessibility::XAccessible* pXAcc,unsigned short pState ); 1355fdc4257SSteve Yin void IncreaseState( com::sun::star::accessibility::XAccessible* pXAcc,unsigned short pState ); 1365fdc4257SSteve Yin void UpdateState( com::sun::star::accessibility::XAccessible* pXAcc ); 1375fdc4257SSteve Yin void SetLocation( com::sun::star::accessibility::XAccessible* pXAcc, 1385fdc4257SSteve Yin long Top = 0,long left = 0,long width = 0,long height = 0); 1395fdc4257SSteve Yin 1405fdc4257SSteve Yin void SetValue( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any pAny ); 1415fdc4257SSteve Yin void UpdateValue( com::sun::star::accessibility::XAccessible* pXAcc ); 1425fdc4257SSteve Yin 1435fdc4257SSteve Yin void SetAccName( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any newName); 1445fdc4257SSteve Yin void UpdateAccName( com::sun::star::accessibility::XAccessible* pXAcc ); 1455fdc4257SSteve Yin 1465fdc4257SSteve Yin void SetDescription( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any newDesc ); 1475fdc4257SSteve Yin void UpdateDescription( com::sun::star::accessibility::XAccessible* pXAcc ); 1485fdc4257SSteve Yin 1495fdc4257SSteve Yin void SetRole( com::sun::star::accessibility::XAccessible* pXAcc, long Role ); 1505fdc4257SSteve Yin 1515fdc4257SSteve Yin void UpdateAccFocus( com::sun::star::accessibility::XAccessible* newFocus ); 1525fdc4257SSteve Yin void UpdateAction( com::sun::star::accessibility::XAccessible* pXAcc ); 1535fdc4257SSteve Yin 1545fdc4257SSteve Yin sal_Bool IsContainer( com::sun::star::accessibility::XAccessible* pAccessible ); 1555fdc4257SSteve Yin 1565fdc4257SSteve Yin IMAccessible* GetIMAccByXAcc( com::sun::star::accessibility::XAccessible* pXAcc ); 1575fdc4257SSteve Yin IMAccessible* GetIAccessibleFromResID(long resID); 1585fdc4257SSteve Yin 1595fdc4257SSteve Yin void NotifyDestroy( com::sun::star::accessibility::XAccessible* pXAcc ); 1605fdc4257SSteve Yin com::sun::star::accessibility::XAccessible* GetParentXAccessible( com::sun::star::accessibility::XAccessible* pXAcc ); 1615fdc4257SSteve Yin short GetParentRole( com::sun::star::accessibility::XAccessible* pXAcc ); 1625fdc4257SSteve Yin 1635fdc4257SSteve Yin void SaveTopWindowHandle(HWND hWnd, com::sun::star::accessibility::XAccessible* pXAcc); 1645fdc4257SSteve Yin 1655fdc4257SSteve Yin void UpdateChildState(com::sun::star::accessibility::XAccessible* pXAcc); 1665fdc4257SSteve Yin 1675fdc4257SSteve Yin bool IsSpecialToolboItem(com::sun::star::accessibility::XAccessible* pXAcc); 1685fdc4257SSteve Yin 1695fdc4257SSteve Yin short GetRole(com::sun::star::accessibility::XAccessible* pXAcc); 1705fdc4257SSteve Yin 1715fdc4257SSteve Yin com::sun::star::accessibility::XAccessible* GetAccDocByAccTopWin( com::sun::star::accessibility::XAccessible* pXAcc ); 1725fdc4257SSteve Yin bool IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc ); 1735fdc4257SSteve Yin 1745fdc4257SSteve Yin bool IsStateManageDescendant(com::sun::star::accessibility::XAccessible* pAccessible); 1755fdc4257SSteve Yin 1765fdc4257SSteve Yin }; 1775fdc4257SSteve Yin #endif 178