xref: /AOO41X/main/svtools/source/control/toolbarmenuimp.hxx (revision 01aa44aa134af97080e2cf8e8bf3a0a4cd1cffe0)
1*01aa44aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*01aa44aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*01aa44aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*01aa44aaSAndrew Rist  * distributed with this work for additional information
6*01aa44aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*01aa44aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*01aa44aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*01aa44aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*01aa44aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*01aa44aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*01aa44aaSAndrew Rist  * software distributed under the License is distributed on an
15*01aa44aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*01aa44aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*01aa44aaSAndrew Rist  * specific language governing permissions and limitations
18*01aa44aaSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*01aa44aaSAndrew Rist  *************************************************************/
21*01aa44aaSAndrew Rist 
22*01aa44aaSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include <vos/mutex.hxx>
25cdf0e10cSrcweir #include <vcl/image.hxx>
26cdf0e10cSrcweir #include <vcl/menu.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <cppuhelper/compbase4.hxx>
29cdf0e10cSrcweir #include <cppuhelper/compbase5.hxx>
30cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
33cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
34cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleContext.hpp>
35cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
36cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
37cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
38cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <rtl/ref.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <vector>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #include "framestatuslistener.hxx"
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #include "svtools/valueset.hxx"
47cdf0e10cSrcweir 
48cdf0e10cSrcweir namespace svtools {
49cdf0e10cSrcweir 
50cdf0e10cSrcweir struct ToolbarMenu_Impl;
51cdf0e10cSrcweir class ToolbarMenu;
52cdf0e10cSrcweir class ToolbarMenuEntry;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener > > EventListenerVector;
55cdf0e10cSrcweir typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir const int EXTRAITEMHEIGHT = 0; // 4;
58cdf0e10cSrcweir const int SEPARATOR_HEIGHT = 4;
59cdf0e10cSrcweir const int TITLE_ID = -1;
60cdf0e10cSrcweir const int BORDER_X = 0;
61cdf0e10cSrcweir const int BORDER_Y = 0;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir // --------------------
64cdf0e10cSrcweir // - ToolbarMenuEntry -
65cdf0e10cSrcweir // --------------------
66cdf0e10cSrcweir 
67cdf0e10cSrcweir class ToolbarMenuEntry
68cdf0e10cSrcweir {
69cdf0e10cSrcweir public:
70cdf0e10cSrcweir 	ToolbarMenu& mrMenu;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	int	mnEntryId;
73cdf0e10cSrcweir 	MenuItemBits mnBits;
74cdf0e10cSrcweir 	Size maSize;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	bool mbHasText;
77cdf0e10cSrcweir 	bool mbHasImage;
78cdf0e10cSrcweir 	bool mbChecked;
79cdf0e10cSrcweir 	bool mbEnabled;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	String maText;
82cdf0e10cSrcweir 	Image maImage;
83cdf0e10cSrcweir 	Control* mpControl;
84cdf0e10cSrcweir 	Rectangle maRect;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > mxAccContext;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir public:
89cdf0e10cSrcweir 	ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const String& rText, MenuItemBits nBits );
90cdf0e10cSrcweir 	ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, MenuItemBits nBits );
91cdf0e10cSrcweir 	ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits );
92cdf0e10cSrcweir 	ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, Control* pControl, MenuItemBits nBits );
93cdf0e10cSrcweir 	~ToolbarMenuEntry();
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	void init( int nEntryId, MenuItemBits nBits );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& GetAccessible( bool bCreate = false );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     sal_Int32 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir 	void selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir 
HasCheck() const103cdf0e10cSrcweir 	bool HasCheck() const
104cdf0e10cSrcweir 	{
105cdf0e10cSrcweir 		return mbChecked || ( mnBits & ( MIB_RADIOCHECK | MIB_CHECKABLE | MIB_AUTOCHECK ) );
106cdf0e10cSrcweir 	}
107cdf0e10cSrcweir };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir // ---------------
110cdf0e10cSrcweir // - ToolbarMenuAcc -
111cdf0e10cSrcweir // ---------------
112cdf0e10cSrcweir 
113cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper5<
114cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessible,
115cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
116cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessibleContext,
117cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessibleComponent,
118cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessibleSelection >
119cdf0e10cSrcweir     ToolbarMenuAccComponentBase;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir class ToolbarMenuAcc :
122cdf0e10cSrcweir     public ::comphelper::OBaseMutex,
123cdf0e10cSrcweir     public ToolbarMenuAccComponentBase
124cdf0e10cSrcweir {
125cdf0e10cSrcweir public:
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     ToolbarMenuAcc( ToolbarMenu_Impl& rParent );
128cdf0e10cSrcweir     ~ToolbarMenuAcc();
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     void                FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
HasAccessibleListeners() const131cdf0e10cSrcweir     bool                HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir public:
134cdf0e10cSrcweir     // XAccessible
135cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     // XAccessibleEventBroadcaster
138cdf0e10cSrcweir     using cppu::WeakComponentImplHelper5<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleSelection>::addEventListener;
139cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
140cdf0e10cSrcweir     using cppu::WeakComponentImplHelper5<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleSelection>::removeEventListener;
141cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     // XAccessibleContext
144cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
145cdf0e10cSrcweir     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);
146cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
148cdf0e10cSrcweir     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
149cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
150cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
151cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
152cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
153cdf0e10cSrcweir     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     // XAccessibleComponent
156cdf0e10cSrcweir     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
157cdf0e10cSrcweir     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);
158cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
159cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
160cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
161cdf0e10cSrcweir     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
162cdf0e10cSrcweir     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
163cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding(  ) throw (::com::sun::star::uno::RuntimeException);
164cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
165cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
166cdf0e10cSrcweir 
167cdf0e10cSrcweir     // XAccessibleSelection
168cdf0e10cSrcweir     virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
169cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
170cdf0e10cSrcweir     virtual void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
171cdf0e10cSrcweir     virtual void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
172cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
173cdf0e10cSrcweir     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);
174cdf0e10cSrcweir     virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	DECL_LINK( WindowEventListener, VclSimpleEvent* );
177cdf0e10cSrcweir 
178cdf0e10cSrcweir private:
179cdf0e10cSrcweir     EventListenerVector mxEventListeners;
180cdf0e10cSrcweir     ToolbarMenu_Impl* mpParent;
181cdf0e10cSrcweir     /// The current FOCUSED state.
182cdf0e10cSrcweir     bool mbIsFocused;
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 	void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     /** Tell all listeners that the object is dying.  This callback is
187cdf0e10cSrcweir         usually called from the WeakComponentImplHelper class.
188cdf0e10cSrcweir     */
189cdf0e10cSrcweir     virtual void SAL_CALL disposing (void);
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     /** Check whether or not the object has been disposed (or is in the
192cdf0e10cSrcweir         state of beeing disposed).  If that is the case then
193cdf0e10cSrcweir         DisposedException is thrown to inform the (indirect) caller of the
194cdf0e10cSrcweir         foul deed.
195cdf0e10cSrcweir     */
196cdf0e10cSrcweir     void ThrowIfDisposed (void) throw (::com::sun::star::lang::DisposedException);
197cdf0e10cSrcweir };
198cdf0e10cSrcweir 
199cdf0e10cSrcweir // -----------------------
200cdf0e10cSrcweir // - ToolbarMenuEntryAcc -
201cdf0e10cSrcweir // -----------------------
202cdf0e10cSrcweir 
203cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::accessibility::XAccessible,
204cdf0e10cSrcweir                                                      ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
205cdf0e10cSrcweir                                                      ::com::sun::star::accessibility::XAccessibleContext,
206cdf0e10cSrcweir                                                      ::com::sun::star::accessibility::XAccessibleComponent > ToolbarMenuEntryAccBase;
207cdf0e10cSrcweir 
208cdf0e10cSrcweir class ToolbarMenuEntryAcc : public ::comphelper::OBaseMutex,
209cdf0e10cSrcweir 							public ToolbarMenuEntryAccBase
210cdf0e10cSrcweir {
211cdf0e10cSrcweir public:
212cdf0e10cSrcweir     ToolbarMenuEntryAcc( ToolbarMenuEntry* pParent );
213cdf0e10cSrcweir     ~ToolbarMenuEntryAcc();
214cdf0e10cSrcweir 
215cdf0e10cSrcweir     void    FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
HasAccessibleListeners() const216cdf0e10cSrcweir     bool    HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir     // XAccessible
219cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
220cdf0e10cSrcweir 
221cdf0e10cSrcweir     // XAccessibleEventBroadcaster
222cdf0e10cSrcweir     using ToolbarMenuEntryAccBase::addEventListener;
223cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
224cdf0e10cSrcweir     using ToolbarMenuEntryAccBase::removeEventListener;
225cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
226cdf0e10cSrcweir 
227cdf0e10cSrcweir     // XAccessibleContext
228cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
229cdf0e10cSrcweir     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);
230cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
231cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
232cdf0e10cSrcweir     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
233cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
234cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
235cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
236cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
237cdf0e10cSrcweir     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
238cdf0e10cSrcweir 
239cdf0e10cSrcweir     // XAccessibleComponent
240cdf0e10cSrcweir     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
241cdf0e10cSrcweir     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);
242cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
243cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
244cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
245cdf0e10cSrcweir     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
246cdf0e10cSrcweir     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
247cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding(  ) throw (::com::sun::star::uno::RuntimeException);
248cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
249cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
250cdf0e10cSrcweir 
251cdf0e10cSrcweir private:
252cdf0e10cSrcweir     EventListenerVector	   mxEventListeners;
253cdf0e10cSrcweir     ::vos::OMutex		   maMutex;
254cdf0e10cSrcweir     ToolbarMenuEntry*      mpParent;
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 	/** Tell all listeners that the object is dying.  This callback is
257cdf0e10cSrcweir         usually called from the WeakComponentImplHelper class.
258cdf0e10cSrcweir     */
259cdf0e10cSrcweir     virtual void SAL_CALL disposing (void);
260cdf0e10cSrcweir };
261cdf0e10cSrcweir 
262cdf0e10cSrcweir // -----------------------------------------------------------------------------
263cdf0e10cSrcweir 
264cdf0e10cSrcweir struct ToolbarMenu_Impl
265cdf0e10cSrcweir {
266cdf0e10cSrcweir 	ToolbarMenu& mrMenu;
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >              mxFrame;
269cdf0e10cSrcweir 	rtl::Reference< svt::FrameStatusListener >										 mxStatusListener;
270cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceManager;
271cdf0e10cSrcweir 	rtl::Reference< ToolbarMenuAcc >												 mxAccessible;
272cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxOldSelection;
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 	ToolbarMenuEntryVector	maEntryVector;
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 	int mnCheckPos;
277cdf0e10cSrcweir     int mnImagePos;
278cdf0e10cSrcweir     int mnTextPos;
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 	int mnHighlightedEntry;
281cdf0e10cSrcweir 	int mnSelectedEntry;
282cdf0e10cSrcweir 	int mnLastColumn;
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 	Size maSize;
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 	Link			maSelectHdl;
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 	ToolbarMenu_Impl( ToolbarMenu& rMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
289cdf0e10cSrcweir 	~ToolbarMenu_Impl();
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 	void setAccessible( ToolbarMenuAcc* pAccessible );
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 	void fireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
294cdf0e10cSrcweir 	bool hasAccessibleListeners();
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	sal_Int32 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
297cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
298cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( Control* pControl, sal_Int32 childIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
299cdf0e10cSrcweir 
300cdf0e10cSrcweir 	void selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
301cdf0e10cSrcweir 	sal_Bool isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
302cdf0e10cSrcweir 	void clearAccessibleSelection();
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 	ToolbarMenuEntry* implGetEntry( int nEntry ) const;
305cdf0e10cSrcweir 	void notifyHighlightedEntry();
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 	void implHighlightControl( sal_uInt16 nCode, Control* pControl );
308cdf0e10cSrcweir };
309cdf0e10cSrcweir 
310cdf0e10cSrcweir }
311