xref: /trunk/main/sw/source/core/access/accnotextframe.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
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
10cdf0e10cSrcweir  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
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"
42ca62e2c2SSteve Yin #include <fmturl.hxx>
43ca62e2c2SSteve Yin #include <accnotexthyperlink.hxx>
44ca62e2c2SSteve Yin #include <svtools/imap.hxx>
45ca62e2c2SSteve Yin #include <unotools/accessiblerelationsethelper.hxx>
46ca62e2c2SSteve Yin #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
47ca62e2c2SSteve Yin #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
48ca62e2c2SSteve Yin #include <doc.hxx>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir using namespace ::com::sun::star;
51cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
52cdf0e10cSrcweir using ::rtl::OUString;
53ca62e2c2SSteve 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() );
63ca62e2c2SSteve Yin         const SwCntntNode* pSwCntntNode = pCntFrm->GetNode();
64ca62e2c2SSteve Yin         if(pSwCntntNode != NULL)
65ca62e2c2SSteve Yin         {
66ca62e2c2SSteve Yin             pNd = pSwCntntNode->GetNoTxtNode();
67ca62e2c2SSteve 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 )
218ca62e2c2SSteve Yin     // OUString longDesc;
219ca62e2c2SSteve Yin     // const SwFlyFrmFmt* pFlyFmt = GetShell()->GetDoc()->FindFlyByName( GetName(), 0);
220ca62e2c2SSteve Yin     // longDesc = OUString( pFlyFmt->GetLongDescription() );
221ca62e2c2SSteve 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     }
243ca62e2c2SSteve Yin     else if ( aType == ::getCppuType((uno::Reference<XAccessibleHypertext> *)0) )
244ca62e2c2SSteve Yin     {
245ca62e2c2SSteve Yin         uno::Reference<XAccessibleHypertext> aAccHypertext = this;
246ca62e2c2SSteve Yin         uno::Any aAny;
247ca62e2c2SSteve Yin         aAny <<= aAccHypertext;
248ca62e2c2SSteve Yin         return aAny;
249ca62e2c2SSteve 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
275*531ea755SJohn Bampton // all relevant 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 }
295ca62e2c2SSteve Yin //=====  XAccesibleText  ==================================================
getCaretPosition()296ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
setCaretPosition(sal_Int32)297ca62e2c2SSteve 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)298ca62e2c2SSteve 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> &)299ca62e2c2SSteve 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)
300ca62e2c2SSteve Yin {
301ca62e2c2SSteve Yin     uno::Sequence<beans::PropertyValue> aValues(0);
302ca62e2c2SSteve Yin     return aValues;
303ca62e2c2SSteve Yin }
getCharacterBounds(sal_Int32)304ca62e2c2SSteve Yin ::com::sun::star::awt::Rectangle SAL_CALL SwAccessibleNoTextFrame::getCharacterBounds( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
305ca62e2c2SSteve Yin {
306ca62e2c2SSteve Yin     return com::sun::star::awt::Rectangle(0, 0, 0, 0 );
307ca62e2c2SSteve Yin }
getCharacterCount()308ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCharacterCount(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
getIndexAtPoint(const::com::sun::star::awt::Point &)309ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getIndexAtPoint( const ::com::sun::star::awt::Point& ) throw (::com::sun::star::uno::RuntimeException){return 0;}
getSelectedText()310ca62e2c2SSteve Yin ::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getSelectedText(  ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
getSelectionStart()311ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getSelectionStart(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
getSelectionEnd()312ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getSelectionEnd(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
setSelection(sal_Int32,sal_Int32)313ca62e2c2SSteve 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()314ca62e2c2SSteve Yin ::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getText(  ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
getTextRange(sal_Int32,sal_Int32)315ca62e2c2SSteve 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)316ca62e2c2SSteve 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)
317ca62e2c2SSteve Yin {
318ca62e2c2SSteve Yin     ::com::sun::star::accessibility::TextSegment aResult;
319ca62e2c2SSteve Yin     return aResult;
320ca62e2c2SSteve Yin }
getTextBeforeIndex(sal_Int32,sal_Int16)321ca62e2c2SSteve 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)
322ca62e2c2SSteve Yin {
323ca62e2c2SSteve Yin     ::com::sun::star::accessibility::TextSegment aResult;
324ca62e2c2SSteve Yin     return aResult;
325ca62e2c2SSteve Yin }
getTextBehindIndex(sal_Int32,sal_Int16)326ca62e2c2SSteve 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)
327ca62e2c2SSteve Yin {
328ca62e2c2SSteve Yin     ::com::sun::star::accessibility::TextSegment aResult;
329ca62e2c2SSteve Yin     return aResult;
330ca62e2c2SSteve Yin }
331ca62e2c2SSteve Yin 
copyText(sal_Int32,sal_Int32)332ca62e2c2SSteve 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;}
333ca62e2c2SSteve Yin 
334ca62e2c2SSteve Yin 
335ca62e2c2SSteve Yin //
336ca62e2c2SSteve Yin //  XAccessibleHyperText
337ca62e2c2SSteve Yin //
getHyperLinkCount()338ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkCount()
339ca62e2c2SSteve Yin throw (uno::RuntimeException)
340ca62e2c2SSteve Yin {
341ca62e2c2SSteve Yin     vos::OGuard aGuard(Application::GetSolarMutex());
342ca62e2c2SSteve Yin 
343ca62e2c2SSteve Yin     CHECK_FOR_DEFUNC( XAccessibleHypertext );
344ca62e2c2SSteve Yin 
345ca62e2c2SSteve Yin     sal_Int32 nCount = 0;
346ca62e2c2SSteve Yin     SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
347ca62e2c2SSteve Yin 
348ca62e2c2SSteve Yin     if(aURL.GetMap() || aURL.GetURL().Len())
349ca62e2c2SSteve Yin         nCount = 1;
350ca62e2c2SSteve Yin 
351ca62e2c2SSteve Yin     return nCount;
352ca62e2c2SSteve Yin }
353ca62e2c2SSteve Yin 
354ca62e2c2SSteve Yin uno::Reference< XAccessibleHyperlink > SAL_CALL
getHyperLink(sal_Int32 nLinkIndex)355ca62e2c2SSteve Yin     SwAccessibleNoTextFrame::getHyperLink( sal_Int32 nLinkIndex )
356ca62e2c2SSteve Yin     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
357ca62e2c2SSteve Yin {
358ca62e2c2SSteve Yin     vos::OGuard aGuard(Application::GetSolarMutex());
359ca62e2c2SSteve Yin     CHECK_FOR_DEFUNC( XAccessibleHypertext );
360ca62e2c2SSteve Yin 
361ca62e2c2SSteve Yin     uno::Reference< XAccessibleHyperlink > xRet;
362ca62e2c2SSteve Yin 
363ca62e2c2SSteve Yin     SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
364ca62e2c2SSteve Yin 
365ca62e2c2SSteve Yin     if( nLinkIndex > 0 )
366ca62e2c2SSteve Yin         throw lang::IndexOutOfBoundsException();
367ca62e2c2SSteve Yin 
368ca62e2c2SSteve Yin     if( aURL.GetMap() || aURL.GetURL().Len() )
369ca62e2c2SSteve Yin     {
370ca62e2c2SSteve Yin         if ( !alink.is() )
371ca62e2c2SSteve Yin         {
372ca62e2c2SSteve Yin             alink = new SwAccessibleNoTextHyperlink( this, GetFrm() );
373ca62e2c2SSteve Yin         }
374ca62e2c2SSteve Yin 
375ca62e2c2SSteve Yin         return alink;
376ca62e2c2SSteve Yin     }
377ca62e2c2SSteve Yin 
378ca62e2c2SSteve Yin     return NULL;
379ca62e2c2SSteve Yin }
380ca62e2c2SSteve Yin 
getHyperLinkIndex(sal_Int32)381ca62e2c2SSteve Yin sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkIndex( sal_Int32 )
382ca62e2c2SSteve Yin     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
383ca62e2c2SSteve Yin {
384ca62e2c2SSteve Yin     vos::OGuard aGuard(Application::GetSolarMutex());
385ca62e2c2SSteve Yin     CHECK_FOR_DEFUNC( XAccessibleHypertext );
386ca62e2c2SSteve Yin 
387ca62e2c2SSteve Yin     sal_Int32 nRet = 0;
388ca62e2c2SSteve Yin 
389ca62e2c2SSteve Yin     return nRet;
390ca62e2c2SSteve Yin }
391ca62e2c2SSteve Yin 
makeRelation(sal_Int16 nType,const SwFlyFrm * pFrm)392ca62e2c2SSteve Yin AccessibleRelation SwAccessibleNoTextFrame::makeRelation( sal_Int16 nType, const SwFlyFrm* pFrm )
393ca62e2c2SSteve Yin {
394ca62e2c2SSteve Yin     uno::Sequence<uno::Reference<XInterface> > aSequence(1);
395ca62e2c2SSteve Yin     aSequence[0] = GetMap()->GetContext( pFrm );
396ca62e2c2SSteve Yin     return AccessibleRelation( nType, aSequence );
397ca62e2c2SSteve Yin }
398ca62e2c2SSteve Yin 
399ca62e2c2SSteve Yin 
getAccessibleRelationSet()400ca62e2c2SSteve Yin uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleNoTextFrame::getAccessibleRelationSet( )
401ca62e2c2SSteve Yin     throw ( uno::RuntimeException )
402ca62e2c2SSteve Yin {
403ca62e2c2SSteve Yin     vos::OGuard aGuard(Application::GetSolarMutex());
404ca62e2c2SSteve Yin     CHECK_FOR_DEFUNC( XAccessibleContext );
405ca62e2c2SSteve Yin 
406ca62e2c2SSteve Yin     // get the caption frame, and insert label relations into helper
407ca62e2c2SSteve Yin 
408ca62e2c2SSteve Yin     AccessibleRelationSetHelper* pHelper = new AccessibleRelationSetHelper();
409ca62e2c2SSteve Yin 
410ca62e2c2SSteve Yin     SwFlyFrm* pFlyFrm = getFlyFrm();
411ca62e2c2SSteve Yin     DBG_ASSERT( pFlyFrm != NULL, "fly frame expected" );
412ca62e2c2SSteve Yin 
413ca62e2c2SSteve Yin     SwFlyFrm* pCaptionFrm = NULL;
414ca62e2c2SSteve Yin     const SwFrmFmt* pFrm = pFlyFrm ->GetFmt()->GetCaptionFmt();
415ca62e2c2SSteve Yin     if (pFrm)
416ca62e2c2SSteve Yin     {
417ca62e2c2SSteve Yin         SwClientIter aIter (*(SwModify*)pFrm);
418ca62e2c2SSteve Yin         pCaptionFrm = (SwFlyFrm*)aIter.First( TYPE ( SwFlyFrm ));
419ca62e2c2SSteve Yin     }
420ca62e2c2SSteve Yin     if(pCaptionFrm!=NULL)
421ca62e2c2SSteve Yin     {
422ca62e2c2SSteve Yin         pHelper->AddRelation( makeRelation( AccessibleRelationType::DESCRIBED_BY, pCaptionFrm ) );
423ca62e2c2SSteve Yin     }
424ca62e2c2SSteve Yin 
425ca62e2c2SSteve Yin     return pHelper;
426ca62e2c2SSteve Yin }
427