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_ACCESSIBLEFILTERMENUITEM_HXX
25 #define SC_ACCESSIBLEFILTERMENUITEM_HXX
26 
27 #include "AccessibleContextBase.hxx"
28 #include "cppuhelper/implbase1.hxx"
29 
30 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
31 
32 class ScMenuFloatingWindow;
33 
34 typedef ::cppu::ImplHelper1<
35     ::com::sun::star::accessibility::XAccessibleAction > ScAccessibleFilterMenuItem_BASE;
36 
37 class ScAccessibleFilterMenuItem :
38     public ScAccessibleContextBase,
39     public ScAccessibleFilterMenuItem_BASE
40 {
41 public:
42     explicit ScAccessibleFilterMenuItem(
43         const ::com::sun::star::uno::Reference<
44             ::com::sun::star::accessibility::XAccessible>& rxParent, ScMenuFloatingWindow* pWin, const ::rtl::OUString& rName, size_t nMenuPos);
45 
46     virtual ~ScAccessibleFilterMenuItem();
47 
48 	// XAccessibleContext
49 
50     virtual sal_Int32 SAL_CALL getAccessibleChildCount()
51         throw (::com::sun::star::uno::RuntimeException);
52 
53     virtual ::com::sun::star::uno::Reference<
54         ::com::sun::star::accessibility::XAccessible > SAL_CALL
55     	getAccessibleChild(sal_Int32 nIndex)
56             throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
57 
58 	virtual ::com::sun::star::uno::Reference<
59         ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
60     	getAccessibleStateSet()
61             throw (::com::sun::star::uno::RuntimeException);
62 
63 	virtual ::rtl::OUString SAL_CALL getImplementationName()
64         throw (::com::sun::star::uno::RuntimeException);
65 
66     // XAccessibleAction
67 
68     virtual ::sal_Int32 SAL_CALL getAccessibleActionCount()
69         throw (::com::sun::star::uno::RuntimeException);
70 
71     virtual ::sal_Bool SAL_CALL doAccessibleAction(sal_Int32 nIndex)
72         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
73 
74     virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription(sal_Int32 nIndex)
75         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
76 
77     virtual ::com::sun::star::uno::Reference<
78         ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL
79         getAccessibleActionKeyBinding(sal_Int32 nIndex)
80             throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
81 
82     // XInterface
83 
84 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
85 		::com::sun::star::uno::Type const & rType )
86 		    throw (::com::sun::star::uno::RuntimeException);
87 
88 	virtual void SAL_CALL acquire() throw ();
89 	virtual void SAL_CALL release() throw ();
90 
91     // Non-UNO Methods
92 
93     void setEnabled(bool bEnabled);
94 
95 protected:
96 
97 	virtual Rectangle GetBoundingBoxOnScreen() const
98 		throw (::com::sun::star::uno::RuntimeException);
99 
100 	virtual Rectangle GetBoundingBox() const
101 		throw (::com::sun::star::uno::RuntimeException);
102 
103 private:
104     bool isSelected() const;
105     bool isFocused() const;
106     void updateStateSet();
107 
108 private:
109     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
110 
111     ScMenuFloatingWindow* mpWindow;
112     ::rtl::OUString maName;
113     size_t mnMenuPos;
114     bool mbEnabled;
115 };
116 
117 #endif
118