xref: /aoo4110/main/svtools/source/brwbox/brwimpl.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SVTOOLS_BRWIMPL_HXX
24 #define _SVTOOLS_BRWIMPL_HXX
25 
26 #include "svtaccessiblefactory.hxx"
27 #include <com/sun/star/lang/XComponent.hpp>
28 
29 #include <map>
30 #include <functional>
31 
32 namespace svt
33 {
34 	class BrowseBoxImpl
35 	{
36 	// member
37 	public:
38         typedef ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >    AccessibleRef;
39 		typedef ::std::map< sal_Int32, AccessibleRef >                                              THeaderCellMap;
40 
41         struct  THeaderCellMapFunctorDispose : ::std::unary_function<THeaderCellMap::value_type,void>
42 		{
operator ()svt::BrowseBoxImpl::THeaderCellMapFunctorDispose43 			inline void operator()(const THeaderCellMap::value_type& _aType)
44 			{
45                 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp(
46                     _aType.second, ::com::sun::star::uno::UNO_QUERY );
47                 OSL_ENSURE( xComp.is() || !_aType.second.is(), "THeaderCellMapFunctorDispose: invalid accessible cell (no XComponent)!" );
48                 if ( xComp.is() )
49                     try
50                     {
51 				        xComp->dispose();
52                     }
53                     catch( const ::com::sun::star::uno::Exception& )
54                     {
55                     	OSL_ENSURE( sal_False, "THeaderCellMapFunctorDispose: caught an exception!" );
56                     }
57 			}
58 		};
59 
60     public:
61         AccessibleFactoryAccess m_aFactoryAccess;
62 		IAccessibleBrowseBox*   m_pAccessible;
63 		THeaderCellMap          m_aColHeaderCellMap;
64 		THeaderCellMap          m_aRowHeaderCellMap;
65 
66 	public:
BrowseBoxImpl()67 		BrowseBoxImpl() : m_pAccessible(NULL)
68 		{
69 		}
70 
71 
72         /// @see AccessibleBrowseBox::getHeaderBar
73         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
74 		    getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType );
75 
76         /// @see AccessibleBrowseBox::getTable
77         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
78     		getAccessibleTable( );
79 
80 	};
81 }
82 
83 #endif // _SVTOOLS_BRWIMPL_HXX
84