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 <com/sun/star/accessibility/AccessibleStateType.hpp>
29cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
30cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
31cdf0e10cSrcweir #include <vos/mutex.hxx>
32cdf0e10cSrcweir #include <vcl/svapp.hxx>
33cdf0e10cSrcweir #include <vcl/window.hxx>
34cdf0e10cSrcweir #include <frmfmt.hxx>
35cdf0e10cSrcweir #include <ndnotxt.hxx>
36cdf0e10cSrcweir #include <flyfrm.hxx>
37cdf0e10cSrcweir #include <cntfrm.hxx>
38cdf0e10cSrcweir #include <fmtcntnt.hxx>
39cdf0e10cSrcweir #include <ndindex.hxx>
40cdf0e10cSrcweir #include "fesh.hxx"
41cdf0e10cSrcweir #include <hints.hxx>
42cdf0e10cSrcweir #include "accmap.hxx"
43cdf0e10cSrcweir #include "accframebase.hxx"
44cdf0e10cSrcweir
45ca62e2c2SSteve Yin #ifndef _CRSRSH_HXX
46ca62e2c2SSteve Yin #include <crsrsh.hxx>
47ca62e2c2SSteve Yin #endif
48ca62e2c2SSteve Yin #ifndef _FESH_HXX
49ca62e2c2SSteve Yin #include "fesh.hxx"
50ca62e2c2SSteve Yin #endif
51ca62e2c2SSteve Yin #ifndef _TXTFRM_HXX
52ca62e2c2SSteve Yin #include <txtfrm.hxx>
53ca62e2c2SSteve Yin #endif
54ca62e2c2SSteve Yin #ifndef _NDTXT_HXX
55ca62e2c2SSteve Yin #include <ndtxt.hxx>
56ca62e2c2SSteve Yin #endif
57ca62e2c2SSteve Yin #ifndef _DCONTACT_HXX
58ca62e2c2SSteve Yin #include <dcontact.hxx>
59ca62e2c2SSteve Yin #endif
60ca62e2c2SSteve Yin #ifndef _FMTANCHR_HXX
61ca62e2c2SSteve Yin #include <fmtanchr.hxx>
62ca62e2c2SSteve Yin #endif
63cdf0e10cSrcweir using namespace ::com::sun::star;
64cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
65cdf0e10cSrcweir using ::rtl::OUString;
66cdf0e10cSrcweir
IsSelected()67cdf0e10cSrcweir sal_Bool SwAccessibleFrameBase::IsSelected()
68cdf0e10cSrcweir {
69cdf0e10cSrcweir sal_Bool bRet = sal_False;
70cdf0e10cSrcweir
71cdf0e10cSrcweir DBG_ASSERT( GetMap(), "no map?" );
72cdf0e10cSrcweir const ViewShell *pVSh = GetMap()->GetShell();
73cdf0e10cSrcweir DBG_ASSERT( pVSh, "no shell?" );
74cdf0e10cSrcweir if( pVSh->ISA( SwFEShell ) )
75cdf0e10cSrcweir {
76cdf0e10cSrcweir const SwFEShell *pFESh = static_cast< const SwFEShell * >( pVSh );
77cdf0e10cSrcweir const SwFrm *pFlyFrm = pFESh->GetCurrFlyFrm();
78cdf0e10cSrcweir if( pFlyFrm == GetFrm() )
79cdf0e10cSrcweir bRet = sal_True;
80cdf0e10cSrcweir }
81cdf0e10cSrcweir
82cdf0e10cSrcweir return bRet;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
GetStates(::utl::AccessibleStateSetHelper & rStateSet)85cdf0e10cSrcweir void SwAccessibleFrameBase::GetStates(
86cdf0e10cSrcweir ::utl::AccessibleStateSetHelper& rStateSet )
87cdf0e10cSrcweir {
88cdf0e10cSrcweir SwAccessibleContext::GetStates( rStateSet );
89cdf0e10cSrcweir
90cdf0e10cSrcweir const ViewShell *pVSh = GetMap()->GetShell();
91cdf0e10cSrcweir DBG_ASSERT( pVSh, "no shell?" );
92cdf0e10cSrcweir sal_Bool bSelectable = pVSh->ISA( SwFEShell );
93cdf0e10cSrcweir
94cdf0e10cSrcweir // SELECTABLE
95cdf0e10cSrcweir if( bSelectable )
96cdf0e10cSrcweir rStateSet.AddState( AccessibleStateType::SELECTABLE );
97cdf0e10cSrcweir
98cdf0e10cSrcweir // FOCUSABLE
99cdf0e10cSrcweir if( bSelectable )
100cdf0e10cSrcweir rStateSet.AddState( AccessibleStateType::FOCUSABLE );
101cdf0e10cSrcweir
102cdf0e10cSrcweir // SELECTED and FOCUSED
103cdf0e10cSrcweir if( IsSelected() )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir rStateSet.AddState( AccessibleStateType::SELECTED );
106cdf0e10cSrcweir ASSERT( bIsSelected, "bSelected out of sync" );
107cdf0e10cSrcweir ::vos::ORef < SwAccessibleContext > xThis( this );
108cdf0e10cSrcweir GetMap()->SetCursorContext( xThis );
109cdf0e10cSrcweir
110cdf0e10cSrcweir Window *pWin = GetWindow();
111cdf0e10cSrcweir if( pWin && pWin->HasFocus() )
112cdf0e10cSrcweir rStateSet.AddState( AccessibleStateType::FOCUSED );
113cdf0e10cSrcweir }
114ca62e2c2SSteve Yin if( GetSelectedState() )
115ca62e2c2SSteve Yin rStateSet.AddState( AccessibleStateType::SELECTED );
116cdf0e10cSrcweir }
117cdf0e10cSrcweir
118cdf0e10cSrcweir
GetNodeType(const SwFlyFrm * pFlyFrm)119cdf0e10cSrcweir sal_uInt8 SwAccessibleFrameBase::GetNodeType( const SwFlyFrm *pFlyFrm )
120cdf0e10cSrcweir {
121cdf0e10cSrcweir sal_uInt8 nType = ND_TEXTNODE;
122cdf0e10cSrcweir if( pFlyFrm->Lower() )
123cdf0e10cSrcweir {
124cdf0e10cSrcweir if( pFlyFrm->Lower()->IsNoTxtFrm() )
125cdf0e10cSrcweir {
126cdf0e10cSrcweir const SwCntntFrm *pCntFrm =
127cdf0e10cSrcweir static_cast<const SwCntntFrm *>( pFlyFrm->Lower() );
128cdf0e10cSrcweir nType = pCntFrm->GetNode()->GetNodeType();
129cdf0e10cSrcweir }
130cdf0e10cSrcweir }
131cdf0e10cSrcweir else
132cdf0e10cSrcweir {
133cdf0e10cSrcweir const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
134cdf0e10cSrcweir const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt();
135cdf0e10cSrcweir const SwNodeIndex *pNdIdx = rCntnt.GetCntntIdx();
136cdf0e10cSrcweir if( pNdIdx )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir const SwCntntNode *pCNd =
139cdf0e10cSrcweir (pNdIdx->GetNodes())[pNdIdx->GetIndex()+1]->GetCntntNode();
140cdf0e10cSrcweir if( pCNd )
141cdf0e10cSrcweir nType = pCNd->GetNodeType();
142cdf0e10cSrcweir }
143cdf0e10cSrcweir }
144cdf0e10cSrcweir
145cdf0e10cSrcweir return nType;
146cdf0e10cSrcweir }
147cdf0e10cSrcweir
SwAccessibleFrameBase(SwAccessibleMap * pInitMap,sal_Int16 nInitRole,const SwFlyFrm * pFlyFrm)148cdf0e10cSrcweir SwAccessibleFrameBase::SwAccessibleFrameBase(
149cdf0e10cSrcweir SwAccessibleMap* pInitMap,
150cdf0e10cSrcweir sal_Int16 nInitRole,
151cdf0e10cSrcweir const SwFlyFrm* pFlyFrm ) :
152cdf0e10cSrcweir SwAccessibleContext( pInitMap, nInitRole, pFlyFrm ),
153cdf0e10cSrcweir bIsSelected( sal_False )
154cdf0e10cSrcweir {
155cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
156cdf0e10cSrcweir
157cdf0e10cSrcweir const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
158cdf0e10cSrcweir const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
159cdf0e10cSrcweir
160cdf0e10cSrcweir SetName( pFrmFmt->GetName() );
161cdf0e10cSrcweir
162cdf0e10cSrcweir bIsSelected = IsSelected();
163cdf0e10cSrcweir }
164cdf0e10cSrcweir
_InvalidateCursorPos()165cdf0e10cSrcweir void SwAccessibleFrameBase::_InvalidateCursorPos()
166cdf0e10cSrcweir {
167cdf0e10cSrcweir sal_Bool bNewSelected = IsSelected();
168cdf0e10cSrcweir sal_Bool bOldSelected;
169cdf0e10cSrcweir
170cdf0e10cSrcweir {
171cdf0e10cSrcweir vos::OGuard aGuard( aMutex );
172cdf0e10cSrcweir bOldSelected = bIsSelected;
173cdf0e10cSrcweir bIsSelected = bNewSelected;
174cdf0e10cSrcweir }
175cdf0e10cSrcweir
176cdf0e10cSrcweir if( bNewSelected )
177cdf0e10cSrcweir {
178cdf0e10cSrcweir // remember that object as the one that has the caret. This is
179*86e1cf34SPedro Giffuni // necessary to notify that object if the cursor leaves it.
180cdf0e10cSrcweir ::vos::ORef < SwAccessibleContext > xThis( this );
181cdf0e10cSrcweir GetMap()->SetCursorContext( xThis );
182cdf0e10cSrcweir }
183cdf0e10cSrcweir
184cdf0e10cSrcweir if( bOldSelected != bNewSelected )
185cdf0e10cSrcweir {
186cdf0e10cSrcweir Window *pWin = GetWindow();
187cdf0e10cSrcweir if( pWin && pWin->HasFocus() && bNewSelected )
188cdf0e10cSrcweir FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected );
189ca62e2c2SSteve Yin //FireStateChangedEvent( AccessibleStateType::SELECTED, bNewSelected );
190cdf0e10cSrcweir if( pWin && pWin->HasFocus() && !bNewSelected )
191cdf0e10cSrcweir FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected );
192ca62e2c2SSteve Yin if(bNewSelected)
193cdf0e10cSrcweir {
194ca62e2c2SSteve Yin uno::Reference< XAccessible > xParent( GetWeakParent() );
195ca62e2c2SSteve Yin if( xParent.is() )
196ca62e2c2SSteve Yin {
197ca62e2c2SSteve Yin SwAccessibleContext *pAcc =
198ca62e2c2SSteve Yin static_cast <SwAccessibleContext *>( xParent.get() );
199ca62e2c2SSteve Yin
200ca62e2c2SSteve Yin AccessibleEventObject aEvent;
201ca62e2c2SSteve Yin aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
202ca62e2c2SSteve Yin uno::Reference< XAccessible > xChild(this);
203ca62e2c2SSteve Yin aEvent.NewValue <<= xChild;
204ca62e2c2SSteve Yin pAcc->FireAccessibleEvent( aEvent );
205ca62e2c2SSteve Yin }
206cdf0e10cSrcweir }
207cdf0e10cSrcweir }
208cdf0e10cSrcweir }
209cdf0e10cSrcweir
_InvalidateFocus()210cdf0e10cSrcweir void SwAccessibleFrameBase::_InvalidateFocus()
211cdf0e10cSrcweir {
212cdf0e10cSrcweir Window *pWin = GetWindow();
213cdf0e10cSrcweir if( pWin )
214cdf0e10cSrcweir {
215cdf0e10cSrcweir sal_Bool bSelected;
216cdf0e10cSrcweir
217cdf0e10cSrcweir {
218cdf0e10cSrcweir vos::OGuard aGuard( aMutex );
219cdf0e10cSrcweir bSelected = bIsSelected;
220cdf0e10cSrcweir }
221cdf0e10cSrcweir ASSERT( bSelected, "focus object should be selected" );
222cdf0e10cSrcweir
223cdf0e10cSrcweir FireStateChangedEvent( AccessibleStateType::FOCUSED,
224cdf0e10cSrcweir pWin->HasFocus() && bSelected );
225cdf0e10cSrcweir }
226cdf0e10cSrcweir }
227cdf0e10cSrcweir
HasCursor()228cdf0e10cSrcweir sal_Bool SwAccessibleFrameBase::HasCursor()
229cdf0e10cSrcweir {
230cdf0e10cSrcweir vos::OGuard aGuard( aMutex );
231cdf0e10cSrcweir return bIsSelected;
232cdf0e10cSrcweir }
233cdf0e10cSrcweir
234cdf0e10cSrcweir
~SwAccessibleFrameBase()235cdf0e10cSrcweir SwAccessibleFrameBase::~SwAccessibleFrameBase()
236cdf0e10cSrcweir {
237cdf0e10cSrcweir }
238cdf0e10cSrcweir
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)239cdf0e10cSrcweir void SwAccessibleFrameBase::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
240cdf0e10cSrcweir {
241cdf0e10cSrcweir sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
242cdf0e10cSrcweir const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm * >( GetFrm() );
243cdf0e10cSrcweir switch( nWhich )
244cdf0e10cSrcweir {
245cdf0e10cSrcweir case RES_NAME_CHANGED:
246cdf0e10cSrcweir if( pFlyFrm )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
249cdf0e10cSrcweir ASSERT( pFrmFmt == GetRegisteredIn(), "invalid frame" );
250cdf0e10cSrcweir
251cdf0e10cSrcweir OUString sOldName( GetName() );
252cdf0e10cSrcweir ASSERT( !pOld ||
253cdf0e10cSrcweir static_cast < const SwStringMsgPoolItem * >( pOld )->GetString() == String( sOldName ),
254cdf0e10cSrcweir "invalid old name" );
255cdf0e10cSrcweir
256cdf0e10cSrcweir const String& rNewName = pFrmFmt->GetName();
257cdf0e10cSrcweir SetName( rNewName );
258cdf0e10cSrcweir ASSERT( !pNew ||
259cdf0e10cSrcweir static_cast < const SwStringMsgPoolItem * >( pNew )->GetString() == rNewName,
260cdf0e10cSrcweir "invalid new name" );
261cdf0e10cSrcweir
262cdf0e10cSrcweir if( sOldName != GetName() )
263cdf0e10cSrcweir {
264cdf0e10cSrcweir AccessibleEventObject aEvent;
265cdf0e10cSrcweir aEvent.EventId = AccessibleEventId::NAME_CHANGED;
266cdf0e10cSrcweir aEvent.OldValue <<= sOldName;
267cdf0e10cSrcweir aEvent.NewValue <<= GetName();
268cdf0e10cSrcweir FireAccessibleEvent( aEvent );
269cdf0e10cSrcweir }
270cdf0e10cSrcweir }
271cdf0e10cSrcweir break;
272cdf0e10cSrcweir case RES_OBJECTDYING:
273cdf0e10cSrcweir // mba: it seems that this class intentionally does not call code in base class SwClient
274ca62e2c2SSteve Yin if( pOld && ( GetRegisteredIn() == static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) ) )
275cdf0e10cSrcweir GetRegisteredInNonConst()->Remove( this );
276cdf0e10cSrcweir break;
277cdf0e10cSrcweir
278cdf0e10cSrcweir case RES_FMT_CHG:
279ca62e2c2SSteve Yin if( pOld &&
280ca62e2c2SSteve Yin static_cast< const SwFmtChg * >(pNew)->pChangedFmt == GetRegisteredIn() &&
281cdf0e10cSrcweir static_cast< const SwFmtChg * >(pOld)->pChangedFmt->IsFmtInDTOR() )
282cdf0e10cSrcweir GetRegisteredInNonConst()->Remove( this );
283cdf0e10cSrcweir break;
284cdf0e10cSrcweir
285cdf0e10cSrcweir default:
286cdf0e10cSrcweir // mba: former call to base class method removed as it is meant to handle only RES_OBJECTDYING
287cdf0e10cSrcweir break;
288cdf0e10cSrcweir }
289cdf0e10cSrcweir }
290cdf0e10cSrcweir
Dispose(sal_Bool bRecursive)291cdf0e10cSrcweir void SwAccessibleFrameBase::Dispose( sal_Bool bRecursive )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
294cdf0e10cSrcweir
295cdf0e10cSrcweir if( GetRegisteredIn() )
296cdf0e10cSrcweir GetRegisteredInNonConst()->Remove( this );
297cdf0e10cSrcweir
298cdf0e10cSrcweir SwAccessibleContext::Dispose( bRecursive );
299cdf0e10cSrcweir }
300ca62e2c2SSteve Yin //Get the selection cursor of the document.
GetCrsr()301ca62e2c2SSteve Yin SwPaM* SwAccessibleFrameBase::GetCrsr()
302ca62e2c2SSteve Yin {
303ca62e2c2SSteve Yin // get the cursor shell; if we don't have any, we don't have a
304ca62e2c2SSteve Yin // cursor/selection either
305ca62e2c2SSteve Yin SwPaM* pCrsr = NULL;
306ca62e2c2SSteve Yin SwCrsrShell* pCrsrShell = GetCrsrShell();
307ca62e2c2SSteve Yin if( pCrsrShell != NULL && !pCrsrShell->IsTableMode() )
308ca62e2c2SSteve Yin {
309ca62e2c2SSteve Yin SwFEShell *pFESh = pCrsrShell->ISA( SwFEShell )
310ca62e2c2SSteve Yin ? static_cast< SwFEShell * >( pCrsrShell ) : 0;
311ca62e2c2SSteve Yin if( !pFESh ||
312ca62e2c2SSteve Yin !(pFESh->IsFrmSelected() || pFESh->IsObjSelected() > 0) )
313ca62e2c2SSteve Yin {
314ca62e2c2SSteve Yin // get the selection, and test whether it affects our text node
315ca62e2c2SSteve Yin pCrsr = pCrsrShell->GetCrsr( sal_False /* ??? */ );
316ca62e2c2SSteve Yin }
317ca62e2c2SSteve Yin }
318ca62e2c2SSteve Yin
319ca62e2c2SSteve Yin return pCrsr;
320ca62e2c2SSteve Yin }
321ca62e2c2SSteve Yin //Return the selected state of the object.
322ca62e2c2SSteve Yin //when the object's anchor are in the selection cursor, we should return true.
GetSelectedState()323ca62e2c2SSteve Yin sal_Bool SwAccessibleFrameBase::GetSelectedState( )
324ca62e2c2SSteve Yin {
325ca62e2c2SSteve Yin vos::OGuard aGuard(Application::GetSolarMutex());
326ca62e2c2SSteve Yin
327ca62e2c2SSteve Yin if(GetMap()->IsDocumentSelAll())
328ca62e2c2SSteve Yin {
329ca62e2c2SSteve Yin return sal_True;
330ca62e2c2SSteve Yin }
331ca62e2c2SSteve Yin
332ca62e2c2SSteve Yin // SELETED.
333ca62e2c2SSteve Yin SwFlyFrm* pFlyFrm = getFlyFrm();
334ca62e2c2SSteve Yin const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
335ca62e2c2SSteve Yin const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
336ca62e2c2SSteve Yin const SwPosition *pPos = pAnchor.GetCntntAnchor();
337ca62e2c2SSteve Yin if( !pPos )
338ca62e2c2SSteve Yin return sal_False;
339ca62e2c2SSteve Yin int pIndex = pPos->nContent.GetIndex();
340ca62e2c2SSteve Yin if( pPos->nNode.GetNode().GetTxtNode() )
341ca62e2c2SSteve Yin {
342ca62e2c2SSteve Yin SwPaM* pCrsr = GetCrsr();
343ca62e2c2SSteve Yin if( pCrsr != NULL )
344ca62e2c2SSteve Yin {
345ca62e2c2SSteve Yin const SwTxtNode* pNode = pPos->nNode.GetNode().GetTxtNode();
346ca62e2c2SSteve Yin sal_uLong nHere = pNode->GetIndex();
347ca62e2c2SSteve Yin
348ca62e2c2SSteve Yin // iterate over ring
349ca62e2c2SSteve Yin SwPaM* pRingStart = pCrsr;
350ca62e2c2SSteve Yin do
351ca62e2c2SSteve Yin {
352ca62e2c2SSteve Yin // ignore, if no mark
353ca62e2c2SSteve Yin if( pCrsr->HasMark() )
354ca62e2c2SSteve Yin {
355ca62e2c2SSteve Yin // check whether nHere is 'inside' pCrsr
356ca62e2c2SSteve Yin SwPosition* pStart = pCrsr->Start();
357ca62e2c2SSteve Yin sal_uLong nStartIndex = pStart->nNode.GetIndex();
358ca62e2c2SSteve Yin SwPosition* pEnd = pCrsr->End();
359ca62e2c2SSteve Yin sal_uLong nEndIndex = pEnd->nNode.GetIndex();
360ca62e2c2SSteve Yin if( ( nHere >= nStartIndex ) && (nHere <= nEndIndex) )
361ca62e2c2SSteve Yin {
362ca62e2c2SSteve Yin if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
363ca62e2c2SSteve Yin {
364ca62e2c2SSteve Yin if( (nHere == nStartIndex) && (pIndex >= pStart->nContent.GetIndex()) || (nHere > nStartIndex) )
365ca62e2c2SSteve Yin if( (nHere == nEndIndex) && (pIndex < pEnd->nContent.GetIndex()) || (nHere < nEndIndex) )
366ca62e2c2SSteve Yin return sal_True;
367ca62e2c2SSteve Yin }
368ca62e2c2SSteve Yin else if( pAnchor.GetAnchorId() == FLY_AT_PARA )
369ca62e2c2SSteve Yin {
370ca62e2c2SSteve Yin if( ((nHere > nStartIndex) || pStart->nContent.GetIndex() ==0 )
371ca62e2c2SSteve Yin && (nHere < nEndIndex ) )
372ca62e2c2SSteve Yin return sal_True;
373ca62e2c2SSteve Yin }
374ca62e2c2SSteve Yin break;
375ca62e2c2SSteve Yin }
376ca62e2c2SSteve Yin // else: this PaM doesn't point to this paragraph
377ca62e2c2SSteve Yin }
378ca62e2c2SSteve Yin // else: this PaM is collapsed and doesn't select anything
379ca62e2c2SSteve Yin
380ca62e2c2SSteve Yin // next PaM in ring
381ca62e2c2SSteve Yin pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
382ca62e2c2SSteve Yin }
383ca62e2c2SSteve Yin while( pCrsr != pRingStart );
384ca62e2c2SSteve Yin }
385ca62e2c2SSteve Yin }
386ca62e2c2SSteve Yin return sal_False;
387ca62e2c2SSteve Yin }
388ca62e2c2SSteve Yin
getFlyFrm() const389ca62e2c2SSteve Yin SwFlyFrm* SwAccessibleFrameBase::getFlyFrm() const
390ca62e2c2SSteve Yin {
391ca62e2c2SSteve Yin SwFlyFrm* pFlyFrm = NULL;
392ca62e2c2SSteve Yin
393ca62e2c2SSteve Yin const SwFrm* pFrm = GetFrm();
394ca62e2c2SSteve Yin DBG_ASSERT( pFrm != NULL, "frame expected" );
395ca62e2c2SSteve Yin if( pFrm->IsFlyFrm() )
396ca62e2c2SSteve Yin {
397ca62e2c2SSteve Yin pFlyFrm = static_cast<SwFlyFrm*>( const_cast<SwFrm*>( pFrm ) );
398ca62e2c2SSteve Yin }
399ca62e2c2SSteve Yin
400ca62e2c2SSteve Yin return pFlyFrm;
401ca62e2c2SSteve Yin }
402ca62e2c2SSteve Yin
SetSelectedState(sal_Bool)403ca62e2c2SSteve Yin sal_Bool SwAccessibleFrameBase::SetSelectedState( sal_Bool )
404ca62e2c2SSteve Yin {
405ca62e2c2SSteve Yin sal_Bool bParaSeleted = GetSelectedState() || IsSelected();
406ca62e2c2SSteve Yin
407ca62e2c2SSteve Yin if(bIsSeletedInDoc != bParaSeleted)
408ca62e2c2SSteve Yin {
409ca62e2c2SSteve Yin bIsSeletedInDoc = bParaSeleted;
410ca62e2c2SSteve Yin FireStateChangedEvent( AccessibleStateType::SELECTED, bParaSeleted );
411ca62e2c2SSteve Yin return sal_True;
412ca62e2c2SSteve Yin }
413ca62e2c2SSteve Yin return sal_False;
414ca62e2c2SSteve Yin }
415