xref: /trunk/main/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 
24 
25 #ifndef _SC_ACCESSIBLEPREVIEWHEADERCELL_HXX
26 #define _SC_ACCESSIBLEPREVIEWHEADERCELL_HXX
27 
28 #include "AccessibleContextBase.hxx"
29 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
30 #include <tools/gen.hxx>
31 #include "global.hxx"
32 #include "address.hxx"
33 #include <cppuhelper/implbase1.hxx>
34 
35 class ScPreviewShell;
36 class ScPreviewTableInfo;
37 namespace accessibility {
38     class AccessibleTextHelper;
39 }
40 
41 typedef cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleValue>
42                     ScAccessiblePreviewHeaderCellImpl;
43 
44 class ScAccessiblePreviewHeaderCell :
45         public ScAccessibleContextBase,
46         public ScAccessiblePreviewHeaderCellImpl
47 {
48 public:
49     ScAccessiblePreviewHeaderCell( const ::com::sun::star::uno::Reference<
50                                 ::com::sun::star::accessibility::XAccessible>& rxParent,
51                             ScPreviewShell* pViewShell,
52                             const ScAddress& rCellPos, sal_Bool bIsColHdr, sal_Bool bIsRowHdr,
53                             sal_Int32 nIndex );
54 
55 protected:
56     virtual ~ScAccessiblePreviewHeaderCell();
57 
58     using ScAccessibleContextBase::IsDefunc;
59 
60 public:
61     using ScAccessibleContextBase::disposing;
62     virtual void SAL_CALL disposing();
63 
64     //=====  SfxListener  =====================================================
65 
66     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
67 
68     ///=====  XInterface  =====================================================
69 
70     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
71         ::com::sun::star::uno::Type const & rType );
72 
73     virtual void SAL_CALL acquire() throw ();
74 
75     virtual void SAL_CALL release() throw ();
76 
77     //=====  XAccessibleValue  ================================================
78 
79     virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue();
80     virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber );
81     virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue();
82     virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue();
83 
84     //=====  XAccessibleComponent  ============================================
85 
86     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
87                             getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint );
88     virtual void SAL_CALL   grabFocus();
89 
90     //=====  XAccessibleContext  ==============================================
91 
92     virtual sal_Int32 SAL_CALL getAccessibleChildCount();
93     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
94                             getAccessibleChild( sal_Int32 i );
95     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent();
96     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
97                             getAccessibleStateSet();
98 
99     //=====  XServiceInfo  ====================================================
100 
101     virtual ::rtl::OUString SAL_CALL getImplementationName();
102     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
103 
104     ///=====  XTypeProvider  ===================================================
105 
106     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
107         getTypes();
108 
109     /** Returns a implementation id.
110     */
111     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
112         getImplementationId(void);
113 
114 protected:
115     virtual ::rtl::OUString SAL_CALL createAccessibleDescription(void);
116     virtual ::rtl::OUString SAL_CALL createAccessibleName(void);
117 
118     virtual Rectangle GetBoundingBoxOnScreen(void) const;
119     virtual Rectangle GetBoundingBox(void) const;
120 
121 private:
122     ScPreviewShell*     mpViewShell;
123     accessibility::AccessibleTextHelper* mpTextHelper;
124     sal_Int32           mnIndex;
125     ScAddress           maCellPos;
126     sal_Bool            mbColumnHeader;
127     sal_Bool            mbRowHeader;
128     mutable ScPreviewTableInfo* mpTableInfo;
129 
130     sal_Bool IsDefunc(
131         const com::sun::star::uno::Reference<
132         ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
133 
134     void CreateTextHelper();
135     void    FillTableInfo() const;
136 };
137 
138 
139 #endif
140