1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SC_ACCESSIBLEFILTERMENU_HXX 25 #define SC_ACCESSIBLEFILTERMENU_HXX 26 27 #include "AccessibleContextBase.hxx" 28 #include "cppuhelper/implbase1.hxx" 29 30 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 31 #include <com/sun/star/accessibility/XAccessibleText.hpp> 32 #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> 33 #include <com/sun/star/accessibility/TextSegment.hpp> 34 35 #include <vector> 36 37 namespace com { namespace sun { namespace star { 38 namespace accessibility { 39 struct AccessibleEventObject; 40 } 41 }}} 42 43 class ScDocument; 44 class ScMenuFloatingWindow; 45 46 typedef ::cppu::ImplHelper1< 47 ::com::sun::star::accessibility::XAccessibleSelection > ScAccessibleFilterMenu_BASE; 48 49 class ScAccessibleFilterMenu : 50 public ScAccessibleContextBase, 51 public ScAccessibleFilterMenu_BASE 52 { 53 public: 54 explicit ScAccessibleFilterMenu( 55 const ::com::sun::star::uno::Reference< 56 ::com::sun::star::accessibility::XAccessible>& rxParent, 57 ScMenuFloatingWindow* pWin, const ::rtl::OUString& rName, size_t nMenuPos, ScDocument* pDoc); 58 virtual ~ScAccessibleFilterMenu(); 59 60 // XAccessibleComponent 61 62 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 63 SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) 64 throw (::com::sun::star::uno::RuntimeException); 65 66 virtual sal_Bool SAL_CALL isVisible() 67 throw (::com::sun::star::uno::RuntimeException); 68 69 virtual void SAL_CALL grabFocus() 70 throw (::com::sun::star::uno::RuntimeException); 71 72 virtual sal_Int32 SAL_CALL getForeground() 73 throw (::com::sun::star::uno::RuntimeException); 74 75 virtual sal_Int32 SAL_CALL getBackground() 76 throw (::com::sun::star::uno::RuntimeException); 77 78 // XAccessibleContext 79 80 virtual ::rtl::OUString SAL_CALL getAccessibleName() 81 throw (::com::sun::star::uno::RuntimeException); 82 83 virtual sal_Int32 SAL_CALL getAccessibleChildCount() 84 throw (::com::sun::star::uno::RuntimeException); 85 86 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 87 getAccessibleChild(sal_Int32 nIndex) 88 throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); 89 90 virtual ::com::sun::star::uno::Reference< 91 ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL 92 getAccessibleStateSet() 93 throw (::com::sun::star::uno::RuntimeException); 94 95 virtual ::rtl::OUString SAL_CALL getImplementationName() 96 throw (::com::sun::star::uno::RuntimeException); 97 98 // XAccessibleEventBroadcaster 99 100 using ScAccessibleContextBase::addEventListener; 101 using ScAccessibleContextBase::removeEventListener; 102 103 virtual void SAL_CALL 104 addEventListener( 105 const ::com::sun::star::uno::Reference< 106 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) 107 throw (com::sun::star::uno::RuntimeException); 108 109 // Remove an existing event listener. 110 virtual void SAL_CALL 111 removeEventListener( 112 const ::com::sun::star::uno::Reference< 113 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) 114 throw (com::sun::star::uno::RuntimeException); 115 116 // XAccessibleSelection 117 118 virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) 119 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 120 121 virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) 122 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 123 124 virtual void SAL_CALL clearAccessibleSelection() 125 throw (::com::sun::star::uno::RuntimeException); 126 127 virtual void SAL_CALL selectAllAccessibleChildren() 128 throw (::com::sun::star::uno::RuntimeException); 129 130 virtual ::sal_Int32 SAL_CALL getSelectedAccessibleChildCount() 131 throw (::com::sun::star::uno::RuntimeException); 132 133 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL 134 getSelectedAccessibleChild(sal_Int32 nChildIndex) 135 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 136 137 virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nChildIndex) 138 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 139 140 // XInterface 141 142 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 143 ::com::sun::star::uno::Type const & rType ) 144 throw (::com::sun::star::uno::RuntimeException); 145 146 virtual void SAL_CALL acquire() throw (); 147 virtual void SAL_CALL release() throw (); 148 149 // XTypeProvider 150 151 virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() 152 throw (::com::sun::star::uno::RuntimeException); 153 154 // non-UNO methods 155 156 void appendMenuItem(const ::rtl::OUString& rName, bool bEnabled, size_t nMenuPos); 157 void setMenuPos(size_t nMenuPos); 158 void setEnabled(bool bEnabled); 159 160 protected: 161 162 sal_Int32 getMenuItemCount() const; 163 164 virtual Rectangle GetBoundingBoxOnScreen() const 165 throw (::com::sun::star::uno::RuntimeException); 166 167 virtual Rectangle GetBoundingBox() const 168 throw (::com::sun::star::uno::RuntimeException); 169 170 private: 171 bool isSelected() const; 172 bool isFocused() const; 173 174 void updateStates(); 175 176 private: 177 ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > maMenuItems; 178 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet; 179 180 size_t mnMenuPos; 181 ScMenuFloatingWindow* mpWindow; 182 ScDocument* mpDoc; 183 184 bool mbEnabled:1; 185 }; 186 187 #endif 188