1efeef26fSAndrew Rist /**************************************************************
2efeef26fSAndrew Rist *
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 #include <accfrmobj.hxx>
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include <accmap.hxx>
30cdf0e10cSrcweir #include <acccontext.hxx>
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <viewsh.hxx>
33cdf0e10cSrcweir #include <rootfrm.hxx>
34cdf0e10cSrcweir #include <flyfrm.hxx>
35cdf0e10cSrcweir #include <pagefrm.hxx>
36cdf0e10cSrcweir #include <cellfrm.hxx>
37cdf0e10cSrcweir #include <swtable.hxx>
38cdf0e10cSrcweir #include <dflyobj.hxx>
39cdf0e10cSrcweir #include <frmfmt.hxx>
40cdf0e10cSrcweir #include <fmtanchr.hxx>
41cdf0e10cSrcweir #include <dcontact.hxx>
42cdf0e10cSrcweir
43*ca62e2c2SSteve Yin #include <pam.hxx>
44*ca62e2c2SSteve Yin
45cdf0e10cSrcweir #include <vcl/window.hxx>
46cdf0e10cSrcweir
47cdf0e10cSrcweir namespace css = ::com::sun::star;
48cdf0e10cSrcweir
49cdf0e10cSrcweir namespace sw { namespace access {
50cdf0e10cSrcweir
SwAccessibleChild()51cdf0e10cSrcweir SwAccessibleChild::SwAccessibleChild()
52cdf0e10cSrcweir : mpFrm( 0 )
53cdf0e10cSrcweir , mpDrawObj( 0 )
54cdf0e10cSrcweir , mpWindow( 0 )
55cdf0e10cSrcweir {}
56cdf0e10cSrcweir
SwAccessibleChild(const SdrObject * pDrawObj)57cdf0e10cSrcweir SwAccessibleChild::SwAccessibleChild( const SdrObject* pDrawObj )
58cdf0e10cSrcweir : mpFrm( 0 )
59cdf0e10cSrcweir , mpDrawObj( 0 )
60cdf0e10cSrcweir , mpWindow( 0 )
61cdf0e10cSrcweir {
62cdf0e10cSrcweir Init( pDrawObj );
63cdf0e10cSrcweir }
64cdf0e10cSrcweir
SwAccessibleChild(const SwFrm * pFrm)65cdf0e10cSrcweir SwAccessibleChild::SwAccessibleChild( const SwFrm* pFrm )
66cdf0e10cSrcweir : mpFrm( 0 )
67cdf0e10cSrcweir , mpDrawObj( 0 )
68cdf0e10cSrcweir , mpWindow( 0 )
69cdf0e10cSrcweir {
70cdf0e10cSrcweir Init( pFrm );
71cdf0e10cSrcweir }
72cdf0e10cSrcweir
SwAccessibleChild(Window * pWindow)73cdf0e10cSrcweir SwAccessibleChild::SwAccessibleChild( Window* pWindow )
74cdf0e10cSrcweir : mpFrm( 0 )
75cdf0e10cSrcweir , mpDrawObj( 0 )
76cdf0e10cSrcweir , mpWindow( 0 )
77cdf0e10cSrcweir {
78cdf0e10cSrcweir Init( pWindow );
79cdf0e10cSrcweir }
80cdf0e10cSrcweir
81cdf0e10cSrcweir
SwAccessibleChild(const SwFrm * pFrm,const SdrObject * pDrawObj,Window * pWindow)82cdf0e10cSrcweir SwAccessibleChild::SwAccessibleChild( const SwFrm* pFrm,
83cdf0e10cSrcweir const SdrObject* pDrawObj,
84cdf0e10cSrcweir Window* pWindow )
85cdf0e10cSrcweir {
86cdf0e10cSrcweir if ( pFrm )
87cdf0e10cSrcweir {
88cdf0e10cSrcweir Init( pFrm );
89cdf0e10cSrcweir }
90cdf0e10cSrcweir else if ( pDrawObj )
91cdf0e10cSrcweir {
92cdf0e10cSrcweir Init( pDrawObj );
93cdf0e10cSrcweir }
94cdf0e10cSrcweir else if ( pWindow )
95cdf0e10cSrcweir {
96cdf0e10cSrcweir Init( pWindow );
97cdf0e10cSrcweir }
98cdf0e10cSrcweir ASSERT( (!pFrm || pFrm == mpFrm) &&
99cdf0e10cSrcweir (!pDrawObj || pDrawObj == mpDrawObj) &&
100cdf0e10cSrcweir (!pWindow || pWindow == mpWindow),
101cdf0e10cSrcweir "invalid frame/object/window combination" );
102cdf0e10cSrcweir
103cdf0e10cSrcweir }
104cdf0e10cSrcweir
Init(const SdrObject * pDrawObj)105cdf0e10cSrcweir void SwAccessibleChild::Init( const SdrObject* pDrawObj )
106cdf0e10cSrcweir {
107cdf0e10cSrcweir mpDrawObj = pDrawObj;
108cdf0e10cSrcweir mpFrm = mpDrawObj && mpDrawObj->ISA(SwVirtFlyDrawObj)
109cdf0e10cSrcweir ? static_cast < const SwVirtFlyDrawObj * >( mpDrawObj )->GetFlyFrm()
110cdf0e10cSrcweir : 0;
111cdf0e10cSrcweir mpWindow = 0;
112cdf0e10cSrcweir }
113cdf0e10cSrcweir
Init(const SwFrm * pFrm)114cdf0e10cSrcweir void SwAccessibleChild::Init( const SwFrm* pFrm )
115cdf0e10cSrcweir {
116cdf0e10cSrcweir mpFrm = pFrm;
117cdf0e10cSrcweir mpDrawObj = mpFrm && mpFrm->IsFlyFrm()
118cdf0e10cSrcweir ? static_cast < const SwFlyFrm * >( mpFrm )->GetVirtDrawObj()
119cdf0e10cSrcweir : 0;
120cdf0e10cSrcweir mpWindow = 0;
121cdf0e10cSrcweir }
122cdf0e10cSrcweir
Init(Window * pWindow)123cdf0e10cSrcweir void SwAccessibleChild::Init( Window* pWindow )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir mpWindow = pWindow;
126cdf0e10cSrcweir mpFrm = 0;
127cdf0e10cSrcweir mpDrawObj = 0;
128cdf0e10cSrcweir }
129cdf0e10cSrcweir
IsAccessible(sal_Bool bPagePreview) const130cdf0e10cSrcweir bool SwAccessibleChild::IsAccessible( sal_Bool bPagePreview ) const
131cdf0e10cSrcweir {
132cdf0e10cSrcweir bool bRet( false );
133cdf0e10cSrcweir
134cdf0e10cSrcweir if ( mpFrm )
135cdf0e10cSrcweir {
136cdf0e10cSrcweir bRet = mpFrm->IsAccessibleFrm() &&
137cdf0e10cSrcweir ( !mpFrm->IsCellFrm() ||
138cdf0e10cSrcweir static_cast<const SwCellFrm *>( mpFrm )->GetTabBox()->GetSttNd() != 0 ) &&
139cdf0e10cSrcweir !mpFrm->IsInCoveredCell() &&
140cdf0e10cSrcweir ( bPagePreview ||
141cdf0e10cSrcweir !mpFrm->IsPageFrm() );
142cdf0e10cSrcweir }
143cdf0e10cSrcweir else if ( mpDrawObj )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir bRet = true;
146cdf0e10cSrcweir }
147cdf0e10cSrcweir else if ( mpWindow )
148cdf0e10cSrcweir {
149cdf0e10cSrcweir bRet = true;
150cdf0e10cSrcweir }
151cdf0e10cSrcweir
152cdf0e10cSrcweir return bRet;
153cdf0e10cSrcweir }
154cdf0e10cSrcweir
IsBoundAsChar() const155cdf0e10cSrcweir bool SwAccessibleChild::IsBoundAsChar() const
156cdf0e10cSrcweir {
157cdf0e10cSrcweir bool bRet( false );
158cdf0e10cSrcweir
159cdf0e10cSrcweir if ( mpFrm )
160cdf0e10cSrcweir {
161cdf0e10cSrcweir bRet = mpFrm->IsFlyFrm() &&
162cdf0e10cSrcweir static_cast< const SwFlyFrm *>(mpFrm)->IsFlyInCntFrm();
163cdf0e10cSrcweir }
164cdf0e10cSrcweir else if ( mpDrawObj )
165cdf0e10cSrcweir {
166cdf0e10cSrcweir const SwFrmFmt* mpFrmFmt = ::FindFrmFmt( mpDrawObj );
167cdf0e10cSrcweir bRet = mpFrmFmt
168cdf0e10cSrcweir ? (FLY_AS_CHAR == mpFrmFmt->GetAnchor().GetAnchorId())
169cdf0e10cSrcweir : false;
170cdf0e10cSrcweir }
171cdf0e10cSrcweir else if ( mpWindow )
172cdf0e10cSrcweir {
173cdf0e10cSrcweir bRet = false;
174cdf0e10cSrcweir }
175cdf0e10cSrcweir
176cdf0e10cSrcweir return bRet;
177cdf0e10cSrcweir }
178cdf0e10cSrcweir
GetAnchorPosition() const179*ca62e2c2SSteve Yin sal_uInt32 SwAccessibleChild::GetAnchorPosition() const
180*ca62e2c2SSteve Yin {
181*ca62e2c2SSteve Yin if( mpDrawObj )
182*ca62e2c2SSteve Yin {
183*ca62e2c2SSteve Yin const SwFrmFmt *pFrmFmt = ::FindFrmFmt( mpDrawObj );
184*ca62e2c2SSteve Yin if ( pFrmFmt )
185*ca62e2c2SSteve Yin {
186*ca62e2c2SSteve Yin const SwPosition *pPos = pFrmFmt->GetAnchor().GetCntntAnchor();
187*ca62e2c2SSteve Yin if ( pPos )
188*ca62e2c2SSteve Yin {
189*ca62e2c2SSteve Yin return pPos->nContent.GetIndex();
190*ca62e2c2SSteve Yin }
191*ca62e2c2SSteve Yin }
192*ca62e2c2SSteve Yin }
193*ca62e2c2SSteve Yin return 0;
194*ca62e2c2SSteve Yin }
195*ca62e2c2SSteve Yin
SwAccessibleChild(const SwAccessibleChild & r)196cdf0e10cSrcweir SwAccessibleChild::SwAccessibleChild( const SwAccessibleChild& r )
197cdf0e10cSrcweir : mpFrm( r.mpFrm )
198cdf0e10cSrcweir , mpDrawObj( r.mpDrawObj )
199cdf0e10cSrcweir , mpWindow( r.mpWindow )
200cdf0e10cSrcweir {}
201cdf0e10cSrcweir
operator =(const SwAccessibleChild & r)202cdf0e10cSrcweir SwAccessibleChild& SwAccessibleChild::operator=( const SwAccessibleChild& r )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir mpDrawObj = r.mpDrawObj;
205cdf0e10cSrcweir mpFrm = r.mpFrm;
206cdf0e10cSrcweir mpWindow = r.mpWindow;
207cdf0e10cSrcweir
208cdf0e10cSrcweir return *this;
209cdf0e10cSrcweir }
210cdf0e10cSrcweir
operator =(const SdrObject * pDrawObj)211cdf0e10cSrcweir SwAccessibleChild& SwAccessibleChild::operator=( const SdrObject* pDrawObj )
212cdf0e10cSrcweir {
213cdf0e10cSrcweir Init( pDrawObj );
214cdf0e10cSrcweir return *this;
215cdf0e10cSrcweir }
216cdf0e10cSrcweir
operator =(const SwFrm * pFrm)217cdf0e10cSrcweir SwAccessibleChild& SwAccessibleChild::operator=( const SwFrm* pFrm )
218cdf0e10cSrcweir {
219cdf0e10cSrcweir Init( pFrm );
220cdf0e10cSrcweir return *this;
221cdf0e10cSrcweir }
222cdf0e10cSrcweir
operator =(Window * pWindow)223cdf0e10cSrcweir SwAccessibleChild& SwAccessibleChild::operator=( Window* pWindow )
224cdf0e10cSrcweir {
225cdf0e10cSrcweir Init( pWindow );
226cdf0e10cSrcweir return *this;
227cdf0e10cSrcweir }
228cdf0e10cSrcweir
operator ==(const SwAccessibleChild & r) const229cdf0e10cSrcweir bool SwAccessibleChild::operator==( const SwAccessibleChild& r ) const
230cdf0e10cSrcweir {
231cdf0e10cSrcweir return mpFrm == r.mpFrm &&
232cdf0e10cSrcweir mpDrawObj == r.mpDrawObj &&
233cdf0e10cSrcweir mpWindow == r.mpWindow;
234cdf0e10cSrcweir }
235cdf0e10cSrcweir
IsValid() const236cdf0e10cSrcweir bool SwAccessibleChild::IsValid() const
237cdf0e10cSrcweir {
238cdf0e10cSrcweir return mpFrm != 0 ||
239cdf0e10cSrcweir mpDrawObj != 0 ||
240cdf0e10cSrcweir mpWindow != 0;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir
GetDrawObject() const243cdf0e10cSrcweir const SdrObject* SwAccessibleChild::GetDrawObject() const
244cdf0e10cSrcweir {
245cdf0e10cSrcweir return mpDrawObj;
246cdf0e10cSrcweir }
247cdf0e10cSrcweir
GetSwFrm() const248cdf0e10cSrcweir const SwFrm *SwAccessibleChild::GetSwFrm() const
249cdf0e10cSrcweir {
250cdf0e10cSrcweir return mpFrm;
251cdf0e10cSrcweir }
252cdf0e10cSrcweir
GetWindow() const253cdf0e10cSrcweir Window* SwAccessibleChild::GetWindow() const
254cdf0e10cSrcweir {
255cdf0e10cSrcweir return mpWindow;
256cdf0e10cSrcweir }
257cdf0e10cSrcweir
IsVisibleChildrenOnly() const258cdf0e10cSrcweir bool SwAccessibleChild::IsVisibleChildrenOnly() const
259cdf0e10cSrcweir {
260cdf0e10cSrcweir bool bRet( false );
261cdf0e10cSrcweir
262cdf0e10cSrcweir if ( !mpFrm )
263cdf0e10cSrcweir {
264cdf0e10cSrcweir bRet = true;
265cdf0e10cSrcweir }
266cdf0e10cSrcweir else
267cdf0e10cSrcweir {
268cdf0e10cSrcweir bRet = mpFrm->IsRootFrm() ||
269cdf0e10cSrcweir !( mpFrm->IsTabFrm() ||
270cdf0e10cSrcweir mpFrm->IsInTab() ||
271cdf0e10cSrcweir ( IsBoundAsChar() &&
272cdf0e10cSrcweir static_cast<const SwFlyFrm*>(mpFrm)->GetAnchorFrm()->IsInTab() ) );
273cdf0e10cSrcweir }
274cdf0e10cSrcweir
275cdf0e10cSrcweir return bRet;
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
GetBox(const SwAccessibleMap & rAccMap) const278cdf0e10cSrcweir SwRect SwAccessibleChild::GetBox( const SwAccessibleMap& rAccMap ) const
279cdf0e10cSrcweir {
280cdf0e10cSrcweir SwRect aBox;
281cdf0e10cSrcweir
282cdf0e10cSrcweir if ( mpFrm )
283cdf0e10cSrcweir {
284cdf0e10cSrcweir if ( mpFrm->IsPageFrm() &&
285cdf0e10cSrcweir static_cast< const SwPageFrm * >( mpFrm )->IsEmptyPage() )
286cdf0e10cSrcweir {
287cdf0e10cSrcweir aBox = SwRect( mpFrm->Frm().Left(), mpFrm->Frm().Top()-1, 1, 1 );
288cdf0e10cSrcweir }
289cdf0e10cSrcweir else if ( mpFrm->IsTabFrm() )
290cdf0e10cSrcweir {
291cdf0e10cSrcweir aBox = SwRect( mpFrm->Frm() );
292cdf0e10cSrcweir aBox.Intersection( mpFrm->GetUpper()->Frm() );
293cdf0e10cSrcweir }
294cdf0e10cSrcweir else
295cdf0e10cSrcweir {
296cdf0e10cSrcweir aBox = mpFrm->Frm();
297cdf0e10cSrcweir }
298cdf0e10cSrcweir }
299cdf0e10cSrcweir else if( mpDrawObj )
300cdf0e10cSrcweir {
301cdf0e10cSrcweir aBox = SwRect( mpDrawObj->GetCurrentBoundRect() );
302cdf0e10cSrcweir }
303cdf0e10cSrcweir else if ( mpWindow )
304cdf0e10cSrcweir {
305cdf0e10cSrcweir aBox = SwRect( rAccMap.GetShell()->GetWin()->PixelToLogic(
306cdf0e10cSrcweir Rectangle( mpWindow->GetPosPixel(),
307cdf0e10cSrcweir mpWindow->GetSizePixel() ) ) );
308cdf0e10cSrcweir }
309cdf0e10cSrcweir
310cdf0e10cSrcweir return aBox;
311cdf0e10cSrcweir }
312cdf0e10cSrcweir
GetBounds(const SwAccessibleMap & rAccMap) const313cdf0e10cSrcweir SwRect SwAccessibleChild::GetBounds( const SwAccessibleMap& rAccMap ) const
314cdf0e10cSrcweir {
315cdf0e10cSrcweir SwRect aBound;
316cdf0e10cSrcweir
317cdf0e10cSrcweir if( mpFrm )
318cdf0e10cSrcweir {
319cdf0e10cSrcweir if( mpFrm->IsPageFrm() &&
320cdf0e10cSrcweir static_cast< const SwPageFrm * >( mpFrm )->IsEmptyPage() )
321cdf0e10cSrcweir {
322cdf0e10cSrcweir aBound = SwRect( mpFrm->Frm().Left(), mpFrm->Frm().Top()-1, 0, 0 );
323cdf0e10cSrcweir }
324cdf0e10cSrcweir else
325cdf0e10cSrcweir aBound = mpFrm->PaintArea();
326cdf0e10cSrcweir }
327cdf0e10cSrcweir else if( mpDrawObj )
328cdf0e10cSrcweir {
329cdf0e10cSrcweir aBound = GetBox( rAccMap );
330cdf0e10cSrcweir }
331cdf0e10cSrcweir else if ( mpWindow )
332cdf0e10cSrcweir {
333cdf0e10cSrcweir aBound = GetBox( rAccMap );
334cdf0e10cSrcweir }
335cdf0e10cSrcweir
336cdf0e10cSrcweir return aBound;
337cdf0e10cSrcweir }
338cdf0e10cSrcweir
AlwaysIncludeAsChild() const339cdf0e10cSrcweir bool SwAccessibleChild::AlwaysIncludeAsChild() const
340cdf0e10cSrcweir {
341cdf0e10cSrcweir bool bAlwaysIncludedAsChild( false );
342cdf0e10cSrcweir
343cdf0e10cSrcweir if ( mpWindow )
344cdf0e10cSrcweir {
345cdf0e10cSrcweir bAlwaysIncludedAsChild = true;
346cdf0e10cSrcweir }
347cdf0e10cSrcweir
348cdf0e10cSrcweir return bAlwaysIncludedAsChild;
349cdf0e10cSrcweir }
350cdf0e10cSrcweir
GetParent(const sal_Bool bInPagePreview) const351cdf0e10cSrcweir const SwFrm* SwAccessibleChild::GetParent( const sal_Bool bInPagePreview ) const
352cdf0e10cSrcweir {
353cdf0e10cSrcweir const SwFrm* pParent( 0 );
354cdf0e10cSrcweir
355cdf0e10cSrcweir if ( mpFrm )
356cdf0e10cSrcweir {
357cdf0e10cSrcweir if( mpFrm->IsFlyFrm() )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir const SwFlyFrm* pFly = static_cast< const SwFlyFrm *>( mpFrm );
360cdf0e10cSrcweir if( pFly->IsFlyInCntFrm() )
361cdf0e10cSrcweir {
362cdf0e10cSrcweir // For FLY_AS_CHAR the parent is the anchor
363cdf0e10cSrcweir pParent = pFly->GetAnchorFrm();
364cdf0e10cSrcweir ASSERT( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ),
365cdf0e10cSrcweir "parent is not accessible" );
366cdf0e10cSrcweir }
367cdf0e10cSrcweir else
368cdf0e10cSrcweir {
369cdf0e10cSrcweir // In any other case the parent is the root frm
370cdf0e10cSrcweir // (in page preview, the page frame)
371cdf0e10cSrcweir if( bInPagePreview )
372cdf0e10cSrcweir pParent = pFly->FindPageFrm();
373cdf0e10cSrcweir else
374cdf0e10cSrcweir pParent = pFly->getRootFrm();
375cdf0e10cSrcweir }
376cdf0e10cSrcweir }
377cdf0e10cSrcweir else
378cdf0e10cSrcweir {
379cdf0e10cSrcweir SwAccessibleChild aUpper( mpFrm->GetUpper() );
380cdf0e10cSrcweir while( aUpper.GetSwFrm() && !aUpper.IsAccessible(bInPagePreview) )
381cdf0e10cSrcweir {
382cdf0e10cSrcweir aUpper = aUpper.GetSwFrm()->GetUpper();
383cdf0e10cSrcweir }
384cdf0e10cSrcweir pParent = aUpper.GetSwFrm();
385cdf0e10cSrcweir }
386cdf0e10cSrcweir }
387cdf0e10cSrcweir else if( mpDrawObj )
388cdf0e10cSrcweir {
389cdf0e10cSrcweir const SwDrawContact *pContact =
390cdf0e10cSrcweir static_cast< const SwDrawContact* >( GetUserCall( mpDrawObj ) );
391cdf0e10cSrcweir ASSERT( pContact, "sdr contact is missing" );
392cdf0e10cSrcweir if( pContact )
393cdf0e10cSrcweir {
394cdf0e10cSrcweir const SwFrmFmt *pFrmFmt = pContact->GetFmt();
395cdf0e10cSrcweir ASSERT( pFrmFmt, "frame format is missing" );
396cdf0e10cSrcweir if( pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() )
397cdf0e10cSrcweir {
398cdf0e10cSrcweir // For FLY_AS_CHAR the parent is the anchor
399cdf0e10cSrcweir pParent = pContact->GetAnchorFrm();
400cdf0e10cSrcweir ASSERT( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ),
401cdf0e10cSrcweir "parent is not accessible" );
402cdf0e10cSrcweir
403cdf0e10cSrcweir }
404cdf0e10cSrcweir else
405cdf0e10cSrcweir {
406cdf0e10cSrcweir // In any other case the parent is the root frm
407cdf0e10cSrcweir if( bInPagePreview )
408cdf0e10cSrcweir pParent = pContact->GetAnchorFrm()->FindPageFrm();
409cdf0e10cSrcweir else
410cdf0e10cSrcweir pParent = pContact->GetAnchorFrm()->getRootFrm();
411cdf0e10cSrcweir }
412cdf0e10cSrcweir }
413cdf0e10cSrcweir }
414cdf0e10cSrcweir else if ( mpWindow )
415cdf0e10cSrcweir {
416cdf0e10cSrcweir css::uno::Reference < css::accessibility::XAccessible > xAcc =
417cdf0e10cSrcweir mpWindow->GetAccessible();
418cdf0e10cSrcweir if ( xAcc.is() )
419cdf0e10cSrcweir {
420cdf0e10cSrcweir css::uno::Reference < css::accessibility::XAccessibleContext > xAccContext =
421cdf0e10cSrcweir xAcc->getAccessibleContext();
422cdf0e10cSrcweir if ( xAccContext.is() )
423cdf0e10cSrcweir {
424cdf0e10cSrcweir css::uno::Reference < css::accessibility::XAccessible > xAccParent =
425cdf0e10cSrcweir xAccContext->getAccessibleParent();
426cdf0e10cSrcweir if ( xAccParent.is() )
427cdf0e10cSrcweir {
428cdf0e10cSrcweir SwAccessibleContext* pAccParentImpl =
429cdf0e10cSrcweir dynamic_cast< SwAccessibleContext *>( xAccParent.get() );
430cdf0e10cSrcweir if ( pAccParentImpl )
431cdf0e10cSrcweir {
432cdf0e10cSrcweir pParent = pAccParentImpl->GetFrm();
433cdf0e10cSrcweir }
434cdf0e10cSrcweir }
435cdf0e10cSrcweir }
436cdf0e10cSrcweir }
437cdf0e10cSrcweir }
438cdf0e10cSrcweir
439cdf0e10cSrcweir return pParent;
440cdf0e10cSrcweir }
441cdf0e10cSrcweir
442cdf0e10cSrcweir } } // eof of namespace sw::access
443cdf0e10cSrcweir
444