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