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