xref: /AOO41X/main/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
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         throw (::com::sun::star::uno::RuntimeException);
73 
74     virtual void SAL_CALL acquire() throw ();
75 
76     virtual void SAL_CALL release() throw ();
77 
78     //=====  XAccessibleValue  ================================================
79 
80     virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue() throw (::com::sun::star::uno::RuntimeException);
81     virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber )
82                                 throw (::com::sun::star::uno::RuntimeException);
83     virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue() throw (::com::sun::star::uno::RuntimeException);
84     virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue() throw (::com::sun::star::uno::RuntimeException);
85 
86     //=====  XAccessibleComponent  ============================================
87 
88     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
89                             getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint )
90                                 throw (::com::sun::star::uno::RuntimeException);
91     virtual void SAL_CALL   grabFocus() throw (::com::sun::star::uno::RuntimeException);
92 
93     //=====  XAccessibleContext  ==============================================
94 
95     virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
96     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
97                             getAccessibleChild( sal_Int32 i )
98                                 throw (::com::sun::star::lang::IndexOutOfBoundsException,
99                                     ::com::sun::star::uno::RuntimeException);
100     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
101     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
102                             getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
103 
104     //=====  XServiceInfo  ====================================================
105 
106     virtual ::rtl::OUString SAL_CALL getImplementationName()
107                                 throw(::com::sun::star::uno::RuntimeException);
108     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
109                                 throw(::com::sun::star::uno::RuntimeException);
110 
111     ///=====  XTypeProvider  ===================================================
112 
113     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
114         getTypes()
115         throw (::com::sun::star::uno::RuntimeException);
116 
117     /** Returns a implementation id.
118     */
119     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
120         getImplementationId(void)
121         throw (::com::sun::star::uno::RuntimeException);
122 
123 protected:
124     virtual ::rtl::OUString SAL_CALL createAccessibleDescription(void) throw(::com::sun::star::uno::RuntimeException);
125     virtual ::rtl::OUString SAL_CALL createAccessibleName(void) throw (::com::sun::star::uno::RuntimeException);
126 
127     virtual Rectangle GetBoundingBoxOnScreen(void) const throw(::com::sun::star::uno::RuntimeException);
128     virtual Rectangle GetBoundingBox(void) const throw (::com::sun::star::uno::RuntimeException);
129 
130 private:
131     ScPreviewShell*     mpViewShell;
132     accessibility::AccessibleTextHelper* mpTextHelper;
133     sal_Int32           mnIndex;
134     ScAddress           maCellPos;
135     sal_Bool            mbColumnHeader;
136     sal_Bool            mbRowHeader;
137     mutable ScPreviewTableInfo* mpTableInfo;
138 
139     sal_Bool IsDefunc(
140         const com::sun::star::uno::Reference<
141         ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
142 
143     void CreateTextHelper();
144     void    FillTableInfo() const;
145 };
146 
147 
148 #endif
149