1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_accessibility.hxx"
30*cdf0e10cSrcweir #include <accessibility/helper/acc_factory.hxx>
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <toolkit/awt/vclxwindows.hxx>
33*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblebutton.hxx>
34*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblecheckbox.hxx>
35*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibledropdowncombobox.hxx>
36*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblecombobox.hxx>
37*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibledropdownlistbox.hxx>
38*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibleedit.hxx>
39*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblefixedhyperlink.hxx>
40*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblefixedtext.hxx>
41*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblelistbox.hxx>
42*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblemenu.hxx>
43*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibleradiobutton.hxx>
44*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblescrollbar.hxx>
45*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibletextcomponent.hxx>
46*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibletoolbox.hxx>
47*cdf0e10cSrcweir #include <toolkit/awt/vclxaccessiblecomponent.hxx>
48*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblestatusbar.hxx>
49*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibletabcontrol.hxx>
50*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibletabpagewindow.hxx>
51*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblemenubar.hxx>
52*cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblepopupmenu.hxx>
53*cdf0e10cSrcweir #include <accessibility/extended/accessibletablistbox.hxx>
54*cdf0e10cSrcweir #include <accessibility/extended/AccessibleBrowseBox.hxx>
55*cdf0e10cSrcweir #include <accessibility/extended/accessibleiconchoicectrl.hxx>
56*cdf0e10cSrcweir #include <accessibility/extended/accessibletabbar.hxx>
57*cdf0e10cSrcweir #include <accessibility/extended/accessiblelistbox.hxx>
58*cdf0e10cSrcweir #include <accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx>
59*cdf0e10cSrcweir #include <accessibility/extended/textwindowaccessibility.hxx>
60*cdf0e10cSrcweir #include <accessibility/extended/AccessibleBrowseBoxTableCell.hxx>
61*cdf0e10cSrcweir #include <accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx>
62*cdf0e10cSrcweir #include <accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx>
63*cdf0e10cSrcweir #include <accessibility/extended/accessibleeditbrowseboxcell.hxx>
64*cdf0e10cSrcweir #include <accessibility/extended/AccessibleToolPanelDeck.hxx>
65*cdf0e10cSrcweir #include <accessibility/extended/AccessibleToolPanelDeckTabBar.hxx>
66*cdf0e10cSrcweir #include <accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx>
67*cdf0e10cSrcweir #include <vcl/lstbox.hxx>
68*cdf0e10cSrcweir #include <vcl/combobox.hxx>
69*cdf0e10cSrcweir #include <accessibility/extended/AccessibleGridControl.hxx>
70*cdf0e10cSrcweir #include <svtools/accessibletable.hxx>
71*cdf0e10cSrcweir #include <vcl/popupmenuwindow.hxx>
72*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir #include "floatingwindowaccessible.hxx"
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir //........................................................................
77*cdf0e10cSrcweir namespace accessibility
78*cdf0e10cSrcweir {
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir inline bool hasFloatingChild(Window *pWindow)
81*cdf0e10cSrcweir {
82*cdf0e10cSrcweir     Window * pChild = pWindow->GetAccessibleChildWindow(0);
83*cdf0e10cSrcweir     if( pChild && WINDOW_FLOATINGWINDOW == pChild->GetType() )
84*cdf0e10cSrcweir         return true;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir     return false;
87*cdf0e10cSrcweir }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir //........................................................................
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir     using namespace ::com::sun::star::uno;
92*cdf0e10cSrcweir     using namespace ::com::sun::star::awt;
93*cdf0e10cSrcweir     using namespace ::com::sun::star::accessibility;
94*cdf0e10cSrcweir     using namespace ::svt;
95*cdf0e10cSrcweir 	using namespace ::svt::table;
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir     //================================================================
98*cdf0e10cSrcweir 	//= IAccessibleFactory
99*cdf0e10cSrcweir 	//================================================================
100*cdf0e10cSrcweir     class AccessibleFactory :public ::toolkit::IAccessibleFactory
101*cdf0e10cSrcweir                             ,public ::svt::IAccessibleFactory
102*cdf0e10cSrcweir     {
103*cdf0e10cSrcweir     private:
104*cdf0e10cSrcweir         oslInterlockedCount m_refCount;
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     public:
107*cdf0e10cSrcweir         AccessibleFactory();
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir         // IReference
110*cdf0e10cSrcweir 	    virtual oslInterlockedCount SAL_CALL acquire();
111*cdf0e10cSrcweir 	    virtual oslInterlockedCount SAL_CALL release();
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir         // ::toolkit::IAccessibleFactory
114*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
115*cdf0e10cSrcweir             createAccessibleContext( VCLXButton* _pXWindow );
116*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
117*cdf0e10cSrcweir             createAccessibleContext( VCLXCheckBox* _pXWindow );
118*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
119*cdf0e10cSrcweir             createAccessibleContext( VCLXRadioButton* _pXWindow );
120*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
121*cdf0e10cSrcweir             createAccessibleContext( VCLXListBox* _pXWindow );
122*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
123*cdf0e10cSrcweir             createAccessibleContext( VCLXFixedText* _pXWindow );
124*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
125*cdf0e10cSrcweir             createAccessibleContext( VCLXFixedHyperlink* _pXWindow );
126*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
127*cdf0e10cSrcweir             createAccessibleContext( VCLXScrollBar* _pXWindow );
128*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
129*cdf0e10cSrcweir             createAccessibleContext( VCLXEdit* _pXWindow );
130*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
131*cdf0e10cSrcweir             createAccessibleContext( VCLXComboBox* _pXWindow );
132*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
133*cdf0e10cSrcweir             createAccessibleContext( VCLXToolBox* _pXWindow );
134*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
135*cdf0e10cSrcweir             createAccessibleContext( VCLXWindow* _pXWindow );
136*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
137*cdf0e10cSrcweir             createAccessible( Menu* _pMenu, sal_Bool _bIsMenuBar );
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir         // ::svt::IAccessibleFactory
140*cdf0e10cSrcweir         virtual IAccessibleTabListBox*
141*cdf0e10cSrcweir             createAccessibleTabListBox(
142*cdf0e10cSrcweir 		        const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
143*cdf0e10cSrcweir 		        SvHeaderTabListBox& rBox
144*cdf0e10cSrcweir             ) const;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir         virtual IAccessibleBrowseBox*
147*cdf0e10cSrcweir             createAccessibleBrowseBox(
148*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
149*cdf0e10cSrcweir                 IAccessibleTableProvider& _rBrowseBox
150*cdf0e10cSrcweir 		    ) const;
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 		virtual IAccessibleTableControl*
153*cdf0e10cSrcweir             createAccessibleTableControl(
154*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
155*cdf0e10cSrcweir 				IAccessibleTable& _rTable
156*cdf0e10cSrcweir 		    ) const;
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
159*cdf0e10cSrcweir 		    createAccessibleIconChoiceCtrl(
160*cdf0e10cSrcweir                 SvtIconChoiceCtrl& _rIconCtrl,
161*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent
162*cdf0e10cSrcweir 		    ) const;
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
165*cdf0e10cSrcweir 		    createAccessibleTabBar(
166*cdf0e10cSrcweir                 TabBar& _rTabBar
167*cdf0e10cSrcweir 		    ) const;
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
170*cdf0e10cSrcweir 		    createAccessibleTextWindowContext(
171*cdf0e10cSrcweir                 VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView, bool bCompoundControlChild
172*cdf0e10cSrcweir 		    ) const;
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
175*cdf0e10cSrcweir             createAccessibleTreeListBox(
176*cdf0e10cSrcweir                 SvTreeListBox& _rListBox,
177*cdf0e10cSrcweir 				const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent
178*cdf0e10cSrcweir 		    ) const;
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
181*cdf0e10cSrcweir             createAccessibleBrowseBoxHeaderBar(
182*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
183*cdf0e10cSrcweir                 IAccessibleTableProvider& _rOwningTable,
184*cdf0e10cSrcweir                 AccessibleBrowseBoxObjType _eObjType
185*cdf0e10cSrcweir             ) const;
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
188*cdf0e10cSrcweir             createAccessibleBrowseBoxTableCell(
189*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
190*cdf0e10cSrcweir 				IAccessibleTableProvider& _rBrowseBox,
191*cdf0e10cSrcweir 				const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
192*cdf0e10cSrcweir 				sal_Int32 _nRowId,
193*cdf0e10cSrcweir 				sal_uInt16 _nColId,
194*cdf0e10cSrcweir                 sal_Int32 _nOffset
195*cdf0e10cSrcweir             ) const;
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
198*cdf0e10cSrcweir             createAccessibleBrowseBoxHeaderCell(
199*cdf0e10cSrcweir                 sal_Int32 _nColumnRowId,
200*cdf0e10cSrcweir 				const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
201*cdf0e10cSrcweir 				IAccessibleTableProvider& _rBrowseBox,
202*cdf0e10cSrcweir 				const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
203*cdf0e10cSrcweir 				AccessibleBrowseBoxObjType  _eObjType
204*cdf0e10cSrcweir             ) const;
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
207*cdf0e10cSrcweir             createAccessibleCheckBoxCell(
208*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
209*cdf0e10cSrcweir 				IAccessibleTableProvider& _rBrowseBox,
210*cdf0e10cSrcweir 				const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
211*cdf0e10cSrcweir 				sal_Int32 _nRowPos,
212*cdf0e10cSrcweir 				sal_uInt16 _nColPos,
213*cdf0e10cSrcweir 				const TriState& _eState,
214*cdf0e10cSrcweir 				sal_Bool _bEnabled,
215*cdf0e10cSrcweir 				sal_Bool _bIsTriState
216*cdf0e10cSrcweir             ) const;
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
219*cdf0e10cSrcweir             createEditBrowseBoxTableCellAccess(
220*cdf0e10cSrcweir 			    const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxParent,
221*cdf0e10cSrcweir 			    const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxControlAccessible,
222*cdf0e10cSrcweir 			    const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _rxFocusWindow,
223*cdf0e10cSrcweir                 IAccessibleTableProvider& _rBrowseBox,
224*cdf0e10cSrcweir 			    sal_Int32 _nRowPos,
225*cdf0e10cSrcweir 			    sal_uInt16 _nColPos
226*cdf0e10cSrcweir 		    ) const;
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
229*cdf0e10cSrcweir             createAccessibleToolPanelDeck(
230*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
231*cdf0e10cSrcweir                 ::svt::ToolPanelDeck& i_rPanelDeck
232*cdf0e10cSrcweir             );
233*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
234*cdf0e10cSrcweir             createAccessibleToolPanelTabBar(
235*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
236*cdf0e10cSrcweir                 ::svt::IToolPanelDeck& i_rPanelDeck,
237*cdf0e10cSrcweir                 ::svt::PanelTabBar& i_rTabBar
238*cdf0e10cSrcweir             );
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir     protected:
241*cdf0e10cSrcweir         virtual ~AccessibleFactory();
242*cdf0e10cSrcweir     };
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir 	//--------------------------------------------------------------------
246*cdf0e10cSrcweir     AccessibleFactory::AccessibleFactory()
247*cdf0e10cSrcweir         :m_refCount( 0 )
248*cdf0e10cSrcweir     {
249*cdf0e10cSrcweir     }
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 	//--------------------------------------------------------------------
252*cdf0e10cSrcweir     AccessibleFactory::~AccessibleFactory()
253*cdf0e10cSrcweir     {
254*cdf0e10cSrcweir     }
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir     //--------------------------------------------------------------------
257*cdf0e10cSrcweir 	oslInterlockedCount SAL_CALL AccessibleFactory::acquire()
258*cdf0e10cSrcweir     {
259*cdf0e10cSrcweir         return osl_incrementInterlockedCount( &m_refCount );
260*cdf0e10cSrcweir     }
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 	//--------------------------------------------------------------------
263*cdf0e10cSrcweir 	oslInterlockedCount SAL_CALL AccessibleFactory::release()
264*cdf0e10cSrcweir     {
265*cdf0e10cSrcweir         if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
266*cdf0e10cSrcweir         {
267*cdf0e10cSrcweir             delete this;
268*cdf0e10cSrcweir             return 0;
269*cdf0e10cSrcweir         }
270*cdf0e10cSrcweir         return m_refCount;
271*cdf0e10cSrcweir     }
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 	//--------------------------------------------------------------------
274*cdf0e10cSrcweir     Reference< XAccessible > AccessibleFactory::createAccessible( Menu* _pMenu, sal_Bool _bIsMenuBar )
275*cdf0e10cSrcweir     {
276*cdf0e10cSrcweir 		OAccessibleMenuBaseComponent* pAccessible;
277*cdf0e10cSrcweir         if ( _bIsMenuBar )
278*cdf0e10cSrcweir             pAccessible = new VCLXAccessibleMenuBar( _pMenu );
279*cdf0e10cSrcweir         else
280*cdf0e10cSrcweir             pAccessible = new VCLXAccessiblePopupMenu( _pMenu );
281*cdf0e10cSrcweir 		pAccessible->SetStates();
282*cdf0e10cSrcweir 		return pAccessible;
283*cdf0e10cSrcweir     }
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir 	//--------------------------------------------------------------------
286*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXButton* _pXWindow )
287*cdf0e10cSrcweir     {
288*cdf0e10cSrcweir         return new VCLXAccessibleButton( _pXWindow );
289*cdf0e10cSrcweir     }
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir 	//--------------------------------------------------------------------
292*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXCheckBox* _pXWindow )
293*cdf0e10cSrcweir     {
294*cdf0e10cSrcweir 	    return new VCLXAccessibleCheckBox( _pXWindow );
295*cdf0e10cSrcweir     }
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir 	//--------------------------------------------------------------------
298*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXRadioButton* _pXWindow )
299*cdf0e10cSrcweir     {
300*cdf0e10cSrcweir 	    return new VCLXAccessibleRadioButton( _pXWindow );
301*cdf0e10cSrcweir     }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 	//--------------------------------------------------------------------
304*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXListBox* _pXWindow )
305*cdf0e10cSrcweir     {
306*cdf0e10cSrcweir 	    sal_Bool bIsDropDownBox = sal_False;
307*cdf0e10cSrcweir 	    ListBox* pBox = static_cast< ListBox* >( _pXWindow->GetWindow() );
308*cdf0e10cSrcweir 	    if ( pBox )
309*cdf0e10cSrcweir 		    bIsDropDownBox = ( ( pBox->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN );
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir 	    if ( bIsDropDownBox )
312*cdf0e10cSrcweir 		    return new VCLXAccessibleDropDownListBox( _pXWindow );
313*cdf0e10cSrcweir 	    else
314*cdf0e10cSrcweir 		    return new VCLXAccessibleListBox( _pXWindow );
315*cdf0e10cSrcweir     }
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir     //--------------------------------------------------------------------
318*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXFixedText* _pXWindow )
319*cdf0e10cSrcweir     {
320*cdf0e10cSrcweir         return new VCLXAccessibleFixedText( _pXWindow );
321*cdf0e10cSrcweir     }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir     //--------------------------------------------------------------------
324*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXFixedHyperlink* _pXWindow )
325*cdf0e10cSrcweir     {
326*cdf0e10cSrcweir         return new VCLXAccessibleFixedHyperlink( _pXWindow );
327*cdf0e10cSrcweir     }
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 	//--------------------------------------------------------------------
330*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXScrollBar* _pXWindow )
331*cdf0e10cSrcweir     {
332*cdf0e10cSrcweir 	    return new VCLXAccessibleScrollBar( _pXWindow );
333*cdf0e10cSrcweir     }
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir 	//--------------------------------------------------------------------
336*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXEdit* _pXWindow )
337*cdf0e10cSrcweir     {
338*cdf0e10cSrcweir 	    return new VCLXAccessibleEdit( _pXWindow );
339*cdf0e10cSrcweir     }
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 	//--------------------------------------------------------------------
342*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXComboBox* _pXWindow )
343*cdf0e10cSrcweir     {
344*cdf0e10cSrcweir 	    sal_Bool bIsDropDownBox = sal_False;
345*cdf0e10cSrcweir 	    ComboBox* pBox = static_cast< ComboBox* >( _pXWindow->GetWindow() );
346*cdf0e10cSrcweir 	    if ( pBox )
347*cdf0e10cSrcweir 		    bIsDropDownBox = ( ( pBox->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN );
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir 	    if ( bIsDropDownBox )
350*cdf0e10cSrcweir 		    return new VCLXAccessibleDropDownComboBox( _pXWindow );
351*cdf0e10cSrcweir 	    else
352*cdf0e10cSrcweir 		    return new VCLXAccessibleComboBox( _pXWindow );
353*cdf0e10cSrcweir     }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir 	//--------------------------------------------------------------------
356*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXWindow* _pXWindow )
357*cdf0e10cSrcweir     {
358*cdf0e10cSrcweir         Reference< XAccessibleContext > xContext;
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir         Window* pWindow = _pXWindow->GetWindow();
361*cdf0e10cSrcweir         if ( pWindow )
362*cdf0e10cSrcweir         {
363*cdf0e10cSrcweir             WindowType nType = pWindow->GetType();
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir             if ( nType == WINDOW_MENUBARWINDOW || pWindow->IsMenuFloatingWindow() || pWindow->IsToolbarFloatingWindow() )
366*cdf0e10cSrcweir             {
367*cdf0e10cSrcweir                 Reference< XAccessible > xAcc( pWindow->GetAccessible() );
368*cdf0e10cSrcweir                 if ( xAcc.is() )
369*cdf0e10cSrcweir                 {
370*cdf0e10cSrcweir                     Reference< XAccessibleContext > xCont( xAcc->getAccessibleContext() );
371*cdf0e10cSrcweir                     if ( pWindow->GetType() == WINDOW_MENUBARWINDOW ||
372*cdf0e10cSrcweir                         ( xCont.is() && xCont->getAccessibleRole() == AccessibleRole::POPUP_MENU ) )
373*cdf0e10cSrcweir                     {
374*cdf0e10cSrcweir                         xContext = xCont;
375*cdf0e10cSrcweir                     }
376*cdf0e10cSrcweir                 }
377*cdf0e10cSrcweir             }
378*cdf0e10cSrcweir             else if ( nType == WINDOW_STATUSBAR )
379*cdf0e10cSrcweir             {
380*cdf0e10cSrcweir                 xContext = (XAccessibleContext*) new VCLXAccessibleStatusBar( _pXWindow );
381*cdf0e10cSrcweir             }
382*cdf0e10cSrcweir             else if ( nType == WINDOW_TABCONTROL )
383*cdf0e10cSrcweir             {
384*cdf0e10cSrcweir                 xContext = (XAccessibleContext*) new VCLXAccessibleTabControl( _pXWindow );
385*cdf0e10cSrcweir             }
386*cdf0e10cSrcweir             else if ( nType == WINDOW_TABPAGE && pWindow->GetAccessibleParentWindow() && pWindow->GetAccessibleParentWindow()->GetType() == WINDOW_TABCONTROL )
387*cdf0e10cSrcweir             {
388*cdf0e10cSrcweir                 xContext = new VCLXAccessibleTabPageWindow( _pXWindow );
389*cdf0e10cSrcweir             }
390*cdf0e10cSrcweir             else if ( nType == WINDOW_FLOATINGWINDOW )
391*cdf0e10cSrcweir             {
392*cdf0e10cSrcweir                 xContext = new FloatingWindowAccessible( _pXWindow );
393*cdf0e10cSrcweir             }
394*cdf0e10cSrcweir             else if ( nType == WINDOW_BORDERWINDOW && hasFloatingChild( pWindow ) )
395*cdf0e10cSrcweir             {
396*cdf0e10cSrcweir                 PopupMenuFloatingWindow* pChild = dynamic_cast<PopupMenuFloatingWindow*>(
397*cdf0e10cSrcweir                     pWindow->GetAccessibleChildWindow(0));
398*cdf0e10cSrcweir                 if ( pChild && pChild->IsPopupMenu() )
399*cdf0e10cSrcweir                 {
400*cdf0e10cSrcweir                     // Get the accessible context from the child window.
401*cdf0e10cSrcweir                     Reference<XAccessible> xAccessible = pChild->CreateAccessible();
402*cdf0e10cSrcweir                     if (xAccessible.is())
403*cdf0e10cSrcweir                         xContext = xAccessible->getAccessibleContext();
404*cdf0e10cSrcweir                 }
405*cdf0e10cSrcweir                 else
406*cdf0e10cSrcweir                     xContext = new FloatingWindowAccessible( _pXWindow );
407*cdf0e10cSrcweir             }
408*cdf0e10cSrcweir             else if ( ( nType == WINDOW_HELPTEXTWINDOW ) || ( nType == WINDOW_FIXEDLINE ) )
409*cdf0e10cSrcweir             {
410*cdf0e10cSrcweir                xContext = (accessibility::XAccessibleContext*) new VCLXAccessibleFixedText( _pXWindow );
411*cdf0e10cSrcweir             }
412*cdf0e10cSrcweir             else
413*cdf0e10cSrcweir             {
414*cdf0e10cSrcweir                xContext = (accessibility::XAccessibleContext*) new VCLXAccessibleComponent( _pXWindow );
415*cdf0e10cSrcweir             }
416*cdf0e10cSrcweir         }
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir         return xContext;
419*cdf0e10cSrcweir     }
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir 	//--------------------------------------------------------------------
422*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXToolBox* _pXWindow )
423*cdf0e10cSrcweir     {
424*cdf0e10cSrcweir 	    return new VCLXAccessibleToolBox( _pXWindow );
425*cdf0e10cSrcweir     }
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir 	//--------------------------------------------------------------------
428*cdf0e10cSrcweir     IAccessibleTabListBox* AccessibleFactory::createAccessibleTabListBox(
429*cdf0e10cSrcweir         const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) const
430*cdf0e10cSrcweir     {
431*cdf0e10cSrcweir         return new AccessibleTabListBox( rxParent, rBox );
432*cdf0e10cSrcweir     }
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir 	//--------------------------------------------------------------------
435*cdf0e10cSrcweir     IAccessibleBrowseBox* AccessibleFactory::createAccessibleBrowseBox(
436*cdf0e10cSrcweir         const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox ) const
437*cdf0e10cSrcweir     {
438*cdf0e10cSrcweir         return new AccessibleBrowseBoxAccess( _rxParent, _rBrowseBox );
439*cdf0e10cSrcweir     }
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir 	//--------------------------------------------------------------------
442*cdf0e10cSrcweir     IAccessibleTableControl* AccessibleFactory::createAccessibleTableControl(
443*cdf0e10cSrcweir         const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable ) const
444*cdf0e10cSrcweir     {
445*cdf0e10cSrcweir 		return new AccessibleGridControlAccess( _rxParent, _rTable );
446*cdf0e10cSrcweir     }
447*cdf0e10cSrcweir 
448*cdf0e10cSrcweir 	//--------------------------------------------------------------------
449*cdf0e10cSrcweir     Reference< XAccessible > AccessibleFactory::createAccessibleIconChoiceCtrl(
450*cdf0e10cSrcweir         SvtIconChoiceCtrl& _rIconCtrl, const Reference< XAccessible >& _xParent ) const
451*cdf0e10cSrcweir     {
452*cdf0e10cSrcweir         return new AccessibleIconChoiceCtrl( _rIconCtrl, _xParent );
453*cdf0e10cSrcweir     }
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir 	//--------------------------------------------------------------------
456*cdf0e10cSrcweir     Reference< XAccessible > AccessibleFactory::createAccessibleTabBar( TabBar& _rTabBar ) const
457*cdf0e10cSrcweir     {
458*cdf0e10cSrcweir         return new AccessibleTabBar( &_rTabBar );
459*cdf0e10cSrcweir     }
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir 	//--------------------------------------------------------------------
462*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleTextWindowContext(
463*cdf0e10cSrcweir         VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView, bool bCompoundControlChild ) const
464*cdf0e10cSrcweir     {
465*cdf0e10cSrcweir         return new Document( pVclXWindow, rEngine, rView, bCompoundControlChild );
466*cdf0e10cSrcweir     }
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir 	//--------------------------------------------------------------------
469*cdf0e10cSrcweir     Reference< XAccessible > AccessibleFactory::createAccessibleTreeListBox(
470*cdf0e10cSrcweir         SvTreeListBox& _rListBox, const Reference< XAccessible >& _xParent ) const
471*cdf0e10cSrcweir     {
472*cdf0e10cSrcweir         return new AccessibleListBox( _rListBox, _xParent );
473*cdf0e10cSrcweir     }
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir 	//--------------------------------------------------------------------
476*cdf0e10cSrcweir     Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxHeaderBar(
477*cdf0e10cSrcweir         const Reference< XAccessible >& rxParent, IAccessibleTableProvider& _rOwningTable,
478*cdf0e10cSrcweir         AccessibleBrowseBoxObjType _eObjType ) const
479*cdf0e10cSrcweir     {
480*cdf0e10cSrcweir         return new AccessibleBrowseBoxHeaderBar( rxParent, _rOwningTable, _eObjType );
481*cdf0e10cSrcweir     }
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir 	//--------------------------------------------------------------------
484*cdf0e10cSrcweir     Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxTableCell(
485*cdf0e10cSrcweir         const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox,
486*cdf0e10cSrcweir         const Reference< XWindow >& _xFocusWindow, sal_Int32 _nRowId, sal_uInt16 _nColId, sal_Int32 _nOffset ) const
487*cdf0e10cSrcweir     {
488*cdf0e10cSrcweir         return new AccessibleBrowseBoxTableCell( _rxParent, _rBrowseBox, _xFocusWindow,
489*cdf0e10cSrcweir             _nRowId, _nColId, _nOffset );
490*cdf0e10cSrcweir     }
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir 	//--------------------------------------------------------------------
493*cdf0e10cSrcweir     Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxHeaderCell(
494*cdf0e10cSrcweir         sal_Int32 _nColumnRowId, const Reference< XAccessible >& rxParent, IAccessibleTableProvider& _rBrowseBox,
495*cdf0e10cSrcweir         const Reference< XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType  _eObjType ) const
496*cdf0e10cSrcweir     {
497*cdf0e10cSrcweir         return new AccessibleBrowseBoxHeaderCell( _nColumnRowId, rxParent, _rBrowseBox,
498*cdf0e10cSrcweir             _xFocusWindow, _eObjType );
499*cdf0e10cSrcweir     }
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir 	//--------------------------------------------------------------------
502*cdf0e10cSrcweir     Reference< XAccessible > AccessibleFactory::createAccessibleCheckBoxCell(
503*cdf0e10cSrcweir         const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox,
504*cdf0e10cSrcweir         const Reference< XWindow >& _xFocusWindow, sal_Int32 _nRowPos, sal_uInt16 _nColPos,
505*cdf0e10cSrcweir         const TriState& _eState, sal_Bool _bEnabled, sal_Bool _bIsTriState ) const
506*cdf0e10cSrcweir     {
507*cdf0e10cSrcweir         return new AccessibleCheckBoxCell( _rxParent, _rBrowseBox, _xFocusWindow,
508*cdf0e10cSrcweir             _nRowPos, _nColPos, _eState, _bEnabled, _bIsTriState );
509*cdf0e10cSrcweir     }
510*cdf0e10cSrcweir 
511*cdf0e10cSrcweir 	//--------------------------------------------------------------------
512*cdf0e10cSrcweir     Reference< XAccessible > AccessibleFactory::createEditBrowseBoxTableCellAccess(
513*cdf0e10cSrcweir 	    const Reference< XAccessible >& _rxParent, const Reference< XAccessible >& _rxControlAccessible,
514*cdf0e10cSrcweir         const Reference< XWindow >& _rxFocusWindow, IAccessibleTableProvider& _rBrowseBox,
515*cdf0e10cSrcweir         sal_Int32 _nRowPos, sal_uInt16 _nColPos ) const
516*cdf0e10cSrcweir     {
517*cdf0e10cSrcweir         return new EditBrowseBoxTableCellAccess( _rxParent, _rxControlAccessible,
518*cdf0e10cSrcweir             _rxFocusWindow, _rBrowseBox, _nRowPos, _nColPos );
519*cdf0e10cSrcweir     }
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir 	//--------------------------------------------------------------------
522*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelDeck(
523*cdf0e10cSrcweir             const Reference< XAccessible >& i_rAccessibleParent, ::svt::ToolPanelDeck& i_rPanelDeck )
524*cdf0e10cSrcweir     {
525*cdf0e10cSrcweir         return new AccessibleToolPanelDeck( i_rAccessibleParent, i_rPanelDeck );
526*cdf0e10cSrcweir     }
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir 	//--------------------------------------------------------------------
529*cdf0e10cSrcweir     Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelTabBar(
530*cdf0e10cSrcweir         const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar )
531*cdf0e10cSrcweir     {
532*cdf0e10cSrcweir         return new AccessibleToolPanelTabBar( i_rAccessibleParent, i_rPanelDeck, i_rTabBar );
533*cdf0e10cSrcweir     }
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir //........................................................................
536*cdf0e10cSrcweir }   // namespace accessibility
537*cdf0e10cSrcweir //........................................................................
538*cdf0e10cSrcweir 
539*cdf0e10cSrcweir //========================================================================
540*cdf0e10cSrcweir extern "C" void* SAL_CALL getStandardAccessibleFactory()
541*cdf0e10cSrcweir {
542*cdf0e10cSrcweir     ::toolkit::IAccessibleFactory* pFactory = new ::accessibility::AccessibleFactory;
543*cdf0e10cSrcweir 	pFactory->acquire();
544*cdf0e10cSrcweir 	return pFactory;
545*cdf0e10cSrcweir }
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir extern "C" void* SAL_CALL getSvtAccessibilityComponentFactory()
548*cdf0e10cSrcweir {
549*cdf0e10cSrcweir     ::svt::IAccessibleFactory* pFactory = new ::accessibility::AccessibleFactory;
550*cdf0e10cSrcweir 	pFactory->acquire();
551*cdf0e10cSrcweir 	return pFactory;
552*cdf0e10cSrcweir }
553