xref: /trunk/main/svtools/source/brwbox/brwimpl.hxx (revision e8df90a080f9dc7518c4b937d7dcd461d7b4d178)
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
42         {
43             typedef THeaderCellMap::value_type argument_type;
44             typedef void result_type;
operator ()svt::BrowseBoxImpl::THeaderCellMapFunctorDispose45             inline void operator()(const THeaderCellMap::value_type& _aType)
46             {
47                 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp(
48                     _aType.second, ::com::sun::star::uno::UNO_QUERY );
49                 OSL_ENSURE( xComp.is() || !_aType.second.is(), "THeaderCellMapFunctorDispose: invalid accessible cell (no XComponent)!" );
50                 if ( xComp.is() )
51                     try
52                     {
53                         xComp->dispose();
54                     }
55                     catch( const ::com::sun::star::uno::Exception& )
56                     {
57                         OSL_ENSURE( sal_False, "THeaderCellMapFunctorDispose: caught an exception!" );
58                     }
59             }
60         };
61 
62     public:
63         AccessibleFactoryAccess m_aFactoryAccess;
64         IAccessibleBrowseBox*   m_pAccessible;
65         THeaderCellMap          m_aColHeaderCellMap;
66         THeaderCellMap          m_aRowHeaderCellMap;
67 
68     public:
BrowseBoxImpl()69         BrowseBoxImpl() : m_pAccessible(NULL)
70         {
71         }
72 
73 
74         /// @see AccessibleBrowseBox::getHeaderBar
75         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
76             getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType );
77 
78         /// @see AccessibleBrowseBox::getTable
79         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
80             getAccessibleTable( );
81 
82     };
83 }
84 
85 #endif // _SVTOOLS_BRWIMPL_HXX
86