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