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 ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX
24 #define ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX
25 
26 #include "accessibility/extended/accessiblebrowseboxcell.hxx"
27 #include <comphelper/accessibletexthelper.hxx>
28 #include <cppuhelper/implbase2.hxx>
29 
30 namespace accessibility
31 {
32 	typedef ::cppu::ImplHelper2	<	::com::sun::star::accessibility::XAccessibleText
33 								,	::com::sun::star::accessibility::XAccessible
34 								>	AccessibleTextHelper_BASE;
35 
36 	// implementation of a table cell of BrowseBox
37 	class AccessibleBrowseBoxTableCell	:public AccessibleBrowseBoxCell
38 										,public AccessibleTextHelper_BASE
39 										,public ::comphelper::OCommonAccessibleText
40 	{
41     private:
42         sal_Int32   m_nOffset;
43 
44 	protected:
45 		// OCommonAccessibleText
46 		virtual ::rtl::OUString					implGetText();
47 		virtual ::com::sun::star::lang::Locale	implGetLocale();
48 		virtual void							implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
49 
50 	public:
51         AccessibleBrowseBoxTableCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
52 									::svt::IAccessibleTableProvider& _rBrowseBox,
53 									const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
54 									sal_Int32 _nRowId,
55                                     sal_uInt16 _nColId,
56                                     sal_Int32 _nOffset );
57 
58         void    nameChanged( const ::rtl::OUString& rNewName, const ::rtl::OUString& rOldName );
59 
60 		// XInterface -------------------------------------------------------------
61 
62 		/** Queries for a new interface. */
63 		::com::sun::star::uno::Any SAL_CALL queryInterface(
64 				const ::com::sun::star::uno::Type& rType )
65 			throw ( ::com::sun::star::uno::RuntimeException );
66 
67 		/** Aquires the object (calls acquire() on base class). */
68 		virtual void SAL_CALL acquire() throw ();
69 
70 		/** Releases the object (calls release() on base class). */
71 		virtual void SAL_CALL release() throw ();
72 
73 		// XEventListener
74         using AccessibleBrowseBoxBase::disposing;
75 	    virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
76 			throw(::com::sun::star::uno::RuntimeException);
77 
78 		/** @return  The index of this object among the parent's children. */
79 		virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
80 			throw ( ::com::sun::star::uno::RuntimeException );
81 
82 		/** @return
83 				The name of this class.
84 		*/
85 		virtual ::rtl::OUString SAL_CALL getImplementationName()
86 			throw ( ::com::sun::star::uno::RuntimeException );
87 
88 		/** @return
89 				The count of visible children.
90 		*/
91 		virtual sal_Int32 SAL_CALL getAccessibleChildCount()
92 			throw ( ::com::sun::star::uno::RuntimeException );
93 
94 		/** @return
95 				The XAccessible interface of the specified child.
96 		*/
97 		virtual ::com::sun::star::uno::Reference<
98 			::com::sun::star::accessibility::XAccessible > SAL_CALL
99 			getAccessibleChild( sal_Int32 nChildIndex )
100 				throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
101 						::com::sun::star::uno::RuntimeException );
102 
103 		/** Creates a new AccessibleStateSetHelper and fills it with states of the
104 			current object.
105 			@return
106 				A filled AccessibleStateSetHelper.
107 		*/
108 		::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
109 
110 		// XAccessible ------------------------------------------------------------
111 
112 		/** @return  The XAccessibleContext interface of this object. */
113 		virtual ::com::sun::star::uno::Reference<
114 			::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
115 		getAccessibleContext()
116 			throw ( ::com::sun::star::uno::RuntimeException );
117 
118 		// XAccessibleText
119 		virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
120 		virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
121 		virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
122 		virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
123 		virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
124 		virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
125 		virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
126 		virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
127 		virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
128 		virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
129 		virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
130 		virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
131 		virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
132         virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
133         virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
134         virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
135 		virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
136 	};
137 }
138 #endif // ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX
139 
140