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 _ACCTEXTFRAME_HXX
24 #define _ACCTEXTFRAME_HXX
25 #include "accframebase.hxx"
26 
27 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
28 
29 class SwFlyFrm;
30 namespace utl { class AccessibleRelationSetHelper; }
31 namespace com { namespace star {
32     namespace accessibility { struct AccessibleRelation; }
33 } }
34 
35 class SwAccessibleTextFrame : public SwAccessibleFrameBase,
36         public ::com::sun::star::accessibility::XAccessibleSelection
37 {
38 private:
39     // --> OD 2009-07-14 #i73249#
40     ::rtl::OUString msTitle;
41     ::rtl::OUString msDesc;
42     // <--
43 
44 protected:
45 
46 	virtual ~SwAccessibleTextFrame();
47 
48 	virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
49 
50 public:
51 
52     SwAccessibleTextFrame( SwAccessibleMap* pInitMap, const SwFlyFrm* pFlyFrm );
53 
54 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
55 		::com::sun::star::uno::Type const & rType )
56 		throw (::com::sun::star::uno::RuntimeException);
57 	virtual void SAL_CALL acquire() throw ();
58 	virtual void SAL_CALL release() throw ();
59 	//=====  XAccessibleSelection  ============================================
60 	virtual void SAL_CALL selectAccessibleChild(
61 		sal_Int32 nChildIndex )
62 		throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
63 		::com::sun::star::uno::RuntimeException );
64 
65 	virtual sal_Bool SAL_CALL isAccessibleChildSelected(
66 		sal_Int32 nChildIndex )
67 		throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
68 		::com::sun::star::uno::RuntimeException );
69 
70 	virtual void SAL_CALL clearAccessibleSelection(  )
71 		throw ( ::com::sun::star::uno::RuntimeException );
72 
73 	virtual void SAL_CALL selectAllAccessibleChildren(  )
74 		throw ( ::com::sun::star::uno::RuntimeException );
75 
76 	virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  )
77 		throw ( ::com::sun::star::uno::RuntimeException );
78 
79 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
80 		sal_Int32 nSelectedChildIndex )
81 		throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
82 		::com::sun::star::uno::RuntimeException);
83 
84 	virtual void SAL_CALL deselectAccessibleChild(
85 		sal_Int32 nSelectedChildIndex )
86 		throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
87 		::com::sun::star::uno::RuntimeException );
88 
89 	//=====  XAccessibleContext  ==============================================
90 
91     // --> OD 2009-07-14 #i73249#
92     /// Return the object's current name.
93     virtual ::rtl::OUString SAL_CALL
94         getAccessibleName (void)
95         throw (::com::sun::star::uno::RuntimeException);
96     // <--
97     /// Return this object's description.
98 	virtual ::rtl::OUString SAL_CALL
99     	getAccessibleDescription (void)
100         throw (com::sun::star::uno::RuntimeException);
101 
102 	//=====  XServiceInfo  ====================================================
103 
104     /**	Returns an identifier for the implementation of this object.
105     */
106 	virtual ::rtl::OUString SAL_CALL
107     	getImplementationName (void)
108         throw (::com::sun::star::uno::RuntimeException);
109 
110     /**	Return whether the specified service is supported by this class.
111     */
112     virtual sal_Bool SAL_CALL
113     	supportsService (const ::rtl::OUString& sServiceName)
114         throw (::com::sun::star::uno::RuntimeException);
115 
116     /** Returns a list of all supported services.  In this case that is just
117     	the AccessibleContext service.
118     */
119 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
120     	getSupportedServiceNames (void)
121         throw (::com::sun::star::uno::RuntimeException);
122 
123 	//====== XTypeProvider ====================================================
124     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
125 
126 
127     //=====  XAccessibleContext::getAccessibleRelationSet  ====================
128 
129     // text frame may have accessible relations to their
130     // predocesor/successor frames
131 
132 private:
133     // helper methods for getAccessibleRelationSet:
134     SwFlyFrm* getFlyFrm() const;
135 
136     com::sun::star::accessibility::AccessibleRelation makeRelation(
137         sal_Int16 nType, const SwFlyFrm* pFrm );
138 
139 public:
140 
141 	virtual ::com::sun::star::uno::Reference<
142             ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
143     	getAccessibleRelationSet (void)
144         throw (::com::sun::star::uno::RuntimeException);
145 };
146 
147 
148 #endif
149