xref: /aoo41x/main/svtools/source/brwbox/brwimpl.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVTOOLS_BRWIMPL_HXX
28 #define _SVTOOLS_BRWIMPL_HXX
29 
30 #include "svtaccessiblefactory.hxx"
31 #include <com/sun/star/lang/XComponent.hpp>
32 
33 #include <map>
34 #include <functional>
35 
36 namespace svt
37 {
38 	class BrowseBoxImpl
39 	{
40 	// member
41 	public:
42         typedef ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >    AccessibleRef;
43 		typedef ::std::map< sal_Int32, AccessibleRef >                                              THeaderCellMap;
44 
45         struct  THeaderCellMapFunctorDispose : ::std::unary_function<THeaderCellMap::value_type,void>
46 		{
47 			inline void operator()(const THeaderCellMap::value_type& _aType)
48 			{
49                 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp(
50                     _aType.second, ::com::sun::star::uno::UNO_QUERY );
51                 OSL_ENSURE( xComp.is() || !_aType.second.is(), "THeaderCellMapFunctorDispose: invalid accessible cell (no XComponent)!" );
52                 if ( xComp.is() )
53                     try
54                     {
55 				        xComp->dispose();
56                     }
57                     catch( const ::com::sun::star::uno::Exception& )
58                     {
59                     	OSL_ENSURE( sal_False, "THeaderCellMapFunctorDispose: caught an exception!" );
60                     }
61 			}
62 		};
63 
64     public:
65         AccessibleFactoryAccess m_aFactoryAccess;
66 		IAccessibleBrowseBox*   m_pAccessible;
67 		THeaderCellMap          m_aColHeaderCellMap;
68 		THeaderCellMap          m_aRowHeaderCellMap;
69 
70 	public:
71 		BrowseBoxImpl() : m_pAccessible(NULL)
72 		{
73 		}
74 
75 
76         /// @see AccessibleBrowseBox::getHeaderBar
77         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
78 		    getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType );
79 
80         /// @see AccessibleBrowseBox::getTable
81         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
82     		getAccessibleTable( );
83 
84 	};
85 }
86 
87 #endif // _SVTOOLS_BRWIMPL_HXX
88