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