Simplify erase iterator management
[LibreOffice.git] / winaccessibility / inc / AccObject.hxx
blob3f1c9ab2a241f203215fb128f836ee8b32f001c4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_WINACCESSIBILITY_INC_ACCOBJECT_HXX
21 #define INCLUDED_WINACCESSIBILITY_INC_ACCOBJECT_HXX
23 #include <vector>
24 #include <map>
25 #include <oleacc.h>
26 #include <windows.h>
28 #include <rtl/ref.hxx>
30 #include <com/sun/star/accessibility/XAccessible.hpp>
31 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
32 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
34 #include "accHelper.hxx"
35 #include "UAccCOM.h"
37 class AccEventListener;
38 class AccObjectManagerAgent;
39 class AccObject;
41 typedef std::map<const long, AccObject*> IAccSelectionList;
42 typedef std::vector<AccObject *> IAccChildList;
45 class AccObject
47 private:
49 short m_accRole;
50 long m_resID;
51 HWND m_pParantID;
52 sal_Bool m_bShouldDestroy; //avoid access COM interface when acc object is deleted
53 IMAccessible* m_pIMAcc;
54 AccObject* m_pParentObj;
55 IAccChildList m_childrenList;
56 ::rtl::Reference<AccEventListener> m_pListener;
57 IAccSelectionList m_selectionList;
59 ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > m_xAccRef;
60 ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessibleAction > m_xAccActionRef;
61 ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessibleContext > m_xAccContextRef;
63 void ImplInitializeCreateObj();//create COM object
65 void UpdateActionDesc();
66 void UpdateRole();
68 DWORD GetMSAAStateFromUNO(short xState);//translate state from UNO to MSAA value
69 ::com::sun::star::accessibility::XAccessibleSelection* GetXAccessibleSelection();
70 void GetExpandedState(sal_Bool* isExpandable, sal_Bool* isExpanded);
71 ::rtl::OUString GetMAccessibleValueFromAny(::com::sun::star::uno::Any pAny);
73 public:
75 AccObject ( ::com::sun::star::accessibility::XAccessible* pXAcc = NULL,AccObjectManagerAgent* pAgent = NULL ,AccEventListener* accListener=NULL);
76 virtual ~AccObject();
78 sal_Bool UpdateAccessibleInfoFromUnoToMSAA( ); //implement accessible information mapping
79 void UpdateDefaultAction();
81 IMAccessible* GetIMAccessible(); //return COM interface in acc object
82 ::com::sun::star::uno::Reference<
83 ::com::sun::star::accessibility::XAccessible> const& GetXAccessible();
85 void SetResID(long id);//ResID means ChildID in MSAA
86 long GetResID();
89 void SetParentHWND(HWND hWnd);//need to set top window handle when send event to AT
90 HWND GetParentHWND();
92 void SetListener(::rtl::Reference<AccEventListener> const& pListener);
93 AccEventListener* getListener();
95 void SetParentObj(AccObject* pParentAccObj);
96 AccObject* GetParentObj();
98 void InsertChild( AccObject* pChild,short pos = LAST_CHILD);
99 void DeleteChild( AccObject* pChild );
100 AccObject* NextChild();
102 void NotifyDestroy(sal_Bool ifDelete);
103 sal_Bool ifShouldDestroy();
105 void DecreaseState(short xState );//call COM interface DecreaseState method
106 void IncreaseState( short xState );//call COM interface IncreaseState method
108 void SetName( com::sun::star::uno::Any newName);
109 void SetValue( com::sun::star::uno::Any pAny );
110 void SetDescription( com::sun::star::uno::Any newDesc );
111 void SetRole( short Role );
113 short GetRole() const;
115 void UpdateState();
116 void UpdateName();
117 void UpdateValue();
118 void UpdateAction();
119 void UpdateDescription();
120 void UpdateValidWindow();
121 void UpdateLocation();
123 void setFocus();
124 void unsetFocus();
126 void AddSelect(long index, AccObject* accObj);
127 IAccSelectionList& GetSelection();
128 void setLocalizedResourceString();
131 #endif // INCLUDED_WINACCESSIBILITY_INC_ACCOBJECT_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */