xref: /AOO41X/main/sw/source/core/access/accnotextframe.hxx (revision 0deba7fbda3d9908785c25a443701a293b6f4e71)
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 _ACCNOTEXTFRAME_HXX
24 #define _ACCNOTEXTFRAME_HXX
25 #include "accframebase.hxx"
26 #include <com/sun/star/accessibility/XAccessibleImage.hpp>
27 //IAccessibility2 Implementation 2009-----
28 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEHYPERTEXT_HPP_
29 #include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
30 #endif
31 
32 namespace utl { class AccessibleRelationSetHelper; }
33 namespace com { namespace star {
34     namespace accessibility { struct AccessibleRelation; }
35 } }
36 
37 class SwFlyFrm;
38 class SwNoTxtNode;
39 class SwAccessibleNoTextHyperlink;
40 //-----IAccessibility2 Implementation 2009
41 
42 class SwAccessibleNoTextFrame : public	SwAccessibleFrameBase,
43                                 public ::com::sun::star::accessibility::XAccessibleImage,
44                                 public ::com::sun::star::accessibility::XAccessibleHypertext//Added by yangzhh for HyperLink
45 {
46 	//IAccessibility2 Implementation 2009-----
47 	friend class SwAccessibleNoTextHyperlink;
48 	//HyperLinksMap alinksMap;
49 	com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > alink;
50 	//-----IAccessibility2 Implementation 2009
51 	SwDepend		aDepend;
52     // --> OD 2009-07-14 #i73249#
53     ::rtl::OUString msTitle;
54     // <--
55     ::rtl::OUString msDesc;
56 
57 protected:
58 
59 	virtual ~SwAccessibleNoTextFrame();
60 
61 	const SwNoTxtNode *GetNoTxtNode() const;
62 
63 	virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
64 
65 public:
66 
67     SwAccessibleNoTextFrame( SwAccessibleMap* pInitMap,
68                              sal_Int16 nInitRole,
69 						     const SwFlyFrm *pFlyFrm );
70 
71 	//=====  XAccessibleContext  ==============================================
72 
73     // --> OD 2009-07-14 #i73249#
74     /// Return the object's current name.
75     virtual ::rtl::OUString SAL_CALL
76         getAccessibleName (void)
77         throw (::com::sun::star::uno::RuntimeException);
78     // <--
79 
80     /// Return this object's description.
81 	virtual ::rtl::OUString SAL_CALL
82     	getAccessibleDescription (void)
83         throw (com::sun::star::uno::RuntimeException);
84 
85 	//=====  XInterface  ======================================================
86 
87     // XInterface methods need to be implemented to disambiguate
88     // between those inherited through SwAcessibleContext and
89     // XAccessibleImage.
90 
91     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
92         const ::com::sun::star::uno::Type& aType )
93         throw (::com::sun::star::uno::RuntimeException);
94 
95     virtual void SAL_CALL acquire(  ) throw ()
96         { SwAccessibleContext::acquire(); };
97 
98     virtual void SAL_CALL release(  ) throw ()
99         { SwAccessibleContext::release(); };
100 
101 	//====== XTypeProvider ====================================================
102 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
103 
104 	//=====  XAccessibleImage  ================================================
105 
106     virtual ::rtl::OUString SAL_CALL
107         getAccessibleImageDescription(  )
108         throw ( ::com::sun::star::uno::RuntimeException );
109 
110     virtual sal_Int32 SAL_CALL
111         getAccessibleImageHeight(  )
112         throw ( ::com::sun::star::uno::RuntimeException );
113 
114     virtual sal_Int32 SAL_CALL
115         getAccessibleImageWidth(  )
116         throw ( ::com::sun::star::uno::RuntimeException );
117 
118 	// The object is not visible an longer and should be destroyed
119 	virtual void Dispose( sal_Bool bRecursive = sal_False );
120 
121 	//IAccessibility2 Implementation 2009-----
122     virtual sal_Int32 SAL_CALL getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException);
123     virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
124     virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);//Shen Zhen Jie changed sal_Unicode to sal_uInt32
125     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);
126     virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
127     virtual sal_Int32 SAL_CALL getCharacterCount(  ) throw (::com::sun::star::uno::RuntimeException);
128     virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
129     virtual ::rtl::OUString SAL_CALL getSelectedText(  ) throw (::com::sun::star::uno::RuntimeException);
130     virtual sal_Int32 SAL_CALL getSelectionStart(  ) throw (::com::sun::star::uno::RuntimeException);
131     virtual sal_Int32 SAL_CALL getSelectionEnd(  ) throw (::com::sun::star::uno::RuntimeException);
132     virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
133     virtual ::rtl::OUString SAL_CALL getText(  ) throw (::com::sun::star::uno::RuntimeException);
134     virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
135     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);
136     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);
137     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);
138     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
139 
140 
141 	//=====  XAccessibleHypertext  ============================================
142 	virtual sal_Int32 SAL_CALL getHyperLinkCount()
143  		throw (::com::sun::star::uno::RuntimeException);
144 	virtual ::com::sun::star::uno::Reference<
145   		::com::sun::star::accessibility::XAccessibleHyperlink >
146 	SAL_CALL getHyperLink( sal_Int32 nLinkIndex )
147   	throw (::com::sun::star::lang::IndexOutOfBoundsException,
148   			::com::sun::star::uno::RuntimeException);
149 	virtual sal_Int32 SAL_CALL getHyperLinkIndex( sal_Int32 nCharIndex )
150 	throw (::com::sun::star::lang::IndexOutOfBoundsException,
151 			::com::sun::star::uno::RuntimeException);
152 
153 	SwAccessibleMap *GetAccessibleMap(){ return GetMap();}
154 
155 private:
156     com::sun::star::accessibility::AccessibleRelation makeRelation(
157         sal_Int16 nType, const SwFlyFrm* pFrm );
158 
159 public:
160 	virtual ::com::sun::star::uno::Reference<
161             ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
162     	getAccessibleRelationSet (void)
163         throw (::com::sun::star::uno::RuntimeException);
164 	//-----IAccessibility2 Implementation 2009
165 };
166 
167 
168 #endif
169