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 <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
45*ca62e2c2SSteve Yin #ifndef _CRSRSH_HXX
46*ca62e2c2SSteve Yin #include <crsrsh.hxx>
47*ca62e2c2SSteve Yin #endif
48*ca62e2c2SSteve Yin #ifndef _FESH_HXX
49*ca62e2c2SSteve Yin #include "fesh.hxx"
50*ca62e2c2SSteve Yin #endif
51*ca62e2c2SSteve Yin #ifndef _TXTFRM_HXX
52*ca62e2c2SSteve Yin #include <txtfrm.hxx>
53*ca62e2c2SSteve Yin #endif
54*ca62e2c2SSteve Yin #ifndef _NDTXT_HXX
55*ca62e2c2SSteve Yin #include <ndtxt.hxx>
56*ca62e2c2SSteve Yin #endif
57*ca62e2c2SSteve Yin #ifndef _DCONTACT_HXX
58*ca62e2c2SSteve Yin #include <dcontact.hxx>
59*ca62e2c2SSteve Yin #endif
60*ca62e2c2SSteve Yin #ifndef _FMTANCHR_HXX
61*ca62e2c2SSteve Yin #include <fmtanchr.hxx>
62*ca62e2c2SSteve 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 }
114*ca62e2c2SSteve Yin if( GetSelectedState() )
115*ca62e2c2SSteve 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
179cdf0e10cSrcweir // neccessary 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 );
189*ca62e2c2SSteve Yin //FireStateChangedEvent( AccessibleStateType::SELECTED, bNewSelected );
190cdf0e10cSrcweir if( pWin && pWin->HasFocus() && !bNewSelected )
191cdf0e10cSrcweir FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected );
192*ca62e2c2SSteve Yin if(bNewSelected)
193*ca62e2c2SSteve Yin {
194cdf0e10cSrcweir uno::Reference< XAccessible > xParent( GetWeakParent() );
195cdf0e10cSrcweir if( xParent.is() )
196cdf0e10cSrcweir {
197cdf0e10cSrcweir SwAccessibleContext *pAcc =
198cdf0e10cSrcweir static_cast <SwAccessibleContext *>( xParent.get() );
199cdf0e10cSrcweir
200cdf0e10cSrcweir AccessibleEventObject aEvent;
201cdf0e10cSrcweir aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
202*ca62e2c2SSteve Yin uno::Reference< XAccessible > xChild(this);
203*ca62e2c2SSteve Yin aEvent.NewValue <<= xChild;
204cdf0e10cSrcweir pAcc->FireAccessibleEvent( aEvent );
205cdf0e10cSrcweir }
206cdf0e10cSrcweir }
207*ca62e2c2SSteve Yin }
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
274*ca62e2c2SSteve 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:
279*ca62e2c2SSteve Yin if( pOld &&
280*ca62e2c2SSteve 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 }
300*ca62e2c2SSteve Yin //Get the selection cursor of the document.
GetCrsr()301*ca62e2c2SSteve Yin SwPaM* SwAccessibleFrameBase::GetCrsr()
302*ca62e2c2SSteve Yin {
303*ca62e2c2SSteve Yin // get the cursor shell; if we don't have any, we don't have a
304*ca62e2c2SSteve Yin // cursor/selection either
305*ca62e2c2SSteve Yin SwPaM* pCrsr = NULL;
306*ca62e2c2SSteve Yin SwCrsrShell* pCrsrShell = GetCrsrShell();
307*ca62e2c2SSteve Yin if( pCrsrShell != NULL && !pCrsrShell->IsTableMode() )
308*ca62e2c2SSteve Yin {
309*ca62e2c2SSteve Yin SwFEShell *pFESh = pCrsrShell->ISA( SwFEShell )
310*ca62e2c2SSteve Yin ? static_cast< SwFEShell * >( pCrsrShell ) : 0;
311*ca62e2c2SSteve Yin if( !pFESh ||
312*ca62e2c2SSteve Yin !(pFESh->IsFrmSelected() || pFESh->IsObjSelected() > 0) )
313*ca62e2c2SSteve Yin {
314*ca62e2c2SSteve Yin // get the selection, and test whether it affects our text node
315*ca62e2c2SSteve Yin pCrsr = pCrsrShell->GetCrsr( sal_False /* ??? */ );
316*ca62e2c2SSteve Yin }
317*ca62e2c2SSteve Yin }
318*ca62e2c2SSteve Yin
319*ca62e2c2SSteve Yin return pCrsr;
320*ca62e2c2SSteve Yin }
321*ca62e2c2SSteve Yin //Return the selected state of the object.
322*ca62e2c2SSteve Yin //when the object's anchor are in the selection cursor, we should return true.
GetSelectedState()323*ca62e2c2SSteve Yin sal_Bool SwAccessibleFrameBase::GetSelectedState( )
324*ca62e2c2SSteve Yin {
325*ca62e2c2SSteve Yin vos::OGuard aGuard(Application::GetSolarMutex());
326*ca62e2c2SSteve Yin
327*ca62e2c2SSteve Yin if(GetMap()->IsDocumentSelAll())
328*ca62e2c2SSteve Yin {
329*ca62e2c2SSteve Yin return sal_True;
330*ca62e2c2SSteve Yin }
331*ca62e2c2SSteve Yin
332*ca62e2c2SSteve Yin // SELETED.
333*ca62e2c2SSteve Yin SwFlyFrm* pFlyFrm = getFlyFrm();
334*ca62e2c2SSteve Yin const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
335*ca62e2c2SSteve Yin const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
336*ca62e2c2SSteve Yin const SwPosition *pPos = pAnchor.GetCntntAnchor();
337*ca62e2c2SSteve Yin if( !pPos )
338*ca62e2c2SSteve Yin return sal_False;
339*ca62e2c2SSteve Yin int pIndex = pPos->nContent.GetIndex();
340*ca62e2c2SSteve Yin if( pPos->nNode.GetNode().GetTxtNode() )
341*ca62e2c2SSteve Yin {
342*ca62e2c2SSteve Yin SwPaM* pCrsr = GetCrsr();
343*ca62e2c2SSteve Yin if( pCrsr != NULL )
344*ca62e2c2SSteve Yin {
345*ca62e2c2SSteve Yin const SwTxtNode* pNode = pPos->nNode.GetNode().GetTxtNode();
346*ca62e2c2SSteve Yin sal_uLong nHere = pNode->GetIndex();
347*ca62e2c2SSteve Yin
348*ca62e2c2SSteve Yin // iterate over ring
349*ca62e2c2SSteve Yin SwPaM* pRingStart = pCrsr;
350*ca62e2c2SSteve Yin do
351*ca62e2c2SSteve Yin {
352*ca62e2c2SSteve Yin // ignore, if no mark
353*ca62e2c2SSteve Yin if( pCrsr->HasMark() )
354*ca62e2c2SSteve Yin {
355*ca62e2c2SSteve Yin // check whether nHere is 'inside' pCrsr
356*ca62e2c2SSteve Yin SwPosition* pStart = pCrsr->Start();
357*ca62e2c2SSteve Yin sal_uLong nStartIndex = pStart->nNode.GetIndex();
358*ca62e2c2SSteve Yin SwPosition* pEnd = pCrsr->End();
359*ca62e2c2SSteve Yin sal_uLong nEndIndex = pEnd->nNode.GetIndex();
360*ca62e2c2SSteve Yin if( ( nHere >= nStartIndex ) && (nHere <= nEndIndex) )
361*ca62e2c2SSteve Yin {
362*ca62e2c2SSteve Yin if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
363*ca62e2c2SSteve Yin {
364*ca62e2c2SSteve Yin if( (nHere == nStartIndex) && (pIndex >= pStart->nContent.GetIndex()) || (nHere > nStartIndex) )
365*ca62e2c2SSteve Yin if( (nHere == nEndIndex) && (pIndex < pEnd->nContent.GetIndex()) || (nHere < nEndIndex) )
366*ca62e2c2SSteve Yin return sal_True;
367*ca62e2c2SSteve Yin }
368*ca62e2c2SSteve Yin else if( pAnchor.GetAnchorId() == FLY_AT_PARA )
369*ca62e2c2SSteve Yin {
370*ca62e2c2SSteve Yin if( ((nHere > nStartIndex) || pStart->nContent.GetIndex() ==0 )
371*ca62e2c2SSteve Yin && (nHere < nEndIndex ) )
372*ca62e2c2SSteve Yin return sal_True;
373*ca62e2c2SSteve Yin }
374*ca62e2c2SSteve Yin break;
375*ca62e2c2SSteve Yin }
376*ca62e2c2SSteve Yin // else: this PaM doesn't point to this paragraph
377*ca62e2c2SSteve Yin }
378*ca62e2c2SSteve Yin // else: this PaM is collapsed and doesn't select anything
379*ca62e2c2SSteve Yin
380*ca62e2c2SSteve Yin // next PaM in ring
381*ca62e2c2SSteve Yin pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
382*ca62e2c2SSteve Yin }
383*ca62e2c2SSteve Yin while( pCrsr != pRingStart );
384*ca62e2c2SSteve Yin }
385*ca62e2c2SSteve Yin }
386*ca62e2c2SSteve Yin return sal_False;
387*ca62e2c2SSteve Yin }
388*ca62e2c2SSteve Yin
getFlyFrm() const389*ca62e2c2SSteve Yin SwFlyFrm* SwAccessibleFrameBase::getFlyFrm() const
390*ca62e2c2SSteve Yin {
391*ca62e2c2SSteve Yin SwFlyFrm* pFlyFrm = NULL;
392*ca62e2c2SSteve Yin
393*ca62e2c2SSteve Yin const SwFrm* pFrm = GetFrm();
394*ca62e2c2SSteve Yin DBG_ASSERT( pFrm != NULL, "frame expected" );
395*ca62e2c2SSteve Yin if( pFrm->IsFlyFrm() )
396*ca62e2c2SSteve Yin {
397*ca62e2c2SSteve Yin pFlyFrm = static_cast<SwFlyFrm*>( const_cast<SwFrm*>( pFrm ) );
398*ca62e2c2SSteve Yin }
399*ca62e2c2SSteve Yin
400*ca62e2c2SSteve Yin return pFlyFrm;
401*ca62e2c2SSteve Yin }
402*ca62e2c2SSteve Yin
SetSelectedState(sal_Bool)403*ca62e2c2SSteve Yin sal_Bool SwAccessibleFrameBase::SetSelectedState( sal_Bool )
404*ca62e2c2SSteve Yin {
405*ca62e2c2SSteve Yin sal_Bool bParaSeleted = GetSelectedState() || IsSelected();
406*ca62e2c2SSteve Yin
407*ca62e2c2SSteve Yin if(bIsSeletedInDoc != bParaSeleted)
408*ca62e2c2SSteve Yin {
409*ca62e2c2SSteve Yin bIsSeletedInDoc = bParaSeleted;
410*ca62e2c2SSteve Yin FireStateChangedEvent( AccessibleStateType::SELECTED, bParaSeleted );
411*ca62e2c2SSteve Yin return sal_True;
412*ca62e2c2SSteve Yin }
413*ca62e2c2SSteve Yin return sal_False;
414*ca62e2c2SSteve Yin }
415