Update ooo320-m1
[ooovba.git] / svx / source / unoedit / unoedprx.cxx
blob2b500aeac6429c7854eacafcff31ef6283cdb664
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoedprx.cxx,v $
10 * $Revision: 1.22 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 //------------------------------------------------------------------------
36 // Global header
38 //------------------------------------------------------------------------
40 #include <limits.h>
41 #include <vector>
42 #include <algorithm>
43 #include <vos/mutex.hxx>
44 #include <vcl/window.hxx>
45 #include <vcl/svapp.hxx>
46 #include <com/sun/star/uno/Any.hxx>
47 #include <com/sun/star/uno/Reference.hxx>
49 //------------------------------------------------------------------------
51 // Project-local header
53 //------------------------------------------------------------------------
54 #include "unoedprx.hxx"
55 #include <svx/unotext.hxx>
57 #include "unoedhlp.hxx"
58 #include <svx/svdmodel.hxx>
59 #include <svx/svdpntv.hxx>
60 #include <svx/editdata.hxx>
61 #include <svx/editeng.hxx>
62 #include <svx/editview.hxx>
63 #include "AccessibleStringWrap.hxx"
65 using namespace ::com::sun::star;
68 class SvxAccessibleTextIndex
70 public:
71 SvxAccessibleTextIndex() :
72 mnPara(0),
73 mnIndex(0),
74 mnEEIndex(0),
75 mnFieldOffset(0),
76 mnFieldLen(0),
77 mbInField(sal_False),
78 mnBulletOffset(0),
79 mnBulletLen(0),
80 mbInBullet(sal_False) {};
81 ~SvxAccessibleTextIndex() {};
83 // Get/Set current paragraph
84 void SetParagraph( USHORT nPara )
86 mnPara = nPara;
88 USHORT GetParagraph() const { return mnPara; }
90 /** Set the index in the UAA semantic
92 @param nIndex
93 The index from the UA API (fields and bullets are expanded)
95 @param rTF
96 The text forwarder to use in the calculations
98 void SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF );
99 void SetIndex( USHORT nPara, sal_Int32 nIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetIndex(nIndex, rTF); }
100 sal_Int32 GetIndex() const { return mnIndex; }
102 /** Set the index in the edit engine semantic
104 Update the object state to reflect the given index position in
105 EditEngine/Outliner index values
107 @param nEEIndex
108 The index from the edit engine (fields span exactly one index increment)
110 @param rTF
111 The text forwarder to use in the calculations
113 void SetEEIndex( USHORT nEEIndex, const SvxTextForwarder& rTF );
114 void SetEEIndex( USHORT nPara, USHORT nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); }
115 USHORT GetEEIndex() const;
117 void SetFieldOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnFieldOffset = nOffset; mnFieldLen = nLen; }
118 sal_Int32 GetFieldOffset() const { return mnFieldOffset; }
119 sal_Int32 GetFieldLen() const { return mnFieldLen; }
120 void AreInField( sal_Bool bInField = sal_True ) { mbInField = bInField; }
121 sal_Bool InField() const { return mbInField; }
123 void SetBulletOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnBulletOffset = nOffset; mnBulletLen = nLen; }
124 sal_Int32 GetBulletOffset() const { return mnBulletOffset; }
125 sal_Int32 GetBulletLen() const { return mnBulletLen; }
126 void AreInBullet( sal_Bool bInBullet = sal_True ) { mbInBullet = bInBullet; }
127 sal_Bool InBullet() const { return mbInBullet; }
129 /// returns false if the current index contains non-editable text (e.g. bullets)
130 sal_Bool IsEditable() const;
132 /// returns false if the given range is non-editable (e.g. contains bullets or _parts_ of fields)
133 sal_Bool IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const;
135 private:
136 USHORT mnPara;
137 sal_Int32 mnIndex;
138 sal_Int32 mnEEIndex;
139 sal_Int32 mnFieldOffset;
140 sal_Int32 mnFieldLen;
141 sal_Bool mbInField;
142 sal_Int32 mnBulletOffset;
143 sal_Int32 mnBulletLen;
144 sal_Bool mbInBullet;
147 ESelection MakeEESelection( const SvxAccessibleTextIndex& rStart, const SvxAccessibleTextIndex& rEnd )
149 // deal with field special case: to really get a field contained
150 // within a selection, the start index must be before or on the
151 // field, the end index after it.
153 // The SvxAccessibleTextIndex.GetEEIndex method gives the index on
154 // the field, as long the input index is on the field. Thus,
155 // correction necessary for the end index
157 // Therefore, for _ranges_, if part of the field is touched, all
158 // of the field must be selected
159 if( rStart.GetParagraph() <= rEnd.GetParagraph() ||
160 (rStart.GetParagraph() == rEnd.GetParagraph() &&
161 rStart.GetEEIndex() <= rEnd.GetEEIndex()) )
163 if( rEnd.InField() && rEnd.GetFieldOffset() )
164 return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
165 rEnd.GetParagraph(), rEnd.GetEEIndex()+1 );
167 else if( rStart.GetParagraph() > rEnd.GetParagraph() ||
168 (rStart.GetParagraph() == rEnd.GetParagraph() &&
169 rStart.GetEEIndex() > rEnd.GetEEIndex()) )
171 if( rStart.InField() && rStart.GetFieldOffset() )
172 return ESelection( rStart.GetParagraph(), rStart.GetEEIndex()+1,
173 rEnd.GetParagraph(), rEnd.GetEEIndex() );
176 return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
177 rEnd.GetParagraph(), rEnd.GetEEIndex() );
180 ESelection MakeEESelection( const SvxAccessibleTextIndex& rIndex )
182 return ESelection( rIndex.GetParagraph(), rIndex.GetEEIndex(),
183 rIndex.GetParagraph(), rIndex.GetEEIndex() + 1 );
186 USHORT SvxAccessibleTextIndex::GetEEIndex() const
188 DBG_ASSERT(mnEEIndex >= 0 && mnEEIndex <= USHRT_MAX,
189 "SvxAccessibleTextIndex::GetEEIndex: index value overflow");
191 return static_cast< USHORT > (mnEEIndex);
194 void SvxAccessibleTextIndex::SetEEIndex( USHORT nEEIndex, const SvxTextForwarder& rTF )
196 // reset
197 mnFieldOffset = 0;
198 mbInField = sal_False;
199 mnFieldLen = 0;
200 mnBulletOffset = 0;
201 mbInBullet = sal_False;
202 mnBulletLen = 0;
204 // set known values
205 mnEEIndex = nEEIndex;
207 // calculate unknowns
208 USHORT nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
210 mnIndex = nEEIndex;
212 EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
214 // any text bullets?
215 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
216 aBulletInfo.bVisible &&
217 aBulletInfo.nType != SVX_NUM_BITMAP )
219 mnIndex += aBulletInfo.aText.Len();
222 for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
224 EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
226 if( aFieldInfo.aPosition.nIndex > nEEIndex )
227 break;
229 if( aFieldInfo.aPosition.nIndex == nEEIndex )
231 AreInField();
232 break;
235 // #106010#
236 mnIndex += ::std::max(aFieldInfo.aCurrentText.Len()-1, 0);
240 void SvxAccessibleTextIndex::SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF )
242 // reset
243 mnFieldOffset = 0;
244 mbInField = sal_False;
245 mnFieldLen = 0;
246 mnBulletOffset = 0;
247 mbInBullet = sal_False;
248 mnBulletLen = 0;
250 // set known values
251 mnIndex = nIndex;
253 // calculate unknowns
254 USHORT nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
256 DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX,
257 "SvxAccessibleTextIndex::SetIndex: index value overflow");
259 mnEEIndex = nIndex;
261 EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
263 // any text bullets?
264 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
265 aBulletInfo.bVisible &&
266 aBulletInfo.nType != SVX_NUM_BITMAP )
268 sal_Int32 nBulletLen = aBulletInfo.aText.Len();
270 if( nIndex < nBulletLen )
272 AreInBullet();
273 SetBulletOffset( nIndex, nBulletLen );
274 mnEEIndex = 0;
275 return;
278 mnEEIndex = mnEEIndex - nBulletLen;
281 for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
283 EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
285 // we're before a field
286 if( aFieldInfo.aPosition.nIndex > mnEEIndex )
287 break;
289 // #106010#
290 mnEEIndex -= ::std::max(aFieldInfo.aCurrentText.Len()-1, 0);
292 // we're within a field
293 if( aFieldInfo.aPosition.nIndex >= mnEEIndex )
295 AreInField();
296 SetFieldOffset( ::std::max(aFieldInfo.aCurrentText.Len()-1, 0) - (aFieldInfo.aPosition.nIndex - mnEEIndex),
297 aFieldInfo.aCurrentText.Len() );
298 mnEEIndex = aFieldInfo.aPosition.nIndex ;
299 break;
304 sal_Bool SvxAccessibleTextIndex::IsEditable() const
306 if( InBullet() || InField() )
307 return sal_False;
309 return sal_True;
312 sal_Bool SvxAccessibleTextIndex::IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const
314 if( GetIndex() > rEnd.GetIndex() )
315 return rEnd.IsEditableRange( *this );
317 if( InBullet() || rEnd.InBullet() )
318 return sal_False;
320 if( InField() && GetFieldOffset() )
321 return sal_False; // within field
323 if( rEnd.InField() && rEnd.GetFieldOffset() >= rEnd.GetFieldLen() - 1 )
324 return sal_False; // within field
326 return sal_True;
329 //---------------------------------------------------------------------------------
331 SvxEditSourceAdapter::SvxEditSourceAdapter() : mbEditSourceValid( sal_False )
335 SvxEditSourceAdapter::~SvxEditSourceAdapter()
339 SvxEditSource* SvxEditSourceAdapter::Clone() const
341 if( mbEditSourceValid && mpAdaptee.get() )
343 ::std::auto_ptr< SvxEditSource > pClonedAdaptee( mpAdaptee->Clone() );
345 if( pClonedAdaptee.get() )
347 SvxEditSourceAdapter* pClone = new SvxEditSourceAdapter();
349 if( pClone )
351 pClone->SetEditSource( pClonedAdaptee );
352 return pClone;
357 return NULL;
360 SvxAccessibleTextAdapter* SvxEditSourceAdapter::GetTextForwarderAdapter()
362 if( mbEditSourceValid && mpAdaptee.get() )
364 SvxTextForwarder* pTextForwarder = mpAdaptee->GetTextForwarder();
366 if( pTextForwarder )
368 maTextAdapter.SetForwarder(*pTextForwarder);
370 return &maTextAdapter;
374 return NULL;
377 SvxTextForwarder* SvxEditSourceAdapter::GetTextForwarder()
379 return GetTextForwarderAdapter();
382 SvxViewForwarder* SvxEditSourceAdapter::GetViewForwarder()
384 if( mbEditSourceValid && mpAdaptee.get() )
385 return mpAdaptee->GetViewForwarder();
387 return NULL;
390 SvxAccessibleTextEditViewAdapter* SvxEditSourceAdapter::GetEditViewForwarderAdapter( sal_Bool bCreate )
392 if( mbEditSourceValid && mpAdaptee.get() )
394 SvxEditViewForwarder* pEditViewForwarder = mpAdaptee->GetEditViewForwarder(bCreate);
396 if( pEditViewForwarder )
398 SvxAccessibleTextAdapter* pTextAdapter = GetTextForwarderAdapter();
400 if( pTextAdapter )
402 maEditViewAdapter.SetForwarder(*pEditViewForwarder, *pTextAdapter);
404 return &maEditViewAdapter;
409 return NULL;
412 SvxEditViewForwarder* SvxEditSourceAdapter::GetEditViewForwarder( sal_Bool bCreate )
414 return GetEditViewForwarderAdapter( bCreate );
417 void SvxEditSourceAdapter::UpdateData()
419 if( mbEditSourceValid && mpAdaptee.get() )
420 mpAdaptee->UpdateData();
423 SfxBroadcaster& SvxEditSourceAdapter::GetBroadcaster() const
425 if( mbEditSourceValid && mpAdaptee.get() )
426 return mpAdaptee->GetBroadcaster();
428 return maDummyBroadcaster;
431 void SvxEditSourceAdapter::SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee )
433 if( pAdaptee.get() )
435 mpAdaptee = pAdaptee;
436 mbEditSourceValid = sal_True;
438 else
440 // do a lazy delete (prevents us from deleting the broadcaster
441 // from within a broadcast in
442 // AccessibleTextHelper_Impl::Notify)
443 mbEditSourceValid = sal_False;
447 sal_Bool SvxEditSourceAdapter::IsValid() const
449 return mbEditSourceValid;
453 //--------------------------------------------------------------------------------------
455 SvxAccessibleTextAdapter::SvxAccessibleTextAdapter() : mrTextForwarder( NULL )
459 SvxAccessibleTextAdapter::~SvxAccessibleTextAdapter()
463 USHORT SvxAccessibleTextAdapter::GetParagraphCount() const
465 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
467 return mrTextForwarder->GetParagraphCount();
470 USHORT SvxAccessibleTextAdapter::GetTextLen( USHORT nParagraph ) const
472 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
474 SvxAccessibleTextIndex aIndex;
475 aIndex.SetEEIndex( nParagraph, mrTextForwarder->GetTextLen( nParagraph ), *this );
477 return static_cast< USHORT >(aIndex.GetIndex());
480 String SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
482 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
484 SvxAccessibleTextIndex aStartIndex;
485 SvxAccessibleTextIndex aEndIndex;
487 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
488 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
490 // normalize selection
491 if( rSel.nStartPara > rSel.nEndPara ||
492 (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
494 ::std::swap( aStartIndex, aEndIndex );
497 String sStr = mrTextForwarder->GetText( MakeEESelection(aStartIndex, aEndIndex) );
499 // trim field text, if necessary
500 if( aStartIndex.InField() )
502 DBG_ASSERT(aStartIndex.GetFieldOffset() >= 0 &&
503 aStartIndex.GetFieldOffset() <= USHRT_MAX,
504 "SvxAccessibleTextIndex::GetText: index value overflow");
506 sStr.Erase(0, static_cast< USHORT > (aStartIndex.GetFieldOffset()) );
508 if( aEndIndex.InField() && aEndIndex.GetFieldOffset() )
510 DBG_ASSERT(sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) >= 0 &&
511 sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) <= USHRT_MAX,
512 "SvxAccessibleTextIndex::GetText: index value overflow");
514 sStr = sStr.Copy(0, static_cast< USHORT > (sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset())) );
517 EBulletInfo aBulletInfo1 = GetBulletInfo( static_cast< USHORT >(aStartIndex.GetParagraph()) );
518 EBulletInfo aBulletInfo2 = GetBulletInfo( static_cast< USHORT >(aEndIndex.GetParagraph()) );
520 if( aStartIndex.InBullet() )
522 // prepend leading bullet
523 String sBullet = aBulletInfo1.aText;
525 DBG_ASSERT(aStartIndex.GetBulletOffset() >= 0 &&
526 aStartIndex.GetBulletOffset() <= USHRT_MAX,
527 "SvxAccessibleTextIndex::GetText: index value overflow");
529 sBullet.Erase(0, static_cast< USHORT > (aStartIndex.GetBulletOffset()) );
531 sBullet += sStr;
532 sStr = sBullet;
535 if( aEndIndex.InBullet() )
537 // append trailing bullet
538 sStr += aBulletInfo2.aText;;
540 DBG_ASSERT(sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
541 sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
542 "SvxAccessibleTextIndex::GetText: index value overflow");
544 sStr = sStr.Copy(0, static_cast< USHORT > (sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) );
546 else if( aStartIndex.GetParagraph() != aEndIndex.GetParagraph() &&
547 HaveTextBullet( aEndIndex.GetParagraph() ) )
549 String sBullet = aBulletInfo2.aText;
551 DBG_ASSERT(sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
552 sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
553 "SvxAccessibleTextIndex::GetText: index value overflow");
555 sBullet = sBullet.Copy(0, static_cast< USHORT > (sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) );
557 // insert bullet
558 sStr.Insert( sBullet,
559 static_cast< USHORT > (GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex()) );
562 return sStr;
565 SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib ) const
567 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
569 SvxAccessibleTextIndex aStartIndex;
570 SvxAccessibleTextIndex aEndIndex;
572 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
573 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
575 return mrTextForwarder->GetAttribs( MakeEESelection(aStartIndex, aEndIndex),
576 bOnlyHardAttrib );
579 SfxItemSet SvxAccessibleTextAdapter::GetParaAttribs( USHORT nPara ) const
581 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
583 return mrTextForwarder->GetParaAttribs( nPara );
586 void SvxAccessibleTextAdapter::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet )
588 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
590 mrTextForwarder->SetParaAttribs( nPara, rSet );
593 void SvxAccessibleTextAdapter::RemoveAttribs( const ESelection& , sal_Bool , sal_uInt16 )
595 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
598 void SvxAccessibleTextAdapter::GetPortions( USHORT nPara, SvUShorts& rList ) const
600 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
602 mrTextForwarder->GetPortions( nPara, rList );
605 USHORT SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, USHORT nWhich ) const
607 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
609 SvxAccessibleTextIndex aStartIndex;
610 SvxAccessibleTextIndex aEndIndex;
612 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
613 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
615 return mrTextForwarder->GetItemState( MakeEESelection(aStartIndex, aEndIndex),
616 nWhich );
619 USHORT SvxAccessibleTextAdapter::GetItemState( USHORT nPara, USHORT nWhich ) const
621 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
623 return mrTextForwarder->GetItemState( nPara, nWhich );
626 void SvxAccessibleTextAdapter::QuickInsertText( const String& rText, const ESelection& rSel )
628 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
630 SvxAccessibleTextIndex aStartIndex;
631 SvxAccessibleTextIndex aEndIndex;
633 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
634 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
636 mrTextForwarder->QuickInsertText( rText,
637 MakeEESelection(aStartIndex, aEndIndex) );
640 void SvxAccessibleTextAdapter::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
642 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
644 SvxAccessibleTextIndex aStartIndex;
645 SvxAccessibleTextIndex aEndIndex;
647 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
648 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
650 mrTextForwarder->QuickInsertField( rFld,
651 MakeEESelection(aStartIndex, aEndIndex) );
654 void SvxAccessibleTextAdapter::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
656 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
658 SvxAccessibleTextIndex aStartIndex;
659 SvxAccessibleTextIndex aEndIndex;
661 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
662 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
664 mrTextForwarder->QuickSetAttribs( rSet,
665 MakeEESelection(aStartIndex, aEndIndex) );
668 void SvxAccessibleTextAdapter::QuickInsertLineBreak( const ESelection& rSel )
670 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
672 SvxAccessibleTextIndex aStartIndex;
673 SvxAccessibleTextIndex aEndIndex;
675 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
676 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
678 mrTextForwarder->QuickInsertLineBreak( MakeEESelection(aStartIndex, aEndIndex) );
681 SfxItemPool* SvxAccessibleTextAdapter::GetPool() const
683 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
685 return mrTextForwarder->GetPool();
688 XubString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor )
690 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
692 return mrTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
695 BOOL SvxAccessibleTextAdapter::IsValid() const
697 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
699 if( mrTextForwarder )
700 return mrTextForwarder->IsValid();
701 else
702 return sal_False;
705 LanguageType SvxAccessibleTextAdapter::GetLanguage( USHORT nPara, USHORT nPos ) const
707 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
709 SvxAccessibleTextIndex aIndex;
711 aIndex.SetIndex( nPara, nPos, *this );
713 return mrTextForwarder->GetLanguage( nPara, aIndex.GetEEIndex() );
716 USHORT SvxAccessibleTextAdapter::GetFieldCount( USHORT nPara ) const
718 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
720 return mrTextForwarder->GetFieldCount( nPara );
723 EFieldInfo SvxAccessibleTextAdapter::GetFieldInfo( USHORT nPara, USHORT nField ) const
725 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
727 return mrTextForwarder->GetFieldInfo( nPara, nField );
730 EBulletInfo SvxAccessibleTextAdapter::GetBulletInfo( USHORT nPara ) const
732 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
734 return mrTextForwarder->GetBulletInfo( nPara );
737 Rectangle SvxAccessibleTextAdapter::GetCharBounds( USHORT nPara, USHORT nIndex ) const
739 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
741 SvxAccessibleTextIndex aIndex;
742 aIndex.SetIndex( nPara, nIndex, *this );
744 // preset if anything goes wrong below
745 // n-th char in GetParagraphIndex's paragraph
746 Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, static_cast< USHORT >( aIndex.GetEEIndex() ) );
748 if( aIndex.InBullet() )
750 EBulletInfo aBulletInfo = GetBulletInfo( nPara );
752 OutputDevice* pOutDev = GetRefDevice();
754 DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
756 // preset if anything goes wrong below
757 aRect = aBulletInfo.aBounds; // better than nothing
758 if( pOutDev )
760 AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
762 if( aStringWrap.GetCharacterBounds( aIndex.GetBulletOffset(), aRect ) )
763 aRect.Move( aBulletInfo.aBounds.Left(), aBulletInfo.aBounds.Top() );
766 else
768 // handle field content manually
769 if( aIndex.InField() )
771 OutputDevice* pOutDev = GetRefDevice();
773 DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
775 if( pOutDev )
777 ESelection aSel = MakeEESelection( aIndex );
779 SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mrTextForwarder->GetAttribs( aSel ) );
780 AccessibleStringWrap aStringWrap( *pOutDev,
781 aFont,
782 mrTextForwarder->GetText( aSel ) );
784 Rectangle aStartRect = mrTextForwarder->GetCharBounds( nPara, static_cast< USHORT >( aIndex.GetEEIndex() ) );
786 if( !aStringWrap.GetCharacterBounds( aIndex.GetFieldOffset(), aRect ) )
787 aRect = aStartRect;
788 else
789 aRect.Move( aStartRect.Left(), aStartRect.Top() );
794 return aRect;
797 Rectangle SvxAccessibleTextAdapter::GetParaBounds( USHORT nPara ) const
799 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
801 EBulletInfo aBulletInfo = GetBulletInfo( nPara );
803 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
804 aBulletInfo.bVisible &&
805 aBulletInfo.nType != SVX_NUM_BITMAP )
807 // include bullet in para bounding box
808 Rectangle aRect( mrTextForwarder->GetParaBounds( nPara ) );
810 aRect.Union( aBulletInfo.aBounds );
812 return aRect;
815 return mrTextForwarder->GetParaBounds( nPara );
818 MapMode SvxAccessibleTextAdapter::GetMapMode() const
820 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
822 return mrTextForwarder->GetMapMode();
825 OutputDevice* SvxAccessibleTextAdapter::GetRefDevice() const
827 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
829 return mrTextForwarder->GetRefDevice();
832 sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, USHORT& nPara, USHORT& nIndex ) const
834 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
836 if( !mrTextForwarder->GetIndexAtPoint( rPoint, nPara, nIndex ) )
837 return sal_False;
839 SvxAccessibleTextIndex aIndex;
840 aIndex.SetEEIndex(nPara, nIndex, *this);
842 DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX,
843 "SvxAccessibleTextIndex::SetIndex: index value overflow");
845 nIndex = static_cast< USHORT > (aIndex.GetIndex());
847 EBulletInfo aBulletInfo = GetBulletInfo( nPara );
849 // any text bullets?
850 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
851 aBulletInfo.bVisible &&
852 aBulletInfo.nType != SVX_NUM_BITMAP )
854 if( aBulletInfo.aBounds.IsInside( rPoint) )
856 OutputDevice* pOutDev = GetRefDevice();
858 DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
860 if( !pOutDev )
861 return sal_False;
863 AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
865 Point aPoint = rPoint;
866 aPoint.Move( -aBulletInfo.aBounds.Left(), -aBulletInfo.aBounds.Top() );
868 DBG_ASSERT(aStringWrap.GetIndexAtPoint( aPoint ) >= 0 &&
869 aStringWrap.GetIndexAtPoint( aPoint ) <= USHRT_MAX,
870 "SvxAccessibleTextIndex::SetIndex: index value overflow");
872 nIndex = static_cast< USHORT > (aStringWrap.GetIndexAtPoint( aPoint ));
873 return sal_True;
877 if( aIndex.InField() )
879 OutputDevice* pOutDev = GetRefDevice();
881 DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
883 if( !pOutDev )
884 return sal_False;
886 ESelection aSelection = MakeEESelection( aIndex );
887 SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mrTextForwarder->GetAttribs( aSelection ) );
888 AccessibleStringWrap aStringWrap( *pOutDev,
889 aFont,
890 mrTextForwarder->GetText( aSelection ) );
892 Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
893 Point aPoint = rPoint;
894 aPoint.Move( -aRect.Left(), -aRect.Top() );
896 DBG_ASSERT(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) >= 0 &&
897 aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) <= USHRT_MAX,
898 "SvxAccessibleTextIndex::SetIndex: index value overflow");
900 nIndex = static_cast< USHORT >(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint ));
901 return sal_True;
904 return sal_True;
907 sal_Bool SvxAccessibleTextAdapter::GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const
909 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
911 SvxAccessibleTextIndex aIndex;
912 aIndex.SetIndex(nPara, nIndex, *this);
913 nIndex = aIndex.GetEEIndex();
915 if( aIndex.InBullet() )
917 DBG_ASSERT(aIndex.GetBulletLen() >= 0 &&
918 aIndex.GetBulletLen() <= USHRT_MAX,
919 "SvxAccessibleTextIndex::SetIndex: index value overflow");
921 // always treat bullet as separate word
922 nStart = 0;
923 nEnd = static_cast< USHORT > (aIndex.GetBulletLen());
925 return sal_True;
928 if( aIndex.InField() )
930 DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
931 aIndex.GetIndex() - aIndex.GetFieldOffset() <= USHRT_MAX &&
932 nStart + aIndex.GetFieldLen() >= 0 &&
933 nStart + aIndex.GetFieldLen() <= USHRT_MAX,
934 "SvxAccessibleTextIndex::SetIndex: index value overflow");
936 // always treat field as separate word
937 // TODO: to circumvent this, _we_ would have to do the break iterator stuff!
938 nStart = static_cast< USHORT > (aIndex.GetIndex() - aIndex.GetFieldOffset());
939 nEnd = static_cast< USHORT > (nStart + aIndex.GetFieldLen());
941 return sal_True;
944 if( !mrTextForwarder->GetWordIndices( nPara, nIndex, nStart, nEnd ) )
945 return sal_False;
947 aIndex.SetEEIndex( nPara, nStart, *this );
948 DBG_ASSERT(aIndex.GetIndex() >= 0 &&
949 aIndex.GetIndex() <= USHRT_MAX,
950 "SvxAccessibleTextIndex::SetIndex: index value overflow");
951 nStart = static_cast< USHORT > (aIndex.GetIndex());
953 aIndex.SetEEIndex( nPara, nEnd, *this );
954 DBG_ASSERT(aIndex.GetIndex() >= 0 &&
955 aIndex.GetIndex() <= USHRT_MAX,
956 "SvxAccessibleTextIndex::SetIndex: index value overflow");
957 nEnd = static_cast< USHORT > (aIndex.GetIndex());
959 return sal_True;
962 sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const
964 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
966 SvxAccessibleTextIndex aIndex;
967 aIndex.SetIndex(nPara, nIndex, *this);
968 nIndex = aIndex.GetEEIndex();
970 if( aIndex.InBullet() )
972 DBG_ASSERT(aIndex.GetBulletLen() >= 0 &&
973 aIndex.GetBulletLen() <= USHRT_MAX,
974 "SvxAccessibleTextIndex::SetIndex: index value overflow");
976 // always treat bullet as distinct attribute
977 nStartIndex = 0;
978 nEndIndex = static_cast< USHORT > (aIndex.GetBulletLen());
980 return sal_True;
983 if( aIndex.InField() )
985 DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
986 aIndex.GetIndex() - aIndex.GetFieldOffset() <= USHRT_MAX,
987 "SvxAccessibleTextIndex::SetIndex: index value overflow");
989 // always treat field as distinct attribute
990 nStartIndex = static_cast< USHORT > (aIndex.GetIndex() - aIndex.GetFieldOffset());
991 nEndIndex = static_cast< USHORT > (nStartIndex + aIndex.GetFieldLen());
993 return sal_True;
996 if( !mrTextForwarder->GetAttributeRun( nStartIndex, nEndIndex, nPara, nIndex ) )
997 return sal_False;
999 aIndex.SetEEIndex( nPara, nStartIndex, *this );
1000 DBG_ASSERT(aIndex.GetIndex() >= 0 &&
1001 aIndex.GetIndex() <= USHRT_MAX,
1002 "SvxAccessibleTextIndex::SetIndex: index value overflow");
1003 nStartIndex = static_cast< USHORT > (aIndex.GetIndex());
1005 aIndex.SetEEIndex( nPara, nEndIndex, *this );
1006 DBG_ASSERT(aIndex.GetIndex() >= 0 &&
1007 aIndex.GetIndex() <= USHRT_MAX,
1008 "SvxAccessibleTextIndex::SetIndex: index value overflow");
1009 nEndIndex = static_cast< USHORT > (aIndex.GetIndex());
1011 return sal_True;
1014 USHORT SvxAccessibleTextAdapter::GetLineCount( USHORT nPara ) const
1016 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1018 return mrTextForwarder->GetLineCount( nPara );
1021 USHORT SvxAccessibleTextAdapter::GetLineLen( USHORT nPara, USHORT nLine ) const
1023 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1025 SvxAccessibleTextIndex aStartIndex;
1026 SvxAccessibleTextIndex aEndIndex;
1027 USHORT nCurrLine;
1028 USHORT nCurrIndex, nLastIndex;
1029 for( nCurrLine=0, nCurrIndex=0, nLastIndex=0; nCurrLine<=nLine; ++nCurrLine )
1031 nLastIndex = nCurrIndex;
1032 nCurrIndex =
1033 nCurrIndex + mrTextForwarder->GetLineLen( nPara, nCurrLine );
1036 aEndIndex.SetEEIndex( nPara, nCurrIndex, *this );
1037 if( nLine > 0 )
1039 aStartIndex.SetEEIndex( nPara, nLastIndex, *this );
1041 return static_cast< USHORT >(aEndIndex.GetIndex() - aStartIndex.GetIndex());
1043 else
1044 return static_cast< USHORT >(aEndIndex.GetIndex());
1047 void SvxAccessibleTextAdapter::GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const
1049 mrTextForwarder->GetLineBoundaries( rStart, rEnd, nParagraph, nLine );
1052 USHORT SvxAccessibleTextAdapter::GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const
1054 return mrTextForwarder->GetLineNumberAtIndex( nPara, nIndex );
1057 sal_Bool SvxAccessibleTextAdapter::Delete( const ESelection& rSel )
1059 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1061 SvxAccessibleTextIndex aStartIndex;
1062 SvxAccessibleTextIndex aEndIndex;
1064 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
1065 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
1067 return mrTextForwarder->Delete( MakeEESelection(aStartIndex, aEndIndex ) );
1070 sal_Bool SvxAccessibleTextAdapter::InsertText( const String& rStr, const ESelection& rSel )
1072 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1074 SvxAccessibleTextIndex aStartIndex;
1075 SvxAccessibleTextIndex aEndIndex;
1077 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
1078 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
1080 return mrTextForwarder->InsertText( rStr, MakeEESelection(aStartIndex, aEndIndex) );
1083 sal_Bool SvxAccessibleTextAdapter::QuickFormatDoc( BOOL bFull )
1085 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1087 return mrTextForwarder->QuickFormatDoc( bFull );
1090 sal_Int16 SvxAccessibleTextAdapter::GetDepth( USHORT nPara ) const
1092 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1094 return mrTextForwarder->GetDepth( nPara );
1097 sal_Bool SvxAccessibleTextAdapter::SetDepth( USHORT nPara, sal_Int16 nNewDepth )
1099 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1101 return mrTextForwarder->SetDepth( nPara, nNewDepth );
1104 void SvxAccessibleTextAdapter::SetForwarder( SvxTextForwarder& rForwarder )
1106 mrTextForwarder = &rForwarder;
1109 sal_Bool SvxAccessibleTextAdapter::HaveImageBullet( USHORT nPara ) const
1111 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1113 EBulletInfo aBulletInfo = GetBulletInfo( nPara );
1115 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
1116 aBulletInfo.bVisible &&
1117 aBulletInfo.nType == SVX_NUM_BITMAP )
1119 return sal_True;
1121 else
1123 return sal_False;
1127 sal_Bool SvxAccessibleTextAdapter::HaveTextBullet( USHORT nPara ) const
1129 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1131 EBulletInfo aBulletInfo = GetBulletInfo( nPara );
1133 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
1134 aBulletInfo.bVisible &&
1135 aBulletInfo.nType != SVX_NUM_BITMAP )
1137 return sal_True;
1139 else
1141 return sal_False;
1145 sal_Bool SvxAccessibleTextAdapter::IsEditable( const ESelection& rSel )
1147 DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1149 SvxAccessibleTextIndex aStartIndex;
1150 SvxAccessibleTextIndex aEndIndex;
1152 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
1153 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
1155 // normalize selection
1156 if( rSel.nStartPara > rSel.nEndPara ||
1157 (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
1159 ::std::swap( aStartIndex, aEndIndex );
1162 return aStartIndex.IsEditableRange( aEndIndex );
1165 const SfxItemSet * SvxAccessibleTextAdapter::GetEmptyItemSetPtr()
1167 DBG_ERROR( "not implemented" );
1168 return 0;
1171 void SvxAccessibleTextAdapter::AppendParagraph()
1173 DBG_ERROR( "not implemented" );
1176 xub_StrLen SvxAccessibleTextAdapter::AppendTextPortion( USHORT, const String &, const SfxItemSet & )
1178 DBG_ERROR( "not implemented" );
1179 return 0;
1181 void SvxAccessibleTextAdapter::CopyText(const SvxTextForwarder&)
1183 DBG_ERROR( "not implemented" );
1188 //---------------------------------------------------------------------------------------
1190 SvxAccessibleTextEditViewAdapter::SvxAccessibleTextEditViewAdapter()
1194 SvxAccessibleTextEditViewAdapter::~SvxAccessibleTextEditViewAdapter()
1198 BOOL SvxAccessibleTextEditViewAdapter::IsValid() const
1200 DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1202 if( mrViewForwarder )
1203 return mrViewForwarder->IsValid();
1204 else
1205 return sal_False;
1208 Rectangle SvxAccessibleTextEditViewAdapter::GetVisArea() const
1210 DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1212 return mrViewForwarder->GetVisArea();
1215 Point SvxAccessibleTextEditViewAdapter::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
1217 DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1219 return mrViewForwarder->LogicToPixel(rPoint, rMapMode);
1222 Point SvxAccessibleTextEditViewAdapter::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
1224 DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1226 return mrViewForwarder->PixelToLogic(rPoint, rMapMode);
1229 sal_Bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const
1231 DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1233 ESelection aSelection;
1235 if( !mrViewForwarder->GetSelection( aSelection ) )
1236 return sal_False;
1238 SvxAccessibleTextIndex aStartIndex;
1239 SvxAccessibleTextIndex aEndIndex;
1241 aStartIndex.SetEEIndex( aSelection.nStartPara, aSelection.nStartPos, *mrTextForwarder );
1242 aEndIndex.SetEEIndex( aSelection.nEndPara, aSelection.nEndPos, *mrTextForwarder );
1244 DBG_ASSERT(aStartIndex.GetIndex() >= 0 && aStartIndex.GetIndex() <= USHRT_MAX &&
1245 aEndIndex.GetIndex() >= 0 && aEndIndex.GetIndex() <= USHRT_MAX,
1246 "SvxAccessibleTextEditViewAdapter::GetSelection: index value overflow");
1248 rSel = ESelection( aStartIndex.GetParagraph(), static_cast< USHORT > (aStartIndex.GetIndex()),
1249 aEndIndex.GetParagraph(), static_cast< USHORT > (aEndIndex.GetIndex()) );
1251 return sal_True;
1254 sal_Bool SvxAccessibleTextEditViewAdapter::SetSelection( const ESelection& rSel )
1256 DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1258 SvxAccessibleTextIndex aStartIndex;
1259 SvxAccessibleTextIndex aEndIndex;
1261 aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *mrTextForwarder );
1262 aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *mrTextForwarder );
1264 return mrViewForwarder->SetSelection( MakeEESelection(aStartIndex, aEndIndex) );
1267 sal_Bool SvxAccessibleTextEditViewAdapter::Copy()
1269 DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1271 return mrViewForwarder->Copy();
1274 sal_Bool SvxAccessibleTextEditViewAdapter::Cut()
1276 DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1278 return mrViewForwarder->Cut();
1281 sal_Bool SvxAccessibleTextEditViewAdapter::Paste()
1283 DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1285 return mrViewForwarder->Paste();
1288 void SvxAccessibleTextEditViewAdapter::SetForwarder( SvxEditViewForwarder& rForwarder,
1289 SvxAccessibleTextAdapter& rTextForwarder )
1291 mrViewForwarder = &rForwarder;
1292 mrTextForwarder = &rTextForwarder;