1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX 28 #define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX 29 30 #include <map> 31 #include <toolkit/awt/vclxaccessiblecomponent.hxx> 32 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 33 34 // ---------------------------------------------------- 35 // class VCLXAccessibleToolBox 36 // ---------------------------------------------------- 37 38 typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleToolBox_BASE; 39 40 typedef std::map< sal_Int32, com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > ToolBoxItemsMap; 41 42 class VCLXAccessibleToolBoxItem; 43 class ToolBox; 44 45 class VCLXAccessibleToolBox : public VCLXAccessibleComponent, public VCLXAccessibleToolBox_BASE 46 { 47 private: 48 ToolBoxItemsMap m_aAccessibleChildren; 49 50 VCLXAccessibleToolBoxItem* GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus ); 51 52 void UpdateFocus_Impl(); 53 void ReleaseFocus_Impl( sal_Int32 _nPos ); 54 void UpdateChecked_Impl( sal_Int32 _nPos ); 55 void UpdateIndeterminate_Impl( sal_Int32 _nPos ); 56 void UpdateItem_Impl( sal_Int32 _nPos, sal_Bool _bItemAdded ); 57 void UpdateAllItems_Impl(); 58 void UpdateItemName_Impl( sal_Int32 _nPos ); 59 void UpdateItemEnabled_Impl( sal_Int32 _nPos ); 60 void UpdateCustomPopupItemp_Impl( Window* pWindow, bool bOpen ); 61 void HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow ); 62 void ReleaseSubToolBox( ToolBox* _pSubToolBox ); 63 64 protected: 65 virtual ~VCLXAccessibleToolBox(); 66 67 virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); 68 virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); 69 virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ); 70 71 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent ); 72 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetItemWindowAccessible( const VclWindowEvent& rVclWindowEvent ); 73 74 // XComponent 75 virtual void SAL_CALL disposing(); 76 77 public: 78 VCLXAccessibleToolBox( VCLXWindow* pVCLXWindow ); 79 80 // XInterface 81 DECLARE_XINTERFACE( ) 82 83 // XTypeProvider 84 DECLARE_XTYPEPROVIDER( ) 85 86 // XServiceInfo 87 virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); 88 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); 89 90 // XAccessibleContext 91 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 92 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); 93 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); 94 95 // XAccessibleSelection 96 virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 97 virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 98 virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); 99 virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); 100 virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 101 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); 102 virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 103 104 private: 105 void implReleaseToolboxItem( 106 ToolBoxItemsMap::iterator& _rMapPos, 107 bool _bNotifyRemoval, 108 bool _bDispose 109 ); 110 }; 111 112 #endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX 113 114