1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19efeef26fSAndrew Rist *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include <vos/mutex.hxx>
29cdf0e10cSrcweir #include <vcl/svapp.hxx>
30cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
31cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
32cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
33cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
34cdf0e10cSrcweir #include <frmfmt.hxx>
35cdf0e10cSrcweir #include <ndnotxt.hxx>
36cdf0e10cSrcweir #include <flyfrm.hxx>
37cdf0e10cSrcweir #include <cntfrm.hxx>
38cdf0e10cSrcweir // --> OD 2009-07-14 #i73249#
39cdf0e10cSrcweir #include <hints.hxx>
40cdf0e10cSrcweir // <--
41cdf0e10cSrcweir #include "accnotextframe.hxx"
42*ca62e2c2SSteve Yin #include <fmturl.hxx>
43*ca62e2c2SSteve Yin #include <accnotexthyperlink.hxx>
44*ca62e2c2SSteve Yin #include <svtools/imap.hxx>
45*ca62e2c2SSteve Yin #include <unotools/accessiblerelationsethelper.hxx>
46*ca62e2c2SSteve Yin #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
47*ca62e2c2SSteve Yin #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
48*ca62e2c2SSteve Yin #include <doc.hxx>
49cdf0e10cSrcweir
50cdf0e10cSrcweir using namespace ::com::sun::star;
51cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
52cdf0e10cSrcweir using ::rtl::OUString;
53*ca62e2c2SSteve Yin using utl::AccessibleRelationSetHelper;
54cdf0e10cSrcweir
GetNoTxtNode() const55cdf0e10cSrcweir const SwNoTxtNode *SwAccessibleNoTextFrame::GetNoTxtNode() const
56cdf0e10cSrcweir {
57cdf0e10cSrcweir const SwNoTxtNode *pNd = 0;
58cdf0e10cSrcweir const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm *>( GetFrm() );
59cdf0e10cSrcweir if( pFlyFrm->Lower() && pFlyFrm->Lower()->IsNoTxtFrm() )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir const SwCntntFrm *pCntFrm =
62cdf0e10cSrcweir static_cast<const SwCntntFrm *>( pFlyFrm->Lower() );
63*ca62e2c2SSteve Yin const SwCntntNode* pSwCntntNode = pCntFrm->GetNode();
64*ca62e2c2SSteve Yin if(pSwCntntNode != NULL)
65*ca62e2c2SSteve Yin {
66*ca62e2c2SSteve Yin pNd = pSwCntntNode->GetNoTxtNode();
67*ca62e2c2SSteve Yin }
68cdf0e10cSrcweir }
69cdf0e10cSrcweir
70cdf0e10cSrcweir return pNd;
71cdf0e10cSrcweir }
72cdf0e10cSrcweir
SwAccessibleNoTextFrame(SwAccessibleMap * pInitMap,sal_Int16 nInitRole,const SwFlyFrm * pFlyFrm)73cdf0e10cSrcweir SwAccessibleNoTextFrame::SwAccessibleNoTextFrame(
74cdf0e10cSrcweir SwAccessibleMap* pInitMap,
75cdf0e10cSrcweir sal_Int16 nInitRole,
76cdf0e10cSrcweir const SwFlyFrm* pFlyFrm ) :
77cdf0e10cSrcweir SwAccessibleFrameBase( pInitMap, nInitRole, pFlyFrm ),
78cdf0e10cSrcweir aDepend( this, const_cast < SwNoTxtNode * >( GetNoTxtNode() ) ),
79cdf0e10cSrcweir msTitle(),
80cdf0e10cSrcweir msDesc()
81cdf0e10cSrcweir {
82cdf0e10cSrcweir const SwNoTxtNode* pNd = GetNoTxtNode();
83cdf0e10cSrcweir // --> OD 2009-07-14 #i73249#
84cdf0e10cSrcweir // consider new attributes Title and Description
85cdf0e10cSrcweir if( pNd )
86cdf0e10cSrcweir {
87cdf0e10cSrcweir msTitle = pNd->GetTitle();
88cdf0e10cSrcweir
89cdf0e10cSrcweir msDesc = pNd->GetDescription();
90cdf0e10cSrcweir if ( msDesc.getLength() == 0 &&
91cdf0e10cSrcweir msTitle != GetName() )
92cdf0e10cSrcweir {
93cdf0e10cSrcweir msDesc = msTitle;
94cdf0e10cSrcweir }
95cdf0e10cSrcweir }
96cdf0e10cSrcweir // <--
97cdf0e10cSrcweir }
98cdf0e10cSrcweir
~SwAccessibleNoTextFrame()99cdf0e10cSrcweir SwAccessibleNoTextFrame::~SwAccessibleNoTextFrame()
100cdf0e10cSrcweir {
101cdf0e10cSrcweir }
102cdf0e10cSrcweir
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)103cdf0e10cSrcweir void SwAccessibleNoTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
104cdf0e10cSrcweir {
105cdf0e10cSrcweir const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
106cdf0e10cSrcweir // --> OD 2009-07-14 #i73249#
107cdf0e10cSrcweir // suppress handling of RES_NAME_CHANGED in case that attribute Title is
108cdf0e10cSrcweir // used as the accessible name.
109cdf0e10cSrcweir if ( nWhich != RES_NAME_CHANGED ||
110cdf0e10cSrcweir msTitle.getLength() == 0 )
111cdf0e10cSrcweir {
112cdf0e10cSrcweir SwAccessibleFrameBase::Modify( pOld, pNew );
113cdf0e10cSrcweir }
114cdf0e10cSrcweir
115cdf0e10cSrcweir const SwNoTxtNode *pNd = GetNoTxtNode();
116cdf0e10cSrcweir ASSERT( pNd == aDepend.GetRegisteredIn(), "invalid frame" );
117cdf0e10cSrcweir switch( nWhich )
118cdf0e10cSrcweir {
119cdf0e10cSrcweir // --> OD 2009-07-14 #i73249#
120cdf0e10cSrcweir case RES_TITLE_CHANGED:
121cdf0e10cSrcweir {
122cdf0e10cSrcweir const String& sOldTitle(
123cdf0e10cSrcweir dynamic_cast<const SwStringMsgPoolItem*>(pOld)->GetString() );
124cdf0e10cSrcweir const String& sNewTitle(
125cdf0e10cSrcweir dynamic_cast<const SwStringMsgPoolItem*>(pNew)->GetString() );
126cdf0e10cSrcweir if ( sOldTitle == sNewTitle )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir break;
129cdf0e10cSrcweir }
130cdf0e10cSrcweir msTitle = sNewTitle;
131cdf0e10cSrcweir AccessibleEventObject aEvent;
132cdf0e10cSrcweir aEvent.EventId = AccessibleEventId::NAME_CHANGED;
133cdf0e10cSrcweir aEvent.OldValue <<= OUString( sOldTitle );
134cdf0e10cSrcweir aEvent.NewValue <<= msTitle;
135cdf0e10cSrcweir FireAccessibleEvent( aEvent );
136cdf0e10cSrcweir
137cdf0e10cSrcweir if ( pNd->GetDescription().Len() != 0 )
138cdf0e10cSrcweir {
139cdf0e10cSrcweir break;
140cdf0e10cSrcweir }
141cdf0e10cSrcweir }
142cdf0e10cSrcweir // intentional no break here
143cdf0e10cSrcweir case RES_DESCRIPTION_CHANGED:
144cdf0e10cSrcweir {
145cdf0e10cSrcweir if ( pNd && GetFrm() )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir const OUString sOldDesc( msDesc );
148cdf0e10cSrcweir
149cdf0e10cSrcweir const String& rDesc = pNd->GetDescription();
150cdf0e10cSrcweir msDesc = rDesc;
151cdf0e10cSrcweir if ( msDesc.getLength() == 0 &&
152cdf0e10cSrcweir msTitle != GetName() )
153cdf0e10cSrcweir {
154cdf0e10cSrcweir msDesc = msTitle;
155cdf0e10cSrcweir }
156cdf0e10cSrcweir
157cdf0e10cSrcweir if ( msDesc != sOldDesc )
158cdf0e10cSrcweir {
159cdf0e10cSrcweir AccessibleEventObject aEvent;
160cdf0e10cSrcweir aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
161cdf0e10cSrcweir aEvent.OldValue <<= sOldDesc;
162cdf0e10cSrcweir aEvent.NewValue <<= msDesc;
163cdf0e10cSrcweir FireAccessibleEvent( aEvent );
164cdf0e10cSrcweir }
165cdf0e10cSrcweir }
166cdf0e10cSrcweir }
167cdf0e10cSrcweir break;
168cdf0e10cSrcweir // <--
169cdf0e10cSrcweir /*
170cdf0e10cSrcweir case RES_OBJECTDYING:
171cdf0e10cSrcweir if( aDepend.GetRegisteredIn() ==
172cdf0e10cSrcweir static_cast< SwModify *>( static_cast< SwPtrMsgPoolItem * >( pOld )->pObject ) )
173cdf0e10cSrcweir const_cast < SwModify *>( aDepend.GetRegisteredIn()->Remove( aDepend );
174cdf0e10cSrcweir break;
175cdf0e10cSrcweir
176cdf0e10cSrcweir case RES_FMT_CHG:
177cdf0e10cSrcweir if( static_cast< SwFmtChg * >(pNew)->pChangedFmt == GetRegisteredIn() &&
178cdf0e10cSrcweir static_cast< SwFmtChg * >(pOld)->pChangedFmt->IsFmtInDTOR() )
179cdf0e10cSrcweir GetRegisteredIn()->Remove( this );
180cdf0e10cSrcweir break;
181cdf0e10cSrcweir */
182cdf0e10cSrcweir }
183cdf0e10cSrcweir }
184cdf0e10cSrcweir
Dispose(sal_Bool bRecursive)185cdf0e10cSrcweir void SwAccessibleNoTextFrame::Dispose( sal_Bool bRecursive )
186cdf0e10cSrcweir {
187cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
188cdf0e10cSrcweir
189cdf0e10cSrcweir if( aDepend.GetRegisteredIn() )
190cdf0e10cSrcweir const_cast < SwModify *>( aDepend.GetRegisteredIn() )->Remove( &aDepend );
191cdf0e10cSrcweir
192cdf0e10cSrcweir SwAccessibleFrameBase::Dispose( bRecursive );
193cdf0e10cSrcweir }
194cdf0e10cSrcweir
195cdf0e10cSrcweir // --> OD 2009-07-14 #i73249#
getAccessibleName(void)196cdf0e10cSrcweir OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleName (void)
197cdf0e10cSrcweir throw (uno::RuntimeException)
198cdf0e10cSrcweir {
199cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
200cdf0e10cSrcweir
201cdf0e10cSrcweir CHECK_FOR_DEFUNC( XAccessibleContext )
202cdf0e10cSrcweir
203cdf0e10cSrcweir if ( msTitle.getLength() != 0 )
204cdf0e10cSrcweir {
205cdf0e10cSrcweir return msTitle;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir
208cdf0e10cSrcweir return SwAccessibleFrameBase::getAccessibleName();
209cdf0e10cSrcweir }
210cdf0e10cSrcweir // <--
211cdf0e10cSrcweir
getAccessibleDescription(void)212cdf0e10cSrcweir OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleDescription (void)
213cdf0e10cSrcweir throw (uno::RuntimeException)
214cdf0e10cSrcweir {
215cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
216cdf0e10cSrcweir
217cdf0e10cSrcweir CHECK_FOR_DEFUNC( XAccessibleContext )
218*ca62e2c2SSteve Yin // OUString longDesc;
219*ca62e2c2SSteve Yin // const SwFlyFrmFmt* pFlyFmt = GetShell()->GetDoc()->FindFlyByName( GetName(), 0);
220*ca62e2c2SSteve Yin // longDesc = OUString( pFlyFmt->GetLongDescription() );
221*ca62e2c2SSteve Yin // return longDesc; MT: Do not return longDesc, which still is empty - why was the line above commented out?
222cdf0e10cSrcweir
223cdf0e10cSrcweir return msDesc;
224cdf0e10cSrcweir }
225cdf0e10cSrcweir
226cdf0e10cSrcweir
227cdf0e10cSrcweir
228cdf0e10cSrcweir //
229cdf0e10cSrcweir // XInterface
230cdf0e10cSrcweir //
231cdf0e10cSrcweir
queryInterface(const uno::Type & aType)232cdf0e10cSrcweir uno::Any SAL_CALL SwAccessibleNoTextFrame::queryInterface( const uno::Type& aType )
233cdf0e10cSrcweir throw (uno::RuntimeException)
234cdf0e10cSrcweir {
235cdf0e10cSrcweir if( aType ==
236cdf0e10cSrcweir ::getCppuType( static_cast<uno::Reference<XAccessibleImage>*>( NULL ) ) )
237cdf0e10cSrcweir {
238cdf0e10cSrcweir uno::Reference<XAccessibleImage> xImage = this;
239cdf0e10cSrcweir uno::Any aAny;
240cdf0e10cSrcweir aAny <<= xImage;
241cdf0e10cSrcweir return aAny;
242cdf0e10cSrcweir }
243*ca62e2c2SSteve Yin else if ( aType == ::getCppuType((uno::Reference<XAccessibleHypertext> *)0) )
244*ca62e2c2SSteve Yin {
245*ca62e2c2SSteve Yin uno::Reference<XAccessibleHypertext> aAccHypertext = this;
246*ca62e2c2SSteve Yin uno::Any aAny;
247*ca62e2c2SSteve Yin aAny <<= aAccHypertext;
248*ca62e2c2SSteve Yin return aAny;
249*ca62e2c2SSteve Yin }
250cdf0e10cSrcweir else
251cdf0e10cSrcweir return SwAccessibleContext::queryInterface( aType );
252cdf0e10cSrcweir }
253cdf0e10cSrcweir
254cdf0e10cSrcweir
255cdf0e10cSrcweir //====== XTypeProvider ====================================================
getTypes()256cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL SwAccessibleNoTextFrame::getTypes() throw(uno::RuntimeException)
257cdf0e10cSrcweir {
258cdf0e10cSrcweir uno::Sequence< uno::Type > aTypes( SwAccessibleFrameBase::getTypes() );
259cdf0e10cSrcweir
260cdf0e10cSrcweir sal_Int32 nIndex = aTypes.getLength();
261cdf0e10cSrcweir aTypes.realloc( nIndex + 1 );
262cdf0e10cSrcweir
263cdf0e10cSrcweir uno::Type* pTypes = aTypes.getArray();
264cdf0e10cSrcweir pTypes[nIndex] = ::getCppuType( static_cast< uno::Reference< XAccessibleImage > * >( 0 ) );
265cdf0e10cSrcweir
266cdf0e10cSrcweir return aTypes;
267cdf0e10cSrcweir }
268cdf0e10cSrcweir
269cdf0e10cSrcweir
270cdf0e10cSrcweir //
271cdf0e10cSrcweir // XAccessibleImage
272cdf0e10cSrcweir //
273cdf0e10cSrcweir
274cdf0e10cSrcweir // implementation of the XAccessibleImage methods is a no-brainer, as
275cdf0e10cSrcweir // all releveant information is already accessible through other
276cdf0e10cSrcweir // methods. So we just delegate to those.
277cdf0e10cSrcweir
getAccessibleImageDescription()278cdf0e10cSrcweir OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleImageDescription()
279cdf0e10cSrcweir throw ( uno::RuntimeException )
280cdf0e10cSrcweir {
281cdf0e10cSrcweir return getAccessibleDescription();
282cdf0e10cSrcweir }
283cdf0e10cSrcweir
getAccessibleImageHeight()284cdf0e10cSrcweir sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getAccessibleImageHeight( )
285cdf0e10cSrcweir throw ( uno::RuntimeException )
286cdf0e10cSrcweir {
287cdf0e10cSrcweir return getSize().Height;
288cdf0e10cSrcweir }
289cdf0e10cSrcweir
getAccessibleImageWidth()290cdf0e10cSrcweir sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getAccessibleImageWidth( )
291cdf0e10cSrcweir throw ( uno::RuntimeException )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir return getSize().Width;
294cdf0e10cSrcweir }
295*ca62e2c2SSteve Yin //===== XAccesibleText ==================================================
getCaretPosition()296*ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
setCaretPosition(sal_Int32)297*ca62e2c2SSteve Yin sal_Bool SAL_CALL SwAccessibleNoTextFrame::setCaretPosition( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
getCharacter(sal_Int32)298*ca62e2c2SSteve Yin sal_Unicode SAL_CALL SwAccessibleNoTextFrame::getCharacter( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
getCharacterAttributes(sal_Int32,const::com::sun::star::uno::Sequence<::rtl::OUString> &)299*ca62e2c2SSteve Yin ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL SwAccessibleNoTextFrame::getCharacterAttributes( sal_Int32 , const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
300*ca62e2c2SSteve Yin {
301*ca62e2c2SSteve Yin uno::Sequence<beans::PropertyValue> aValues(0);
302*ca62e2c2SSteve Yin return aValues;
303*ca62e2c2SSteve Yin }
getCharacterBounds(sal_Int32)304*ca62e2c2SSteve Yin ::com::sun::star::awt::Rectangle SAL_CALL SwAccessibleNoTextFrame::getCharacterBounds( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
305*ca62e2c2SSteve Yin {
306*ca62e2c2SSteve Yin return com::sun::star::awt::Rectangle(0, 0, 0, 0 );
307*ca62e2c2SSteve Yin }
getCharacterCount()308*ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
getIndexAtPoint(const::com::sun::star::awt::Point &)309*ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getIndexAtPoint( const ::com::sun::star::awt::Point& ) throw (::com::sun::star::uno::RuntimeException){return 0;}
getSelectedText()310*ca62e2c2SSteve Yin ::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
getSelectionStart()311*ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
getSelectionEnd()312*ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException){return 0;}
setSelection(sal_Int32,sal_Int32)313*ca62e2c2SSteve Yin sal_Bool SAL_CALL SwAccessibleNoTextFrame::setSelection( sal_Int32 , sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
getText()314*ca62e2c2SSteve Yin ::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getText( ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
getTextRange(sal_Int32,sal_Int32)315*ca62e2c2SSteve Yin ::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getTextRange( sal_Int32 , sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return OUString();}
getTextAtIndex(sal_Int32,sal_Int16)316*ca62e2c2SSteve Yin ::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextAtIndex( sal_Int32 , sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
317*ca62e2c2SSteve Yin {
318*ca62e2c2SSteve Yin ::com::sun::star::accessibility::TextSegment aResult;
319*ca62e2c2SSteve Yin return aResult;
320*ca62e2c2SSteve Yin }
getTextBeforeIndex(sal_Int32,sal_Int16)321*ca62e2c2SSteve Yin ::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextBeforeIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
322*ca62e2c2SSteve Yin {
323*ca62e2c2SSteve Yin ::com::sun::star::accessibility::TextSegment aResult;
324*ca62e2c2SSteve Yin return aResult;
325*ca62e2c2SSteve Yin }
getTextBehindIndex(sal_Int32,sal_Int16)326*ca62e2c2SSteve Yin ::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextBehindIndex( sal_Int32 , sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
327*ca62e2c2SSteve Yin {
328*ca62e2c2SSteve Yin ::com::sun::star::accessibility::TextSegment aResult;
329*ca62e2c2SSteve Yin return aResult;
330*ca62e2c2SSteve Yin }
331*ca62e2c2SSteve Yin
copyText(sal_Int32,sal_Int32)332*ca62e2c2SSteve Yin sal_Bool SAL_CALL SwAccessibleNoTextFrame::copyText( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
333*ca62e2c2SSteve Yin
334*ca62e2c2SSteve Yin
335*ca62e2c2SSteve Yin //
336*ca62e2c2SSteve Yin // XAccessibleHyperText
337*ca62e2c2SSteve Yin //
getHyperLinkCount()338*ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkCount()
339*ca62e2c2SSteve Yin throw (uno::RuntimeException)
340*ca62e2c2SSteve Yin {
341*ca62e2c2SSteve Yin vos::OGuard aGuard(Application::GetSolarMutex());
342*ca62e2c2SSteve Yin
343*ca62e2c2SSteve Yin CHECK_FOR_DEFUNC( XAccessibleHypertext );
344*ca62e2c2SSteve Yin
345*ca62e2c2SSteve Yin sal_Int32 nCount = 0;
346*ca62e2c2SSteve Yin SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
347*ca62e2c2SSteve Yin
348*ca62e2c2SSteve Yin if(aURL.GetMap() || aURL.GetURL().Len())
349*ca62e2c2SSteve Yin nCount = 1;
350*ca62e2c2SSteve Yin
351*ca62e2c2SSteve Yin return nCount;
352*ca62e2c2SSteve Yin }
353*ca62e2c2SSteve Yin
354*ca62e2c2SSteve Yin uno::Reference< XAccessibleHyperlink > SAL_CALL
getHyperLink(sal_Int32 nLinkIndex)355*ca62e2c2SSteve Yin SwAccessibleNoTextFrame::getHyperLink( sal_Int32 nLinkIndex )
356*ca62e2c2SSteve Yin throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
357*ca62e2c2SSteve Yin {
358*ca62e2c2SSteve Yin vos::OGuard aGuard(Application::GetSolarMutex());
359*ca62e2c2SSteve Yin CHECK_FOR_DEFUNC( XAccessibleHypertext );
360*ca62e2c2SSteve Yin
361*ca62e2c2SSteve Yin uno::Reference< XAccessibleHyperlink > xRet;
362*ca62e2c2SSteve Yin
363*ca62e2c2SSteve Yin SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
364*ca62e2c2SSteve Yin
365*ca62e2c2SSteve Yin if( nLinkIndex > 0 )
366*ca62e2c2SSteve Yin throw lang::IndexOutOfBoundsException();
367*ca62e2c2SSteve Yin
368*ca62e2c2SSteve Yin if( aURL.GetMap() || aURL.GetURL().Len() )
369*ca62e2c2SSteve Yin {
370*ca62e2c2SSteve Yin if ( !alink.is() )
371*ca62e2c2SSteve Yin {
372*ca62e2c2SSteve Yin alink = new SwAccessibleNoTextHyperlink( this, GetFrm() );
373*ca62e2c2SSteve Yin }
374*ca62e2c2SSteve Yin
375*ca62e2c2SSteve Yin return alink;
376*ca62e2c2SSteve Yin }
377*ca62e2c2SSteve Yin
378*ca62e2c2SSteve Yin return NULL;
379*ca62e2c2SSteve Yin }
380*ca62e2c2SSteve Yin
getHyperLinkIndex(sal_Int32)381*ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkIndex( sal_Int32 )
382*ca62e2c2SSteve Yin throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
383*ca62e2c2SSteve Yin {
384*ca62e2c2SSteve Yin vos::OGuard aGuard(Application::GetSolarMutex());
385*ca62e2c2SSteve Yin CHECK_FOR_DEFUNC( XAccessibleHypertext );
386*ca62e2c2SSteve Yin
387*ca62e2c2SSteve Yin sal_Int32 nRet = 0;
388*ca62e2c2SSteve Yin
389*ca62e2c2SSteve Yin return nRet;
390*ca62e2c2SSteve Yin }
391*ca62e2c2SSteve Yin
makeRelation(sal_Int16 nType,const SwFlyFrm * pFrm)392*ca62e2c2SSteve Yin AccessibleRelation SwAccessibleNoTextFrame::makeRelation( sal_Int16 nType, const SwFlyFrm* pFrm )
393*ca62e2c2SSteve Yin {
394*ca62e2c2SSteve Yin uno::Sequence<uno::Reference<XInterface> > aSequence(1);
395*ca62e2c2SSteve Yin aSequence[0] = GetMap()->GetContext( pFrm );
396*ca62e2c2SSteve Yin return AccessibleRelation( nType, aSequence );
397*ca62e2c2SSteve Yin }
398*ca62e2c2SSteve Yin
399*ca62e2c2SSteve Yin
getAccessibleRelationSet()400*ca62e2c2SSteve Yin uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleNoTextFrame::getAccessibleRelationSet( )
401*ca62e2c2SSteve Yin throw ( uno::RuntimeException )
402*ca62e2c2SSteve Yin {
403*ca62e2c2SSteve Yin vos::OGuard aGuard(Application::GetSolarMutex());
404*ca62e2c2SSteve Yin CHECK_FOR_DEFUNC( XAccessibleContext );
405*ca62e2c2SSteve Yin
406*ca62e2c2SSteve Yin // get the caption frame, and insert label relations into helper
407*ca62e2c2SSteve Yin
408*ca62e2c2SSteve Yin AccessibleRelationSetHelper* pHelper = new AccessibleRelationSetHelper();
409*ca62e2c2SSteve Yin
410*ca62e2c2SSteve Yin SwFlyFrm* pFlyFrm = getFlyFrm();
411*ca62e2c2SSteve Yin DBG_ASSERT( pFlyFrm != NULL, "fly frame expected" );
412*ca62e2c2SSteve Yin
413*ca62e2c2SSteve Yin SwFlyFrm* pCaptionFrm = NULL;
414*ca62e2c2SSteve Yin const SwFrmFmt* pFrm = pFlyFrm ->GetFmt()->GetCaptionFmt();
415*ca62e2c2SSteve Yin if (pFrm)
416*ca62e2c2SSteve Yin {
417*ca62e2c2SSteve Yin SwClientIter aIter (*(SwModify*)pFrm);
418*ca62e2c2SSteve Yin pCaptionFrm = (SwFlyFrm*)aIter.First( TYPE ( SwFlyFrm ));
419*ca62e2c2SSteve Yin }
420*ca62e2c2SSteve Yin if(pCaptionFrm!=NULL)
421*ca62e2c2SSteve Yin {
422*ca62e2c2SSteve Yin pHelper->AddRelation( makeRelation( AccessibleRelationType::DESCRIBED_BY, pCaptionFrm ) );
423*ca62e2c2SSteve Yin }
424*ca62e2c2SSteve Yin
425*ca62e2c2SSteve Yin return pHelper;
426*ca62e2c2SSteve Yin }
427