1*96821c26SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96821c26SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96821c26SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96821c26SAndrew Rist  * distributed with this work for additional information
6*96821c26SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96821c26SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96821c26SAndrew Rist  * "License"); you may not use this file except in compliance
9*96821c26SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*96821c26SAndrew Rist  *
11*96821c26SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*96821c26SAndrew Rist  *
13*96821c26SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96821c26SAndrew Rist  * software distributed under the License is distributed on an
15*96821c26SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96821c26SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96821c26SAndrew Rist  * specific language governing permissions and limitations
18*96821c26SAndrew Rist  * under the License.
19*96821c26SAndrew Rist  *
20*96821c26SAndrew Rist  *************************************************************/
21*96821c26SAndrew Rist 
22*96821c26SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _BASCTL_ACCESSIBLEDIALOGWINDOW_HXX_
25cdf0e10cSrcweir #define _BASCTL_ACCESSIBLEDIALOGWINDOW_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
28cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
30cdf0e10cSrcweir #include <comphelper/accessiblecomponenthelper.hxx>
31cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
32cdf0e10cSrcweir #include <tools/link.hxx>
33cdf0e10cSrcweir #include <svl/lstner.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <vector>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class DialogWindow;
38cdf0e10cSrcweir class DlgEditor;
39cdf0e10cSrcweir class DlgEdModel;
40cdf0e10cSrcweir class DlgEdObj;
41cdf0e10cSrcweir class VCLExternalSolarLock;
42cdf0e10cSrcweir class VclSimpleEvent;
43cdf0e10cSrcweir class VclWindowEvent;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace utl {
46cdf0e10cSrcweir class AccessibleStateSetHelper;
47cdf0e10cSrcweir }
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 
50cdf0e10cSrcweir //	----------------------------------------------------
51cdf0e10cSrcweir //	class AccessibleDialogWindow
52cdf0e10cSrcweir //	----------------------------------------------------
53cdf0e10cSrcweir 
54cdf0e10cSrcweir typedef ::comphelper::OAccessibleExtendedComponentHelper	AccessibleExtendedComponentHelper_BASE;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir typedef ::cppu::ImplHelper3	<
57cdf0e10cSrcweir 	::com::sun::star::accessibility::XAccessible,
58cdf0e10cSrcweir 	::com::sun::star::accessibility::XAccessibleSelection,
59cdf0e10cSrcweir 	::com::sun::star::lang::XServiceInfo > AccessibleDialogWindow_BASE;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir class AccessibleDialogWindow :	public AccessibleExtendedComponentHelper_BASE,
62cdf0e10cSrcweir 								public AccessibleDialogWindow_BASE,
63cdf0e10cSrcweir 								public SfxListener
64cdf0e10cSrcweir {
65cdf0e10cSrcweir private:
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	class ChildDescriptor
68cdf0e10cSrcweir 	{
69cdf0e10cSrcweir 	public:
70cdf0e10cSrcweir 		DlgEdObj*																					pDlgEdObj;
71cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >	rxAccessible;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 		ChildDescriptor( DlgEdObj* _pDlgEdObj );
74cdf0e10cSrcweir 		~ChildDescriptor();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 		ChildDescriptor( const ChildDescriptor& rDesc );
77cdf0e10cSrcweir 		ChildDescriptor& operator=( const ChildDescriptor& rDesc );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 		bool operator==( const ChildDescriptor& rDesc );
80cdf0e10cSrcweir 		bool operator<( const ChildDescriptor& rDesc ) const;
81cdf0e10cSrcweir 	};
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 	typedef ::std::vector< ChildDescriptor > AccessibleChildren;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	AccessibleChildren		m_aAccessibleChildren;
86cdf0e10cSrcweir 	VCLExternalSolarLock*	m_pExternalLock;
87cdf0e10cSrcweir 	DialogWindow*			m_pDialogWindow;
88cdf0e10cSrcweir 	DlgEditor*				m_pDlgEditor;
89cdf0e10cSrcweir 	DlgEdModel*				m_pDlgEdModel;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir protected:
92cdf0e10cSrcweir 	void					UpdateFocused();
93cdf0e10cSrcweir 	void					UpdateSelected();
94cdf0e10cSrcweir 	void					UpdateBounds();
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	sal_Bool				IsChildVisible( const ChildDescriptor& rDesc );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	void					InsertChild( const ChildDescriptor& rDesc );
99cdf0e10cSrcweir 	void					RemoveChild( const ChildDescriptor& rDesc );
100cdf0e10cSrcweir 	void					UpdateChild( const ChildDescriptor& rDesc );
101cdf0e10cSrcweir 	void					UpdateChildren();
102cdf0e10cSrcweir 	void					SortChildren();
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	DECL_LINK( WindowEventListener, VclSimpleEvent* );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	virtual void			ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
107cdf0e10cSrcweir 	virtual void			FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	// OCommonAccessibleComponent
110cdf0e10cSrcweir 	virtual ::com::sun::star::awt::Rectangle SAL_CALL	implGetBounds(  ) throw (::com::sun::star::uno::RuntimeException);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 	// XComponent
113cdf0e10cSrcweir 	virtual void SAL_CALL	disposing();
114cdf0e10cSrcweir 
115cdf0e10cSrcweir public:
116cdf0e10cSrcweir 	AccessibleDialogWindow( DialogWindow* pDialogWindow );
117cdf0e10cSrcweir 	~AccessibleDialogWindow();
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	// SfxListener
120cdf0e10cSrcweir 	virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	// XInterface
123cdf0e10cSrcweir 	DECLARE_XINTERFACE()
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	// XTypeProvider
126cdf0e10cSrcweir 	DECLARE_XTYPEPROVIDER()
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	// XServiceInfo
129cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
130cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
131cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	// XAccessible
134cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	// XAccessibleContext
137cdf0e10cSrcweir 	virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
138cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
139cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
140cdf0e10cSrcweir 	virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
141cdf0e10cSrcweir 	virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
143cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
144cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
145cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
146cdf0e10cSrcweir 	virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	// XAccessibleComponent
149cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
150cdf0e10cSrcweir 	virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
151cdf0e10cSrcweir 	virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
152cdf0e10cSrcweir 	virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 	// XAccessibleExtendedComponent
155cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont(	) throw (::com::sun::star::uno::RuntimeException);
156cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getTitledBorderText(  ) throw (::com::sun::star::uno::RuntimeException);
157cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getToolTipText(  ) throw (::com::sun::star::uno::RuntimeException);
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	// XAccessibleSelection
160cdf0e10cSrcweir 	virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
161cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
162cdf0e10cSrcweir 	virtual void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
163cdf0e10cSrcweir 	virtual void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
164cdf0e10cSrcweir 	virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
165cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
166cdf0e10cSrcweir 	virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
167cdf0e10cSrcweir };
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 
170cdf0e10cSrcweir #endif // _BASCTL_ACCESSIBLEDIALOGWINDOW_HXX_
171cdf0e10cSrcweir 
172