1*a462bbb7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*a462bbb7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*a462bbb7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*a462bbb7SAndrew Rist  * distributed with this work for additional information
6*a462bbb7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*a462bbb7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*a462bbb7SAndrew Rist  * "License"); you may not use this file except in compliance
9*a462bbb7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*a462bbb7SAndrew Rist  *
11*a462bbb7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*a462bbb7SAndrew Rist  *
13*a462bbb7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*a462bbb7SAndrew Rist  * software distributed under the License is distributed on an
15*a462bbb7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*a462bbb7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*a462bbb7SAndrew Rist  * specific language governing permissions and limitations
18*a462bbb7SAndrew Rist  * under the License.
19*a462bbb7SAndrew Rist  *
20*a462bbb7SAndrew Rist  *************************************************************/
21*a462bbb7SAndrew Rist 
22*a462bbb7SAndrew Rist 
23cdf0e10cSrcweir #ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX
24cdf0e10cSrcweir #define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <map>
27cdf0e10cSrcweir #include <toolkit/awt/vclxaccessiblecomponent.hxx>
28cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir //	----------------------------------------------------
31cdf0e10cSrcweir //	class VCLXAccessibleToolBox
32cdf0e10cSrcweir //	----------------------------------------------------
33cdf0e10cSrcweir 
34cdf0e10cSrcweir typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleToolBox_BASE;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir typedef std::map< sal_Int32, com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > ToolBoxItemsMap;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class VCLXAccessibleToolBoxItem;
39cdf0e10cSrcweir class ToolBox;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class VCLXAccessibleToolBox : public VCLXAccessibleComponent, public VCLXAccessibleToolBox_BASE
42cdf0e10cSrcweir {
43cdf0e10cSrcweir private:
44cdf0e10cSrcweir     ToolBoxItemsMap             m_aAccessibleChildren;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 	VCLXAccessibleToolBoxItem*	GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus );
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	void						UpdateFocus_Impl();
49cdf0e10cSrcweir 	void						ReleaseFocus_Impl( sal_Int32 _nPos );
50cdf0e10cSrcweir 	void						UpdateChecked_Impl( sal_Int32 _nPos );
51cdf0e10cSrcweir 	void						UpdateIndeterminate_Impl( sal_Int32 _nPos );
52cdf0e10cSrcweir 	void						UpdateItem_Impl( sal_Int32 _nPos, sal_Bool _bItemAdded );
53cdf0e10cSrcweir 	void						UpdateAllItems_Impl();
54cdf0e10cSrcweir 	void						UpdateItemName_Impl( sal_Int32 _nPos );
55cdf0e10cSrcweir 	void						UpdateItemEnabled_Impl( sal_Int32 _nPos );
56cdf0e10cSrcweir 	void						UpdateCustomPopupItemp_Impl( Window* pWindow, bool bOpen );
57cdf0e10cSrcweir     void                        HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow );
58cdf0e10cSrcweir     void                        ReleaseSubToolBox( ToolBox* _pSubToolBox );
59cdf0e10cSrcweir 
60cdf0e10cSrcweir protected:
61cdf0e10cSrcweir 	virtual	~VCLXAccessibleToolBox();
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     virtual void	FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
64cdf0e10cSrcweir 	virtual void	ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
65cdf0e10cSrcweir 	virtual void	ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent );
68cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetItemWindowAccessible( const VclWindowEvent& rVclWindowEvent );
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	// XComponent
71cdf0e10cSrcweir 	virtual void SAL_CALL disposing();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir public:
74cdf0e10cSrcweir 	VCLXAccessibleToolBox( VCLXWindow* pVCLXWindow );
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	// XInterface
77cdf0e10cSrcweir 	DECLARE_XINTERFACE( )
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	// XTypeProvider
80cdf0e10cSrcweir 	DECLARE_XTYPEPROVIDER( )
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	// XServiceInfo
83cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
84cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	// XAccessibleContext
87cdf0e10cSrcweir 	virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir 	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);
89cdf0e10cSrcweir 	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);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     // XAccessibleSelection
92cdf0e10cSrcweir     virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
94cdf0e10cSrcweir     virtual void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir     virtual void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
96cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
97cdf0e10cSrcweir     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);
98cdf0e10cSrcweir     virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir 
100cdf0e10cSrcweir private:
101cdf0e10cSrcweir 	void implReleaseToolboxItem(
102cdf0e10cSrcweir 			ToolBoxItemsMap::iterator& _rMapPos,
103cdf0e10cSrcweir 			bool _bNotifyRemoval,
104cdf0e10cSrcweir 			bool _bDispose
105cdf0e10cSrcweir 		);
106cdf0e10cSrcweir };
107cdf0e10cSrcweir 
108cdf0e10cSrcweir #endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX
109cdf0e10cSrcweir 
110