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 
28 
29 #ifndef _SC_ACCESSIBLEPREVIEWTABLE_HXX
30 #define _SC_ACCESSIBLEPREVIEWTABLE_HXX
31 
32 #include "AccessibleContextBase.hxx"
33 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
34 #include <cppuhelper/implbase1.hxx>
35 
36 class ScPreviewShell;
37 class ScPreviewTableInfo;
38 
39 typedef cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleTable>
40 					ScAccessiblePreviewTableImpl;
41 
42 class ScAccessiblePreviewTable :
43 		public ScAccessibleContextBase,
44 		public ScAccessiblePreviewTableImpl
45 {
46 public:
47 	ScAccessiblePreviewTable( const ::com::sun::star::uno::Reference<
48 						        ::com::sun::star::accessibility::XAccessible>& rxParent,
49 							ScPreviewShell* pViewShell, sal_Int32 nIndex );
50 
51 protected:
52 	virtual ~ScAccessiblePreviewTable();
53 
54     using ScAccessibleContextBase::IsDefunc;
55 
56 public:
57     using ScAccessibleContextBase::disposing;
58  	virtual void SAL_CALL disposing();
59 
60 	//=====  SfxListener  =====================================================
61 
62 	virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
63 
64 	///=====  XInterface  =====================================================
65 
66 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
67 		::com::sun::star::uno::Type const & rType )
68 		throw (::com::sun::star::uno::RuntimeException);
69 
70 	virtual void SAL_CALL acquire() throw ();
71 
72 	virtual void SAL_CALL release() throw ();
73 
74 	//=====  XAccessibleTable  ================================================
75 
76     virtual sal_Int32 SAL_CALL getAccessibleRowCount() throw (::com::sun::star::uno::RuntimeException);
77     virtual sal_Int32 SAL_CALL getAccessibleColumnCount() throw (::com::sun::star::uno::RuntimeException);
78     virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow )
79 								throw (::com::sun::star::lang::IndexOutOfBoundsException,
80 									::com::sun::star::uno::RuntimeException);
81     virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn )
82 								throw (::com::sun::star::lang::IndexOutOfBoundsException,
83 									::com::sun::star::uno::RuntimeException);
84     virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
85     							throw (::com::sun::star::lang::IndexOutOfBoundsException,
86     								::com::sun::star::uno::RuntimeException);
87     virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
88     							throw (::com::sun::star::lang::IndexOutOfBoundsException,
89     								::com::sun::star::uno::RuntimeException);
90     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
91     						getAccessibleRowHeaders() throw (::com::sun::star::uno::RuntimeException);
92     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
93     						getAccessibleColumnHeaders() throw (::com::sun::star::uno::RuntimeException);
94     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows()
95     							throw (::com::sun::star::uno::RuntimeException);
96     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns()
97     							throw (::com::sun::star::uno::RuntimeException);
98     virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
99     							throw (::com::sun::star::lang::IndexOutOfBoundsException,
100     								::com::sun::star::uno::RuntimeException);
101     virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
102     							throw (::com::sun::star::lang::IndexOutOfBoundsException,
103     								::com::sun::star::uno::RuntimeException);
104     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
105     						getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
106     							throw (::com::sun::star::lang::IndexOutOfBoundsException,
107     								::com::sun::star::uno::RuntimeException);
108     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
109     						getAccessibleCaption() throw (::com::sun::star::uno::RuntimeException);
110     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
111     						getAccessibleSummary() throw (::com::sun::star::uno::RuntimeException);
112     virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
113     							throw (::com::sun::star::lang::IndexOutOfBoundsException,
114     								::com::sun::star::uno::RuntimeException);
115     virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
116     							throw (::com::sun::star::lang::IndexOutOfBoundsException,
117     								::com::sun::star::uno::RuntimeException);
118     virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex )
119     							throw (::com::sun::star::lang::IndexOutOfBoundsException,
120     								::com::sun::star::uno::RuntimeException);
121     virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
122     							throw (::com::sun::star::lang::IndexOutOfBoundsException,
123     								::com::sun::star::uno::RuntimeException);
124 
125 	//=====  XAccessibleComponent  ============================================
126 
127     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
128     						getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint )
129     							throw (::com::sun::star::uno::RuntimeException);
130     virtual void SAL_CALL	grabFocus() throw (::com::sun::star::uno::RuntimeException);
131 
132 	//=====  XAccessibleContext  ==============================================
133 
134     virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
135     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
136     						getAccessibleChild( sal_Int32 i )
137     							throw (::com::sun::star::lang::IndexOutOfBoundsException,
138     								::com::sun::star::uno::RuntimeException);
139     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
140     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
141     						getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
142 
143 	//=====  XServiceInfo  ====================================================
144 
145 	virtual ::rtl::OUString SAL_CALL getImplementationName()
146 								throw(::com::sun::star::uno::RuntimeException);
147 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
148 								throw(::com::sun::star::uno::RuntimeException);
149 
150 	//=====  XTypeProvider  ===================================================
151 
152     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
153 		getTypes()
154 		throw (::com::sun::star::uno::RuntimeException);
155 
156 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
157 								throw(::com::sun::star::uno::RuntimeException);
158 
159     //=====  internal  ========================================================
160     void SetCurrentIndexInParent(sal_Int32 nNew) { mnIndex = nNew; }
161 
162 protected:
163 	virtual ::rtl::OUString SAL_CALL createAccessibleDescription(void) throw(::com::sun::star::uno::RuntimeException);
164 	virtual ::rtl::OUString SAL_CALL createAccessibleName(void) throw (::com::sun::star::uno::RuntimeException);
165 
166 	virtual Rectangle GetBoundingBoxOnScreen(void) const throw(::com::sun::star::uno::RuntimeException);
167 	virtual Rectangle GetBoundingBox(void) const throw (::com::sun::star::uno::RuntimeException);
168 
169 private:
170 	ScPreviewShell*		mpViewShell;
171 	sal_Int32			mnIndex;
172 	mutable ScPreviewTableInfo*	mpTableInfo;
173 
174 	sal_Bool IsDefunc(
175 		const com::sun::star::uno::Reference<
176 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
177 
178 	void	FillTableInfo() const;
179 };
180 
181 
182 #endif
183