xref: /aoo41x/main/editeng/source/uno/unoedprx.cxx (revision 3ea0c3d5)
1190118d0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3190118d0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4190118d0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5190118d0SAndrew Rist  * distributed with this work for additional information
6190118d0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7190118d0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8190118d0SAndrew Rist  * "License"); you may not use this file except in compliance
9190118d0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10190118d0SAndrew Rist  *
11190118d0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12190118d0SAndrew Rist  *
13190118d0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14190118d0SAndrew Rist  * software distributed under the License is distributed on an
15190118d0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16190118d0SAndrew Rist  * KIND, either express or implied.  See the License for the
17190118d0SAndrew Rist  * specific language governing permissions and limitations
18190118d0SAndrew Rist  * under the License.
19190118d0SAndrew Rist  *
20190118d0SAndrew Rist  *************************************************************/
21190118d0SAndrew Rist 
22190118d0SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_editeng.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //------------------------------------------------------------------------
28cdf0e10cSrcweir //
29cdf0e10cSrcweir // Global header
30cdf0e10cSrcweir //
31cdf0e10cSrcweir //------------------------------------------------------------------------
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <limits.h>
34cdf0e10cSrcweir #include <vector>
35cdf0e10cSrcweir #include <algorithm>
36cdf0e10cSrcweir #include <vos/mutex.hxx>
37cdf0e10cSrcweir #include <vcl/window.hxx>
38cdf0e10cSrcweir #include <vcl/svapp.hxx>
39cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
40cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //------------------------------------------------------------------------
43cdf0e10cSrcweir //
44cdf0e10cSrcweir // Project-local header
45cdf0e10cSrcweir //
46cdf0e10cSrcweir //------------------------------------------------------------------------
47cdf0e10cSrcweir #include "editeng/unoedprx.hxx"
48cdf0e10cSrcweir #include <editeng/unotext.hxx>
49cdf0e10cSrcweir #include <editeng/unoedhlp.hxx>
50cdf0e10cSrcweir #include <editeng/editdata.hxx>
51cdf0e10cSrcweir #include <editeng/editeng.hxx>
52cdf0e10cSrcweir #include <editeng/editview.hxx>
53cdf0e10cSrcweir #include <editeng/AccessibleStringWrap.hxx>
54cdf0e10cSrcweir #include <editeng/outliner.hxx>
55cdf0e10cSrcweir 
56cdf0e10cSrcweir using namespace ::com::sun::star;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 
59cdf0e10cSrcweir class SvxAccessibleTextIndex
60cdf0e10cSrcweir {
61cdf0e10cSrcweir public:
SvxAccessibleTextIndex()62cdf0e10cSrcweir     SvxAccessibleTextIndex() :
63cdf0e10cSrcweir         mnPara(0),
64cdf0e10cSrcweir         mnIndex(0),
65cdf0e10cSrcweir         mnEEIndex(0),
66cdf0e10cSrcweir         mnFieldOffset(0),
67cdf0e10cSrcweir         mnFieldLen(0),
68cdf0e10cSrcweir         mbInField(sal_False),
69cdf0e10cSrcweir         mnBulletOffset(0),
70cdf0e10cSrcweir         mnBulletLen(0),
71cdf0e10cSrcweir         mbInBullet(sal_False) {};
~SvxAccessibleTextIndex()72cdf0e10cSrcweir     ~SvxAccessibleTextIndex() {};
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     // Get/Set current paragraph
SetParagraph(sal_uInt16 nPara)75cdf0e10cSrcweir     void SetParagraph( sal_uInt16 nPara )
76cdf0e10cSrcweir     {
77cdf0e10cSrcweir         mnPara = nPara;
78cdf0e10cSrcweir     }
GetParagraph() const79cdf0e10cSrcweir     sal_uInt16 GetParagraph() const { return mnPara; }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     /** Set the index in the UAA semantic
82cdf0e10cSrcweir 
83cdf0e10cSrcweir         @param nIndex
84cdf0e10cSrcweir      	The index from the UA API (fields and bullets are expanded)
85cdf0e10cSrcweir 
86cdf0e10cSrcweir         @param rTF
87cdf0e10cSrcweir         The text forwarder to use in the calculations
88cdf0e10cSrcweir      */
89cdf0e10cSrcweir     void SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF );
SetIndex(sal_uInt16 nPara,sal_Int32 nIndex,const SvxTextForwarder & rTF)90cdf0e10cSrcweir     void SetIndex( sal_uInt16 nPara, sal_Int32 nIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetIndex(nIndex, rTF); }
GetIndex() const91cdf0e10cSrcweir     sal_Int32 GetIndex() const { return mnIndex; }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     /** Set the index in the edit engine semantic
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     	Update the object state to reflect the given index position in
96cdf0e10cSrcweir     	EditEngine/Outliner index values
97cdf0e10cSrcweir 
98cdf0e10cSrcweir         @param nEEIndex
99cdf0e10cSrcweir      	The index from the edit engine (fields span exactly one index increment)
100cdf0e10cSrcweir 
101cdf0e10cSrcweir         @param rTF
102cdf0e10cSrcweir         The text forwarder to use in the calculations
103cdf0e10cSrcweir      */
104cdf0e10cSrcweir     void SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF );
SetEEIndex(sal_uInt16 nPara,sal_uInt16 nEEIndex,const SvxTextForwarder & rTF)105cdf0e10cSrcweir     void SetEEIndex( sal_uInt16 nPara, sal_uInt16 nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); }
106cdf0e10cSrcweir     sal_uInt16 GetEEIndex() const;
107cdf0e10cSrcweir 
SetFieldOffset(sal_Int32 nOffset,sal_Int32 nLen)108cdf0e10cSrcweir     void SetFieldOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnFieldOffset = nOffset; mnFieldLen = nLen; }
GetFieldOffset() const109cdf0e10cSrcweir     sal_Int32 GetFieldOffset() const { return mnFieldOffset; }
GetFieldLen() const110cdf0e10cSrcweir     sal_Int32 GetFieldLen() const { return mnFieldLen; }
AreInField(sal_Bool bInField=sal_True)111cdf0e10cSrcweir     void AreInField( sal_Bool bInField = sal_True ) { mbInField = bInField; }
InField() const112cdf0e10cSrcweir     sal_Bool InField() const { return mbInField; }
113cdf0e10cSrcweir 
SetBulletOffset(sal_Int32 nOffset,sal_Int32 nLen)114cdf0e10cSrcweir     void SetBulletOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnBulletOffset = nOffset; mnBulletLen = nLen; }
GetBulletOffset() const115cdf0e10cSrcweir     sal_Int32 GetBulletOffset() const { return mnBulletOffset; }
GetBulletLen() const116cdf0e10cSrcweir     sal_Int32 GetBulletLen() const { return mnBulletLen; }
AreInBullet(sal_Bool bInBullet=sal_True)117cdf0e10cSrcweir     void AreInBullet( sal_Bool bInBullet = sal_True ) { mbInBullet = bInBullet; }
InBullet() const118cdf0e10cSrcweir     sal_Bool InBullet() const { return mbInBullet; }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     /// returns false if the current index contains non-editable text (e.g. bullets)
121cdf0e10cSrcweir     sal_Bool IsEditable() const;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     /// returns false if the given range is non-editable (e.g. contains bullets or _parts_ of fields)
124cdf0e10cSrcweir     sal_Bool IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const;
125cdf0e10cSrcweir 
126cdf0e10cSrcweir private:
127cdf0e10cSrcweir     sal_uInt16 	  mnPara;
128cdf0e10cSrcweir     sal_Int32 mnIndex;
129cdf0e10cSrcweir     sal_Int32 mnEEIndex;
130cdf0e10cSrcweir     sal_Int32 mnFieldOffset;
131cdf0e10cSrcweir     sal_Int32 mnFieldLen;
132cdf0e10cSrcweir     sal_Bool  mbInField;
133cdf0e10cSrcweir     sal_Int32 mnBulletOffset;
134cdf0e10cSrcweir     sal_Int32 mnBulletLen;
135cdf0e10cSrcweir     sal_Bool  mbInBullet;
136cdf0e10cSrcweir };
137cdf0e10cSrcweir 
MakeEESelection(const SvxAccessibleTextIndex & rStart,const SvxAccessibleTextIndex & rEnd)138cdf0e10cSrcweir ESelection MakeEESelection( const SvxAccessibleTextIndex& rStart, const SvxAccessibleTextIndex& rEnd )
139cdf0e10cSrcweir {
140cdf0e10cSrcweir     // deal with field special case: to really get a field contained
141cdf0e10cSrcweir     // within a selection, the start index must be before or on the
142cdf0e10cSrcweir     // field, the end index after it.
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     // The SvxAccessibleTextIndex.GetEEIndex method gives the index on
145cdf0e10cSrcweir     // the field, as long the input index is on the field. Thus,
146cdf0e10cSrcweir     // correction necessary for the end index
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     // Therefore, for _ranges_, if part of the field is touched, all
149cdf0e10cSrcweir     // of the field must be selected
150cdf0e10cSrcweir     if( rStart.GetParagraph() <= rEnd.GetParagraph() ||
151cdf0e10cSrcweir         (rStart.GetParagraph() == rEnd.GetParagraph() &&
152cdf0e10cSrcweir          rStart.GetEEIndex() <= rEnd.GetEEIndex()) )
153cdf0e10cSrcweir     {
154cdf0e10cSrcweir         if( rEnd.InField() && rEnd.GetFieldOffset() )
155cdf0e10cSrcweir             return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
156cdf0e10cSrcweir                                rEnd.GetParagraph(), rEnd.GetEEIndex()+1 );
157cdf0e10cSrcweir     }
158cdf0e10cSrcweir     else if( rStart.GetParagraph() > rEnd.GetParagraph() ||
159cdf0e10cSrcweir              (rStart.GetParagraph() == rEnd.GetParagraph() &&
160cdf0e10cSrcweir               rStart.GetEEIndex() > rEnd.GetEEIndex()) )
161cdf0e10cSrcweir     {
162cdf0e10cSrcweir         if( rStart.InField() && rStart.GetFieldOffset()  )
163cdf0e10cSrcweir             return ESelection( rStart.GetParagraph(), rStart.GetEEIndex()+1,
164cdf0e10cSrcweir                                rEnd.GetParagraph(), rEnd.GetEEIndex() );
165cdf0e10cSrcweir     }
166cdf0e10cSrcweir 
167cdf0e10cSrcweir     return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
168cdf0e10cSrcweir                        rEnd.GetParagraph(), rEnd.GetEEIndex() );
169cdf0e10cSrcweir }
170cdf0e10cSrcweir 
MakeEESelection(const SvxAccessibleTextIndex & rIndex)171cdf0e10cSrcweir ESelection MakeEESelection( const SvxAccessibleTextIndex& rIndex )
172cdf0e10cSrcweir {
173cdf0e10cSrcweir     return ESelection( rIndex.GetParagraph(), rIndex.GetEEIndex(),
174cdf0e10cSrcweir                        rIndex.GetParagraph(), rIndex.GetEEIndex() + 1 );
175cdf0e10cSrcweir }
176cdf0e10cSrcweir 
GetEEIndex() const177cdf0e10cSrcweir sal_uInt16 SvxAccessibleTextIndex::GetEEIndex() const
178cdf0e10cSrcweir {
179cdf0e10cSrcweir     DBG_ASSERT(mnEEIndex >= 0 && mnEEIndex <= USHRT_MAX,
180cdf0e10cSrcweir                "SvxAccessibleTextIndex::GetEEIndex: index value overflow");
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     return static_cast< sal_uInt16 > (mnEEIndex);
183cdf0e10cSrcweir }
184cdf0e10cSrcweir 
SetEEIndex(sal_uInt16 nEEIndex,const SvxTextForwarder & rTF)185cdf0e10cSrcweir void SvxAccessibleTextIndex::SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF )
186cdf0e10cSrcweir {
187cdf0e10cSrcweir     // reset
188cdf0e10cSrcweir     mnFieldOffset = 0;
189cdf0e10cSrcweir     mbInField = sal_False;
190cdf0e10cSrcweir     mnFieldLen = 0;
191cdf0e10cSrcweir     mnBulletOffset = 0;
192cdf0e10cSrcweir     mbInBullet = sal_False;
193cdf0e10cSrcweir     mnBulletLen = 0;
194cdf0e10cSrcweir 
195cdf0e10cSrcweir     // set known values
196cdf0e10cSrcweir     mnEEIndex = nEEIndex;
197cdf0e10cSrcweir 
198cdf0e10cSrcweir     // calculate unknowns
199cdf0e10cSrcweir     sal_uInt16					nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
200cdf0e10cSrcweir 
201cdf0e10cSrcweir     mnIndex = nEEIndex;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir     EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     // any text bullets?
206cdf0e10cSrcweir     if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
207cdf0e10cSrcweir         aBulletInfo.bVisible &&
208cdf0e10cSrcweir         aBulletInfo.nType != SVX_NUM_BITMAP )
209cdf0e10cSrcweir     {
210cdf0e10cSrcweir         mnIndex += aBulletInfo.aText.Len();
211cdf0e10cSrcweir     }
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
214cdf0e10cSrcweir     {
215cdf0e10cSrcweir         EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
216cdf0e10cSrcweir 
217cdf0e10cSrcweir         if( aFieldInfo.aPosition.nIndex > nEEIndex )
218cdf0e10cSrcweir             break;
219cdf0e10cSrcweir 
220cdf0e10cSrcweir         if( aFieldInfo.aPosition.nIndex == nEEIndex )
221cdf0e10cSrcweir         {
222cdf0e10cSrcweir             AreInField();
223cdf0e10cSrcweir             break;
224cdf0e10cSrcweir         }
225cdf0e10cSrcweir 
226cdf0e10cSrcweir         // #106010#
227cdf0e10cSrcweir         mnIndex += ::std::max(aFieldInfo.aCurrentText.Len()-1, 0);
228cdf0e10cSrcweir     }
229cdf0e10cSrcweir }
230cdf0e10cSrcweir 
SetIndex(sal_Int32 nIndex,const SvxTextForwarder & rTF)231cdf0e10cSrcweir void SvxAccessibleTextIndex::SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF )
232cdf0e10cSrcweir {
233cdf0e10cSrcweir     // reset
234cdf0e10cSrcweir     mnFieldOffset = 0;
235cdf0e10cSrcweir     mbInField = sal_False;
236cdf0e10cSrcweir     mnFieldLen = 0;
237cdf0e10cSrcweir     mnBulletOffset = 0;
238cdf0e10cSrcweir     mbInBullet = sal_False;
239cdf0e10cSrcweir     mnBulletLen = 0;
240cdf0e10cSrcweir 
241cdf0e10cSrcweir     // set known values
242cdf0e10cSrcweir     mnIndex = nIndex;
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     // calculate unknowns
245cdf0e10cSrcweir     sal_uInt16					nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
246cdf0e10cSrcweir 
247cdf0e10cSrcweir     DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX,
248cdf0e10cSrcweir                "SvxAccessibleTextIndex::SetIndex: index value overflow");
249cdf0e10cSrcweir 
250cdf0e10cSrcweir     mnEEIndex = nIndex;
251cdf0e10cSrcweir 
252cdf0e10cSrcweir     EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
253cdf0e10cSrcweir 
254cdf0e10cSrcweir     // any text bullets?
255cdf0e10cSrcweir     if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
256cdf0e10cSrcweir         aBulletInfo.bVisible &&
257cdf0e10cSrcweir         aBulletInfo.nType != SVX_NUM_BITMAP )
258cdf0e10cSrcweir     {
259cdf0e10cSrcweir         sal_Int32 nBulletLen = aBulletInfo.aText.Len();
260cdf0e10cSrcweir 
261cdf0e10cSrcweir         if( nIndex < nBulletLen )
262cdf0e10cSrcweir         {
263cdf0e10cSrcweir             AreInBullet();
264cdf0e10cSrcweir             SetBulletOffset( nIndex, nBulletLen );
265cdf0e10cSrcweir             mnEEIndex = 0;
266cdf0e10cSrcweir             return;
267cdf0e10cSrcweir         }
268cdf0e10cSrcweir 
269cdf0e10cSrcweir         mnEEIndex = mnEEIndex - nBulletLen;
270cdf0e10cSrcweir     }
271cdf0e10cSrcweir 
272cdf0e10cSrcweir     for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
273cdf0e10cSrcweir     {
274cdf0e10cSrcweir         EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
275cdf0e10cSrcweir 
276cdf0e10cSrcweir         // we're before a field
277cdf0e10cSrcweir         if( aFieldInfo.aPosition.nIndex > mnEEIndex )
278cdf0e10cSrcweir             break;
279cdf0e10cSrcweir 
280cdf0e10cSrcweir         // #106010#
281cdf0e10cSrcweir         mnEEIndex -= ::std::max(aFieldInfo.aCurrentText.Len()-1, 0);
282cdf0e10cSrcweir 
283cdf0e10cSrcweir         // we're within a field
284cdf0e10cSrcweir         if( aFieldInfo.aPosition.nIndex >= mnEEIndex )
285cdf0e10cSrcweir         {
286cdf0e10cSrcweir             AreInField();
287cdf0e10cSrcweir             SetFieldOffset( ::std::max(aFieldInfo.aCurrentText.Len()-1, 0) - (aFieldInfo.aPosition.nIndex - mnEEIndex),
288cdf0e10cSrcweir                             aFieldInfo.aCurrentText.Len() );
289cdf0e10cSrcweir             mnEEIndex = aFieldInfo.aPosition.nIndex ;
290cdf0e10cSrcweir             break;
291cdf0e10cSrcweir         }
292cdf0e10cSrcweir     }
293cdf0e10cSrcweir }
294cdf0e10cSrcweir 
IsEditable() const295cdf0e10cSrcweir sal_Bool SvxAccessibleTextIndex::IsEditable() const
296cdf0e10cSrcweir {
297cdf0e10cSrcweir     if( InBullet() || InField() )
298cdf0e10cSrcweir         return sal_False;
299cdf0e10cSrcweir 
300cdf0e10cSrcweir     return sal_True;
301cdf0e10cSrcweir }
302cdf0e10cSrcweir 
IsEditableRange(const SvxAccessibleTextIndex & rEnd) const303cdf0e10cSrcweir sal_Bool SvxAccessibleTextIndex::IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const
304cdf0e10cSrcweir {
305cdf0e10cSrcweir     if( GetIndex() > rEnd.GetIndex() )
306cdf0e10cSrcweir         return rEnd.IsEditableRange( *this );
307cdf0e10cSrcweir 
308cdf0e10cSrcweir     if( InBullet() || rEnd.InBullet() )
309cdf0e10cSrcweir         return sal_False;
310cdf0e10cSrcweir 
311cdf0e10cSrcweir     if( InField() && GetFieldOffset() )
312cdf0e10cSrcweir         return sal_False; // within field
313cdf0e10cSrcweir 
314cdf0e10cSrcweir     if( rEnd.InField() && rEnd.GetFieldOffset() >= rEnd.GetFieldLen() - 1 )
315cdf0e10cSrcweir         return sal_False; // within field
316cdf0e10cSrcweir 
317cdf0e10cSrcweir     return sal_True;
318cdf0e10cSrcweir }
319cdf0e10cSrcweir 
320cdf0e10cSrcweir //---------------------------------------------------------------------------------
321cdf0e10cSrcweir 
SvxEditSourceAdapter()322cdf0e10cSrcweir SvxEditSourceAdapter::SvxEditSourceAdapter() : mbEditSourceValid( sal_False )
323cdf0e10cSrcweir {
324cdf0e10cSrcweir }
325cdf0e10cSrcweir 
~SvxEditSourceAdapter()326cdf0e10cSrcweir SvxEditSourceAdapter::~SvxEditSourceAdapter()
327cdf0e10cSrcweir {
328cdf0e10cSrcweir }
329cdf0e10cSrcweir 
Clone() const330cdf0e10cSrcweir SvxEditSource* SvxEditSourceAdapter::Clone() const
331cdf0e10cSrcweir {
332cdf0e10cSrcweir     if( mbEditSourceValid && mpAdaptee.get() )
333cdf0e10cSrcweir     {
334cdf0e10cSrcweir         ::std::auto_ptr< SvxEditSource > pClonedAdaptee( mpAdaptee->Clone() );
335cdf0e10cSrcweir 
336cdf0e10cSrcweir         if( pClonedAdaptee.get() )
337cdf0e10cSrcweir         {
338cdf0e10cSrcweir             SvxEditSourceAdapter* pClone = new SvxEditSourceAdapter();
339cdf0e10cSrcweir 
340cdf0e10cSrcweir             if( pClone )
341cdf0e10cSrcweir             {
342cdf0e10cSrcweir                 pClone->SetEditSource( pClonedAdaptee );
343cdf0e10cSrcweir                 return pClone;
344cdf0e10cSrcweir             }
345cdf0e10cSrcweir         }
346cdf0e10cSrcweir     }
347cdf0e10cSrcweir 
348cdf0e10cSrcweir     return NULL;
349cdf0e10cSrcweir }
350cdf0e10cSrcweir 
GetTextForwarderAdapter()351cdf0e10cSrcweir SvxAccessibleTextAdapter* SvxEditSourceAdapter::GetTextForwarderAdapter()
352cdf0e10cSrcweir {
353cdf0e10cSrcweir     if( mbEditSourceValid && mpAdaptee.get() )
354cdf0e10cSrcweir     {
355cdf0e10cSrcweir         SvxTextForwarder* pTextForwarder = mpAdaptee->GetTextForwarder();
356cdf0e10cSrcweir 
357cdf0e10cSrcweir         if( pTextForwarder )
358cdf0e10cSrcweir         {
359cdf0e10cSrcweir             maTextAdapter.SetForwarder(*pTextForwarder);
360cdf0e10cSrcweir 
361cdf0e10cSrcweir             return &maTextAdapter;
362cdf0e10cSrcweir         }
363cdf0e10cSrcweir     }
364cdf0e10cSrcweir 
365cdf0e10cSrcweir     return NULL;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir 
GetTextForwarder()368cdf0e10cSrcweir SvxTextForwarder* SvxEditSourceAdapter::GetTextForwarder()
369cdf0e10cSrcweir {
370cdf0e10cSrcweir     return GetTextForwarderAdapter();
371cdf0e10cSrcweir }
372cdf0e10cSrcweir 
GetViewForwarder()373cdf0e10cSrcweir SvxViewForwarder* SvxEditSourceAdapter::GetViewForwarder()
374cdf0e10cSrcweir {
375cdf0e10cSrcweir     if( mbEditSourceValid && mpAdaptee.get() )
376cdf0e10cSrcweir         return mpAdaptee->GetViewForwarder();
377cdf0e10cSrcweir 
378cdf0e10cSrcweir     return NULL;
379cdf0e10cSrcweir }
380cdf0e10cSrcweir 
GetEditViewForwarderAdapter(sal_Bool bCreate)381cdf0e10cSrcweir SvxAccessibleTextEditViewAdapter* SvxEditSourceAdapter::GetEditViewForwarderAdapter( sal_Bool bCreate )
382cdf0e10cSrcweir {
383cdf0e10cSrcweir     if( mbEditSourceValid && mpAdaptee.get() )
384cdf0e10cSrcweir     {
385cdf0e10cSrcweir         SvxEditViewForwarder* pEditViewForwarder = mpAdaptee->GetEditViewForwarder(bCreate);
386cdf0e10cSrcweir 
387cdf0e10cSrcweir         if( pEditViewForwarder )
388cdf0e10cSrcweir         {
389cdf0e10cSrcweir             SvxAccessibleTextAdapter* pTextAdapter = GetTextForwarderAdapter();
390cdf0e10cSrcweir 
391cdf0e10cSrcweir             if( pTextAdapter )
392cdf0e10cSrcweir             {
393cdf0e10cSrcweir                 maEditViewAdapter.SetForwarder(*pEditViewForwarder, *pTextAdapter);
394cdf0e10cSrcweir 
395cdf0e10cSrcweir                 return &maEditViewAdapter;
396cdf0e10cSrcweir             }
397cdf0e10cSrcweir         }
398cdf0e10cSrcweir     }
399cdf0e10cSrcweir 
400cdf0e10cSrcweir     return NULL;
401cdf0e10cSrcweir }
402cdf0e10cSrcweir 
GetEditViewForwarder(sal_Bool bCreate)403cdf0e10cSrcweir SvxEditViewForwarder* SvxEditSourceAdapter::GetEditViewForwarder( sal_Bool bCreate )
404cdf0e10cSrcweir {
405cdf0e10cSrcweir     return GetEditViewForwarderAdapter( bCreate );
406cdf0e10cSrcweir }
407cdf0e10cSrcweir 
UpdateData()408cdf0e10cSrcweir void SvxEditSourceAdapter::UpdateData()
409cdf0e10cSrcweir {
410cdf0e10cSrcweir     if( mbEditSourceValid && mpAdaptee.get() )
411cdf0e10cSrcweir         mpAdaptee->UpdateData();
412cdf0e10cSrcweir }
413cdf0e10cSrcweir 
GetBroadcaster() const414cdf0e10cSrcweir SfxBroadcaster& SvxEditSourceAdapter::GetBroadcaster() const
415cdf0e10cSrcweir {
416cdf0e10cSrcweir     if( mbEditSourceValid && mpAdaptee.get() )
417cdf0e10cSrcweir         return mpAdaptee->GetBroadcaster();
418cdf0e10cSrcweir 
419cdf0e10cSrcweir     return maDummyBroadcaster;
420cdf0e10cSrcweir }
421cdf0e10cSrcweir 
SetEditSource(::std::auto_ptr<SvxEditSource> pAdaptee)422cdf0e10cSrcweir void SvxEditSourceAdapter::SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee )
423cdf0e10cSrcweir {
424cdf0e10cSrcweir     if( pAdaptee.get() )
425cdf0e10cSrcweir     {
426cdf0e10cSrcweir         mpAdaptee = pAdaptee;
427cdf0e10cSrcweir         mbEditSourceValid = sal_True;
428cdf0e10cSrcweir     }
429cdf0e10cSrcweir     else
430cdf0e10cSrcweir     {
431cdf0e10cSrcweir         // do a lazy delete (prevents us from deleting the broadcaster
432cdf0e10cSrcweir         // from within a broadcast in
433cdf0e10cSrcweir         // AccessibleTextHelper_Impl::Notify)
434cdf0e10cSrcweir         mbEditSourceValid = sal_False;
435cdf0e10cSrcweir     }
436cdf0e10cSrcweir }
437cdf0e10cSrcweir 
IsValid() const438cdf0e10cSrcweir sal_Bool SvxEditSourceAdapter::IsValid() const
439cdf0e10cSrcweir {
440cdf0e10cSrcweir     return mbEditSourceValid;
441cdf0e10cSrcweir }
442cdf0e10cSrcweir 
443cdf0e10cSrcweir 
444cdf0e10cSrcweir //--------------------------------------------------------------------------------------
445cdf0e10cSrcweir 
SvxAccessibleTextAdapter()446cdf0e10cSrcweir SvxAccessibleTextAdapter::SvxAccessibleTextAdapter() : mrTextForwarder( NULL )
447cdf0e10cSrcweir {
448cdf0e10cSrcweir }
449cdf0e10cSrcweir 
~SvxAccessibleTextAdapter()450cdf0e10cSrcweir SvxAccessibleTextAdapter::~SvxAccessibleTextAdapter()
451cdf0e10cSrcweir {
452cdf0e10cSrcweir }
453cdf0e10cSrcweir 
GetParagraphCount() const454cdf0e10cSrcweir sal_uInt16 SvxAccessibleTextAdapter::GetParagraphCount() const
455cdf0e10cSrcweir {
456cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
457cdf0e10cSrcweir 
458cdf0e10cSrcweir     return mrTextForwarder->GetParagraphCount();
459cdf0e10cSrcweir }
460cdf0e10cSrcweir 
GetTextLen(sal_uInt16 nParagraph) const461cdf0e10cSrcweir sal_uInt16 SvxAccessibleTextAdapter::GetTextLen( sal_uInt16 nParagraph ) const
462cdf0e10cSrcweir {
463cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
464cdf0e10cSrcweir 
465cdf0e10cSrcweir     SvxAccessibleTextIndex aIndex;
466cdf0e10cSrcweir     aIndex.SetEEIndex( nParagraph, mrTextForwarder->GetTextLen( nParagraph ), *this );
467cdf0e10cSrcweir 
468cdf0e10cSrcweir     return static_cast< sal_uInt16 >(aIndex.GetIndex());
469cdf0e10cSrcweir }
470cdf0e10cSrcweir 
GetText(const ESelection & rSel) const471cdf0e10cSrcweir String SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
472cdf0e10cSrcweir {
473cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
474cdf0e10cSrcweir 
475cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
476cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
477cdf0e10cSrcweir 
478cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
479cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
480cdf0e10cSrcweir 
481cdf0e10cSrcweir     // normalize selection
482cdf0e10cSrcweir     if( rSel.nStartPara > rSel.nEndPara ||
483cdf0e10cSrcweir         (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
484cdf0e10cSrcweir     {
485cdf0e10cSrcweir         ::std::swap( aStartIndex, aEndIndex );
486cdf0e10cSrcweir     }
487cdf0e10cSrcweir 
488cdf0e10cSrcweir     String sStr = mrTextForwarder->GetText( MakeEESelection(aStartIndex, aEndIndex) );
489cdf0e10cSrcweir 
490cdf0e10cSrcweir     // trim field text, if necessary
491cdf0e10cSrcweir     if( aStartIndex.InField() )
492cdf0e10cSrcweir     {
493cdf0e10cSrcweir         DBG_ASSERT(aStartIndex.GetFieldOffset() >= 0 &&
494cdf0e10cSrcweir                    aStartIndex.GetFieldOffset() <= USHRT_MAX,
495cdf0e10cSrcweir                    "SvxAccessibleTextIndex::GetText: index value overflow");
496cdf0e10cSrcweir 
497cdf0e10cSrcweir         sStr.Erase(0, static_cast< sal_uInt16 > (aStartIndex.GetFieldOffset()) );
498cdf0e10cSrcweir     }
499cdf0e10cSrcweir     if( aEndIndex.InField() && aEndIndex.GetFieldOffset() )
500cdf0e10cSrcweir     {
501cdf0e10cSrcweir         DBG_ASSERT(sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) >= 0 &&
502cdf0e10cSrcweir                    sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) <= USHRT_MAX,
503cdf0e10cSrcweir                    "SvxAccessibleTextIndex::GetText: index value overflow");
504cdf0e10cSrcweir 
505cdf0e10cSrcweir         sStr = sStr.Copy(0, static_cast< sal_uInt16 > (sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset())) );
506cdf0e10cSrcweir     }
507cdf0e10cSrcweir 
508cdf0e10cSrcweir     EBulletInfo aBulletInfo1 = GetBulletInfo( static_cast< sal_uInt16 >(aStartIndex.GetParagraph()) );
509cdf0e10cSrcweir     EBulletInfo aBulletInfo2 = GetBulletInfo( static_cast< sal_uInt16 >(aEndIndex.GetParagraph()) );
510cdf0e10cSrcweir 
511cdf0e10cSrcweir     if( aEndIndex.InBullet() )
512cdf0e10cSrcweir     {
513cdf0e10cSrcweir         // append trailing bullet
514cdf0e10cSrcweir         sStr += aBulletInfo2.aText;;
515cdf0e10cSrcweir 
516cdf0e10cSrcweir         DBG_ASSERT(sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
517cdf0e10cSrcweir                    sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
518cdf0e10cSrcweir                    "SvxAccessibleTextIndex::GetText: index value overflow");
519cdf0e10cSrcweir 
520cdf0e10cSrcweir         sStr = sStr.Copy(0, static_cast< sal_uInt16 > (sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) );
521cdf0e10cSrcweir     }
522cdf0e10cSrcweir     else if( aStartIndex.GetParagraph() != aEndIndex.GetParagraph() &&
523cdf0e10cSrcweir              HaveTextBullet( aEndIndex.GetParagraph() ) )
524cdf0e10cSrcweir     {
525cdf0e10cSrcweir         String sBullet = aBulletInfo2.aText;
526cdf0e10cSrcweir 
527cdf0e10cSrcweir         DBG_ASSERT(sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
528cdf0e10cSrcweir                    sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
529cdf0e10cSrcweir                    "SvxAccessibleTextIndex::GetText: index value overflow");
530cdf0e10cSrcweir 
531cdf0e10cSrcweir         sBullet = sBullet.Copy(0, static_cast< sal_uInt16 > (sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) );
532cdf0e10cSrcweir 
533cdf0e10cSrcweir         // insert bullet
534cdf0e10cSrcweir         sStr.Insert( sBullet,
535cdf0e10cSrcweir                      static_cast< sal_uInt16 > (GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex()) );
536cdf0e10cSrcweir     }
537cdf0e10cSrcweir 
538cdf0e10cSrcweir     return sStr;
539cdf0e10cSrcweir }
540cdf0e10cSrcweir 
GetAttribs(const ESelection & rSel,sal_Bool bOnlyHardAttrib) const541cdf0e10cSrcweir SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const
542cdf0e10cSrcweir {
543cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
544cdf0e10cSrcweir 
545cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
546cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
547cdf0e10cSrcweir 
548cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
549cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
550cdf0e10cSrcweir 
551cdf0e10cSrcweir     return mrTextForwarder->GetAttribs( MakeEESelection(aStartIndex, aEndIndex),
552cdf0e10cSrcweir                                         bOnlyHardAttrib );
553cdf0e10cSrcweir }
554cdf0e10cSrcweir 
GetParaAttribs(sal_uInt16 nPara) const555cdf0e10cSrcweir SfxItemSet SvxAccessibleTextAdapter::GetParaAttribs( sal_uInt16 nPara ) const
556cdf0e10cSrcweir {
557cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
558cdf0e10cSrcweir 
559cdf0e10cSrcweir     return mrTextForwarder->GetParaAttribs( nPara );
560cdf0e10cSrcweir }
561cdf0e10cSrcweir 
SetParaAttribs(sal_uInt16 nPara,const SfxItemSet & rSet)562cdf0e10cSrcweir void SvxAccessibleTextAdapter::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
563cdf0e10cSrcweir {
564cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
565cdf0e10cSrcweir 
566cdf0e10cSrcweir     mrTextForwarder->SetParaAttribs( nPara, rSet );
567cdf0e10cSrcweir }
568cdf0e10cSrcweir 
RemoveAttribs(const ESelection &,sal_Bool,sal_uInt16)569cdf0e10cSrcweir void SvxAccessibleTextAdapter::RemoveAttribs( const ESelection& , sal_Bool , sal_uInt16 )
570cdf0e10cSrcweir {
571cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
572cdf0e10cSrcweir }
573cdf0e10cSrcweir 
GetPortions(sal_uInt16 nPara,SvUShorts & rList) const574cdf0e10cSrcweir void SvxAccessibleTextAdapter::GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const
575cdf0e10cSrcweir {
576cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
577cdf0e10cSrcweir 
578cdf0e10cSrcweir     mrTextForwarder->GetPortions( nPara, rList );
579cdf0e10cSrcweir }
580cdf0e10cSrcweir 
GetItemState(const ESelection & rSel,sal_uInt16 nWhich) const581cdf0e10cSrcweir sal_uInt16 SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
582cdf0e10cSrcweir {
583cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
584cdf0e10cSrcweir 
585cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
586cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
587cdf0e10cSrcweir 
588cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
589cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
590cdf0e10cSrcweir 
591cdf0e10cSrcweir     return mrTextForwarder->GetItemState( MakeEESelection(aStartIndex, aEndIndex),
592cdf0e10cSrcweir                                           nWhich );
593cdf0e10cSrcweir }
594cdf0e10cSrcweir 
GetItemState(sal_uInt16 nPara,sal_uInt16 nWhich) const595cdf0e10cSrcweir sal_uInt16 SvxAccessibleTextAdapter::GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const
596cdf0e10cSrcweir {
597cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
598cdf0e10cSrcweir 
599cdf0e10cSrcweir     return mrTextForwarder->GetItemState( nPara, nWhich );
600cdf0e10cSrcweir }
601cdf0e10cSrcweir 
QuickInsertText(const String & rText,const ESelection & rSel)602cdf0e10cSrcweir void SvxAccessibleTextAdapter::QuickInsertText( const String& rText, const ESelection& rSel )
603cdf0e10cSrcweir {
604cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
605cdf0e10cSrcweir 
606cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
607cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
608cdf0e10cSrcweir 
609cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
610cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
611cdf0e10cSrcweir 
612cdf0e10cSrcweir     mrTextForwarder->QuickInsertText( rText,
613cdf0e10cSrcweir                                       MakeEESelection(aStartIndex, aEndIndex) );
614cdf0e10cSrcweir }
615cdf0e10cSrcweir 
QuickInsertField(const SvxFieldItem & rFld,const ESelection & rSel)616cdf0e10cSrcweir void SvxAccessibleTextAdapter::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
617cdf0e10cSrcweir {
618cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
619cdf0e10cSrcweir 
620cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
621cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
622cdf0e10cSrcweir 
623cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
624cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
625cdf0e10cSrcweir 
626cdf0e10cSrcweir     mrTextForwarder->QuickInsertField( rFld,
627cdf0e10cSrcweir                                        MakeEESelection(aStartIndex, aEndIndex) );
628cdf0e10cSrcweir }
629cdf0e10cSrcweir 
QuickSetAttribs(const SfxItemSet & rSet,const ESelection & rSel)630cdf0e10cSrcweir void SvxAccessibleTextAdapter::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
631cdf0e10cSrcweir {
632cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
633cdf0e10cSrcweir 
634cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
635cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
636cdf0e10cSrcweir 
637cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
638cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
639cdf0e10cSrcweir 
640cdf0e10cSrcweir     mrTextForwarder->QuickSetAttribs( rSet,
641cdf0e10cSrcweir                                       MakeEESelection(aStartIndex, aEndIndex) );
642cdf0e10cSrcweir }
643cdf0e10cSrcweir 
QuickInsertLineBreak(const ESelection & rSel)644cdf0e10cSrcweir void SvxAccessibleTextAdapter::QuickInsertLineBreak( const ESelection& rSel )
645cdf0e10cSrcweir {
646cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
647cdf0e10cSrcweir 
648cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
649cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
650cdf0e10cSrcweir 
651cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
652cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
653cdf0e10cSrcweir 
654cdf0e10cSrcweir     mrTextForwarder->QuickInsertLineBreak( MakeEESelection(aStartIndex, aEndIndex) );
655cdf0e10cSrcweir }
656cdf0e10cSrcweir 
GetPool() const657cdf0e10cSrcweir SfxItemPool* SvxAccessibleTextAdapter::GetPool() const
658cdf0e10cSrcweir {
659cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
660cdf0e10cSrcweir 
661cdf0e10cSrcweir     return mrTextForwarder->GetPool();
662cdf0e10cSrcweir }
663cdf0e10cSrcweir 
CalcFieldValue(const SvxFieldItem & rField,sal_uInt16 nPara,sal_uInt16 nPos,Color * & rpTxtColor,Color * & rpFldColor)664cdf0e10cSrcweir XubString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor )
665cdf0e10cSrcweir {
666cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
667cdf0e10cSrcweir 
668cdf0e10cSrcweir     return mrTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
669cdf0e10cSrcweir }
670cdf0e10cSrcweir 
FieldClicked(const SvxFieldItem & rField,sal_uInt16 nPara,xub_StrLen nPos)671cdf0e10cSrcweir void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos )
672cdf0e10cSrcweir {
673cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
674cdf0e10cSrcweir 
675cdf0e10cSrcweir     mrTextForwarder->FieldClicked( rField, nPara, nPos );
676cdf0e10cSrcweir }
677cdf0e10cSrcweir 
CalcLogicalIndex(sal_uInt16 nPara,sal_uInt16 nEEIndex)678cdf0e10cSrcweir sal_Int32 SvxAccessibleTextAdapter::CalcLogicalIndex( sal_uInt16 nPara, sal_uInt16 nEEIndex )
679cdf0e10cSrcweir {
680cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
681cdf0e10cSrcweir 
682cdf0e10cSrcweir     SvxAccessibleTextIndex aIndex;
683cdf0e10cSrcweir     aIndex.SetEEIndex(nPara, nEEIndex, *mrTextForwarder);
684cdf0e10cSrcweir     return aIndex.GetIndex();
685cdf0e10cSrcweir }
686cdf0e10cSrcweir 
CalcEditEngineIndex(sal_uInt16 nPara,sal_Int32 nLogicalIndex)687cdf0e10cSrcweir sal_uInt16 SvxAccessibleTextAdapter::CalcEditEngineIndex( sal_uInt16 nPara, sal_Int32 nLogicalIndex )
688cdf0e10cSrcweir {
689cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
690cdf0e10cSrcweir 
691cdf0e10cSrcweir     SvxAccessibleTextIndex aIndex;
692cdf0e10cSrcweir     aIndex.SetIndex(nPara, nLogicalIndex, *mrTextForwarder);
693cdf0e10cSrcweir     return aIndex.GetEEIndex();
694cdf0e10cSrcweir }
695cdf0e10cSrcweir 
696cdf0e10cSrcweir 
697cdf0e10cSrcweir 
IsValid() const698cdf0e10cSrcweir sal_Bool SvxAccessibleTextAdapter::IsValid() const
699cdf0e10cSrcweir {
700cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
701cdf0e10cSrcweir 
702cdf0e10cSrcweir     if( mrTextForwarder )
703cdf0e10cSrcweir         return mrTextForwarder->IsValid();
704cdf0e10cSrcweir     else
705cdf0e10cSrcweir         return sal_False;
706cdf0e10cSrcweir }
707cdf0e10cSrcweir 
GetLanguage(sal_uInt16 nPara,sal_uInt16 nPos) const708cdf0e10cSrcweir LanguageType SvxAccessibleTextAdapter::GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const
709cdf0e10cSrcweir {
710cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
711cdf0e10cSrcweir 
712cdf0e10cSrcweir     SvxAccessibleTextIndex aIndex;
713cdf0e10cSrcweir 
714cdf0e10cSrcweir     aIndex.SetIndex( nPara, nPos, *this );
715cdf0e10cSrcweir 
716cdf0e10cSrcweir     return mrTextForwarder->GetLanguage( nPara, aIndex.GetEEIndex() );
717cdf0e10cSrcweir }
718cdf0e10cSrcweir 
GetFieldCount(sal_uInt16 nPara) const719cdf0e10cSrcweir sal_uInt16 SvxAccessibleTextAdapter::GetFieldCount( sal_uInt16 nPara ) const
720cdf0e10cSrcweir {
721cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
722cdf0e10cSrcweir 
723cdf0e10cSrcweir     return mrTextForwarder->GetFieldCount( nPara );
724cdf0e10cSrcweir }
725cdf0e10cSrcweir 
GetFieldInfo(sal_uInt16 nPara,sal_uInt16 nField) const726cdf0e10cSrcweir EFieldInfo SvxAccessibleTextAdapter::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const
727cdf0e10cSrcweir {
728cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
729cdf0e10cSrcweir 
730cdf0e10cSrcweir     return mrTextForwarder->GetFieldInfo( nPara, nField );
731cdf0e10cSrcweir }
732cdf0e10cSrcweir 
GetBulletInfo(sal_uInt16 nPara) const733cdf0e10cSrcweir EBulletInfo SvxAccessibleTextAdapter::GetBulletInfo( sal_uInt16 nPara ) const
734cdf0e10cSrcweir {
735cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
736cdf0e10cSrcweir 
737cdf0e10cSrcweir     return mrTextForwarder->GetBulletInfo( nPara );
738cdf0e10cSrcweir }
SetUpdateModeForAcc(sal_Bool bUp)739*9b8096d0SSteve Yin void	SvxAccessibleTextAdapter::SetUpdateModeForAcc( sal_Bool bUp)
740*9b8096d0SSteve Yin {
741*9b8096d0SSteve Yin 	return mrTextForwarder->SetUpdateModeForAcc( bUp );
742*9b8096d0SSteve Yin }
GetUpdateModeForAcc() const743*9b8096d0SSteve Yin sal_Bool	SvxAccessibleTextAdapter::GetUpdateModeForAcc( ) const
744*9b8096d0SSteve Yin {
745*9b8096d0SSteve Yin 	return mrTextForwarder->GetUpdateModeForAcc( );
746*9b8096d0SSteve Yin }
GetCharBounds(sal_uInt16 nPara,sal_uInt16 nIndex) const747cdf0e10cSrcweir Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const
748cdf0e10cSrcweir {
749cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
750cdf0e10cSrcweir 
751cdf0e10cSrcweir     SvxAccessibleTextIndex aIndex;
752cdf0e10cSrcweir     aIndex.SetIndex( nPara, nIndex, *this );
753cdf0e10cSrcweir 
754cdf0e10cSrcweir     // preset if anything goes wrong below
755cdf0e10cSrcweir     // n-th char in GetParagraphIndex's paragraph
756cdf0e10cSrcweir     Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, static_cast< sal_uInt16 >( aIndex.GetEEIndex() ) );
757cdf0e10cSrcweir 
758cdf0e10cSrcweir     if( aIndex.InBullet() )
759cdf0e10cSrcweir     {
760cdf0e10cSrcweir         EBulletInfo aBulletInfo = GetBulletInfo( nPara );
761cdf0e10cSrcweir 
762cdf0e10cSrcweir         OutputDevice* pOutDev = GetRefDevice();
763cdf0e10cSrcweir 
764cdf0e10cSrcweir         DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
765cdf0e10cSrcweir 
766cdf0e10cSrcweir         // preset if anything goes wrong below
767cdf0e10cSrcweir         aRect = aBulletInfo.aBounds; // better than nothing
768cdf0e10cSrcweir         if( pOutDev )
769cdf0e10cSrcweir         {
770cdf0e10cSrcweir             AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
771cdf0e10cSrcweir 
772cdf0e10cSrcweir             if( aStringWrap.GetCharacterBounds( aIndex.GetBulletOffset(), aRect ) )
773cdf0e10cSrcweir                 aRect.Move( aBulletInfo.aBounds.Left(), aBulletInfo.aBounds.Top() );
774cdf0e10cSrcweir         }
775cdf0e10cSrcweir     }
776cdf0e10cSrcweir     else
777cdf0e10cSrcweir     {
778cdf0e10cSrcweir         // handle field content manually
779cdf0e10cSrcweir         if( aIndex.InField() )
780cdf0e10cSrcweir         {
781cdf0e10cSrcweir             OutputDevice* pOutDev = GetRefDevice();
782cdf0e10cSrcweir 
783cdf0e10cSrcweir             DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
784cdf0e10cSrcweir 
785cdf0e10cSrcweir             if( pOutDev )
786cdf0e10cSrcweir             {
787cdf0e10cSrcweir                 ESelection aSel = MakeEESelection( aIndex );
788cdf0e10cSrcweir 
789cdf0e10cSrcweir                 SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mrTextForwarder->GetAttribs( aSel ) );
790cdf0e10cSrcweir                 AccessibleStringWrap aStringWrap( *pOutDev,
791cdf0e10cSrcweir                                                   aFont,
792cdf0e10cSrcweir                                                   mrTextForwarder->GetText( aSel ) );
793cdf0e10cSrcweir 
794cdf0e10cSrcweir                 Rectangle aStartRect = mrTextForwarder->GetCharBounds( nPara, static_cast< sal_uInt16 >( aIndex.GetEEIndex() ) );
795cdf0e10cSrcweir 
796cdf0e10cSrcweir                 if( !aStringWrap.GetCharacterBounds( aIndex.GetFieldOffset(), aRect ) )
797cdf0e10cSrcweir                     aRect = aStartRect;
798cdf0e10cSrcweir                 else
799cdf0e10cSrcweir                     aRect.Move( aStartRect.Left(), aStartRect.Top() );
800cdf0e10cSrcweir             }
801cdf0e10cSrcweir         }
802cdf0e10cSrcweir     }
803cdf0e10cSrcweir 
804cdf0e10cSrcweir     return aRect;
805cdf0e10cSrcweir }
806cdf0e10cSrcweir 
GetParaBounds(sal_uInt16 nPara) const807cdf0e10cSrcweir Rectangle SvxAccessibleTextAdapter::GetParaBounds( sal_uInt16 nPara ) const
808cdf0e10cSrcweir {
809cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
810cdf0e10cSrcweir 
811cdf0e10cSrcweir     EBulletInfo aBulletInfo = GetBulletInfo( nPara );
812cdf0e10cSrcweir 
813cdf0e10cSrcweir     if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
814cdf0e10cSrcweir         aBulletInfo.bVisible &&
815cdf0e10cSrcweir         aBulletInfo.nType != SVX_NUM_BITMAP )
816cdf0e10cSrcweir     {
817cdf0e10cSrcweir         // include bullet in para bounding box
818cdf0e10cSrcweir         Rectangle aRect( mrTextForwarder->GetParaBounds( nPara ) );
819cdf0e10cSrcweir 
820cdf0e10cSrcweir         aRect.Union( aBulletInfo.aBounds );
821cdf0e10cSrcweir 
822cdf0e10cSrcweir         return aRect;
823cdf0e10cSrcweir     }
824cdf0e10cSrcweir 
825cdf0e10cSrcweir     return mrTextForwarder->GetParaBounds( nPara );
826cdf0e10cSrcweir }
827cdf0e10cSrcweir 
GetMapMode() const828cdf0e10cSrcweir MapMode SvxAccessibleTextAdapter::GetMapMode() const
829cdf0e10cSrcweir {
830cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
831cdf0e10cSrcweir 
832cdf0e10cSrcweir     return mrTextForwarder->GetMapMode();
833cdf0e10cSrcweir }
834cdf0e10cSrcweir 
GetRefDevice() const835cdf0e10cSrcweir OutputDevice* SvxAccessibleTextAdapter::GetRefDevice() const
836cdf0e10cSrcweir {
837cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
838cdf0e10cSrcweir 
839cdf0e10cSrcweir     return mrTextForwarder->GetRefDevice();
840cdf0e10cSrcweir }
841cdf0e10cSrcweir 
GetIndexAtPoint(const Point & rPoint,sal_uInt16 & nPara,sal_uInt16 & nIndex) const842cdf0e10cSrcweir sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_uInt16& nPara, sal_uInt16& nIndex ) const
843cdf0e10cSrcweir {
844cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
845cdf0e10cSrcweir 
846cdf0e10cSrcweir     if( !mrTextForwarder->GetIndexAtPoint( rPoint, nPara, nIndex ) )
847cdf0e10cSrcweir         return sal_False;
848cdf0e10cSrcweir 
849cdf0e10cSrcweir     SvxAccessibleTextIndex aIndex;
850cdf0e10cSrcweir     aIndex.SetEEIndex(nPara, nIndex, *this);
851cdf0e10cSrcweir 
852cdf0e10cSrcweir     DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX,
853cdf0e10cSrcweir                "SvxAccessibleTextIndex::SetIndex: index value overflow");
854cdf0e10cSrcweir 
855cdf0e10cSrcweir     nIndex = static_cast< sal_uInt16 > (aIndex.GetIndex());
856cdf0e10cSrcweir 
857cdf0e10cSrcweir     EBulletInfo aBulletInfo = GetBulletInfo( nPara );
858cdf0e10cSrcweir 
859cdf0e10cSrcweir     // any text bullets?
860cdf0e10cSrcweir     if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
861cdf0e10cSrcweir         aBulletInfo.bVisible &&
862cdf0e10cSrcweir         aBulletInfo.nType != SVX_NUM_BITMAP )
863cdf0e10cSrcweir     {
864cdf0e10cSrcweir         if( aBulletInfo.aBounds.IsInside( rPoint) )
865cdf0e10cSrcweir         {
866cdf0e10cSrcweir             OutputDevice* pOutDev = GetRefDevice();
867cdf0e10cSrcweir 
868cdf0e10cSrcweir             DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
869cdf0e10cSrcweir 
870cdf0e10cSrcweir             if( !pOutDev )
871cdf0e10cSrcweir                 return sal_False;
872cdf0e10cSrcweir 
873cdf0e10cSrcweir             AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
874cdf0e10cSrcweir 
875cdf0e10cSrcweir             Point aPoint = rPoint;
876cdf0e10cSrcweir             aPoint.Move( -aBulletInfo.aBounds.Left(), -aBulletInfo.aBounds.Top() );
877cdf0e10cSrcweir 
878cdf0e10cSrcweir             DBG_ASSERT(aStringWrap.GetIndexAtPoint( aPoint ) >= 0 &&
879cdf0e10cSrcweir                        aStringWrap.GetIndexAtPoint( aPoint ) <= USHRT_MAX,
880cdf0e10cSrcweir                        "SvxAccessibleTextIndex::SetIndex: index value overflow");
881cdf0e10cSrcweir 
882cdf0e10cSrcweir             nIndex = static_cast< sal_uInt16 > (aStringWrap.GetIndexAtPoint( aPoint ));
883cdf0e10cSrcweir             return sal_True;
884cdf0e10cSrcweir         }
885cdf0e10cSrcweir     }
886cdf0e10cSrcweir 
887cdf0e10cSrcweir     if( aIndex.InField() )
888cdf0e10cSrcweir     {
889cdf0e10cSrcweir         OutputDevice* pOutDev = GetRefDevice();
890cdf0e10cSrcweir 
891cdf0e10cSrcweir         DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
892cdf0e10cSrcweir 
893cdf0e10cSrcweir         if( !pOutDev )
894cdf0e10cSrcweir             return sal_False;
895cdf0e10cSrcweir 
896cdf0e10cSrcweir         ESelection aSelection = MakeEESelection( aIndex );
897cdf0e10cSrcweir         SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mrTextForwarder->GetAttribs( aSelection ) );
898cdf0e10cSrcweir         AccessibleStringWrap aStringWrap( *pOutDev,
899cdf0e10cSrcweir                                           aFont,
900cdf0e10cSrcweir                                           mrTextForwarder->GetText( aSelection ) );
901cdf0e10cSrcweir 
902cdf0e10cSrcweir         Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
903cdf0e10cSrcweir         Point aPoint = rPoint;
904cdf0e10cSrcweir         aPoint.Move( -aRect.Left(), -aRect.Top() );
905cdf0e10cSrcweir 
906cdf0e10cSrcweir         DBG_ASSERT(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) >= 0 &&
907cdf0e10cSrcweir                    aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) <= USHRT_MAX,
908cdf0e10cSrcweir                    "SvxAccessibleTextIndex::SetIndex: index value overflow");
909cdf0e10cSrcweir 
910cdf0e10cSrcweir         nIndex = static_cast< sal_uInt16 >(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint ));
911cdf0e10cSrcweir         return sal_True;
912cdf0e10cSrcweir     }
913cdf0e10cSrcweir 
914cdf0e10cSrcweir     return sal_True;
915cdf0e10cSrcweir }
916cdf0e10cSrcweir 
GetWordIndices(sal_uInt16 nPara,sal_uInt16 nIndex,sal_uInt16 & nStart,sal_uInt16 & nEnd) const917cdf0e10cSrcweir sal_Bool SvxAccessibleTextAdapter::GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const
918cdf0e10cSrcweir {
919cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
920cdf0e10cSrcweir 
921cdf0e10cSrcweir     SvxAccessibleTextIndex aIndex;
922cdf0e10cSrcweir     aIndex.SetIndex(nPara, nIndex, *this);
923cdf0e10cSrcweir     nIndex = aIndex.GetEEIndex();
924cdf0e10cSrcweir 
925cdf0e10cSrcweir     if( aIndex.InBullet() )
926cdf0e10cSrcweir     {
927cdf0e10cSrcweir         DBG_ASSERT(aIndex.GetBulletLen() >= 0 &&
928cdf0e10cSrcweir                    aIndex.GetBulletLen() <= USHRT_MAX,
929cdf0e10cSrcweir                    "SvxAccessibleTextIndex::SetIndex: index value overflow");
930cdf0e10cSrcweir 
931cdf0e10cSrcweir         // always treat bullet as separate word
932cdf0e10cSrcweir         nStart = 0;
933cdf0e10cSrcweir         nEnd = static_cast< sal_uInt16 > (aIndex.GetBulletLen());
934cdf0e10cSrcweir 
935cdf0e10cSrcweir         return sal_True;
936cdf0e10cSrcweir     }
937cdf0e10cSrcweir 
938cdf0e10cSrcweir     if( aIndex.InField() )
939cdf0e10cSrcweir     {
940cdf0e10cSrcweir         DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
941cdf0e10cSrcweir                    aIndex.GetIndex() - aIndex.GetFieldOffset() <= USHRT_MAX &&
942cdf0e10cSrcweir                    nStart + aIndex.GetFieldLen() >= 0 &&
943cdf0e10cSrcweir                    nStart + aIndex.GetFieldLen() <= USHRT_MAX,
944cdf0e10cSrcweir                    "SvxAccessibleTextIndex::SetIndex: index value overflow");
945cdf0e10cSrcweir 
946cdf0e10cSrcweir         // always treat field as separate word
947cdf0e10cSrcweir         // TODO: to circumvent this, _we_ would have to do the break iterator stuff!
948cdf0e10cSrcweir         nStart = static_cast< sal_uInt16 > (aIndex.GetIndex() - aIndex.GetFieldOffset());
949cdf0e10cSrcweir         nEnd = static_cast< sal_uInt16 > (nStart + aIndex.GetFieldLen());
950cdf0e10cSrcweir 
951cdf0e10cSrcweir         return sal_True;
952cdf0e10cSrcweir     }
953cdf0e10cSrcweir 
954cdf0e10cSrcweir     if( !mrTextForwarder->GetWordIndices( nPara, nIndex, nStart, nEnd ) )
955cdf0e10cSrcweir         return sal_False;
956cdf0e10cSrcweir 
957cdf0e10cSrcweir     aIndex.SetEEIndex( nPara, nStart, *this );
958cdf0e10cSrcweir     DBG_ASSERT(aIndex.GetIndex() >= 0 &&
959cdf0e10cSrcweir                aIndex.GetIndex() <= USHRT_MAX,
960cdf0e10cSrcweir                "SvxAccessibleTextIndex::SetIndex: index value overflow");
961cdf0e10cSrcweir     nStart = static_cast< sal_uInt16 > (aIndex.GetIndex());
962cdf0e10cSrcweir 
963cdf0e10cSrcweir     aIndex.SetEEIndex( nPara, nEnd, *this );
964cdf0e10cSrcweir     DBG_ASSERT(aIndex.GetIndex() >= 0 &&
965cdf0e10cSrcweir                aIndex.GetIndex() <= USHRT_MAX,
966cdf0e10cSrcweir                "SvxAccessibleTextIndex::SetIndex: index value overflow");
967cdf0e10cSrcweir     nEnd = static_cast< sal_uInt16 > (aIndex.GetIndex());
968cdf0e10cSrcweir 
969cdf0e10cSrcweir     return sal_True;
970cdf0e10cSrcweir }
GetAttributeRun(sal_uInt16 & nStartIndex,sal_uInt16 & nEndIndex,sal_uInt16 nPara,sal_uInt16 nIndex,sal_Bool) const971*9b8096d0SSteve Yin sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool /* bInCell */) const
972cdf0e10cSrcweir {
973cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
974cdf0e10cSrcweir 
975cdf0e10cSrcweir     SvxAccessibleTextIndex aIndex;
976cdf0e10cSrcweir     aIndex.SetIndex(nPara, nIndex, *this);
977cdf0e10cSrcweir     nIndex = aIndex.GetEEIndex();
978cdf0e10cSrcweir 
979cdf0e10cSrcweir     if( aIndex.InBullet() )
980cdf0e10cSrcweir     {
981cdf0e10cSrcweir         DBG_ASSERT(aIndex.GetBulletLen() >= 0 &&
982cdf0e10cSrcweir                    aIndex.GetBulletLen() <= USHRT_MAX,
983cdf0e10cSrcweir                    "SvxAccessibleTextIndex::SetIndex: index value overflow");
984cdf0e10cSrcweir 
985cdf0e10cSrcweir         // always treat bullet as distinct attribute
986cdf0e10cSrcweir         nStartIndex = 0;
987cdf0e10cSrcweir         nEndIndex = static_cast< sal_uInt16 > (aIndex.GetBulletLen());
988cdf0e10cSrcweir 
989cdf0e10cSrcweir         return sal_True;
990cdf0e10cSrcweir     }
991cdf0e10cSrcweir 
992cdf0e10cSrcweir     if( aIndex.InField() )
993cdf0e10cSrcweir     {
994cdf0e10cSrcweir         DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
995cdf0e10cSrcweir                    aIndex.GetIndex() - aIndex.GetFieldOffset() <= USHRT_MAX,
996cdf0e10cSrcweir                    "SvxAccessibleTextIndex::SetIndex: index value overflow");
997cdf0e10cSrcweir 
998cdf0e10cSrcweir         // always treat field as distinct attribute
999cdf0e10cSrcweir         nStartIndex = static_cast< sal_uInt16 > (aIndex.GetIndex() - aIndex.GetFieldOffset());
1000cdf0e10cSrcweir         nEndIndex = static_cast< sal_uInt16 > (nStartIndex + aIndex.GetFieldLen());
1001cdf0e10cSrcweir 
1002cdf0e10cSrcweir         return sal_True;
1003cdf0e10cSrcweir     }
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir     if( !mrTextForwarder->GetAttributeRun( nStartIndex, nEndIndex, nPara, nIndex ) )
1006cdf0e10cSrcweir         return sal_False;
1007cdf0e10cSrcweir 
1008cdf0e10cSrcweir     aIndex.SetEEIndex( nPara, nStartIndex, *this );
1009cdf0e10cSrcweir     DBG_ASSERT(aIndex.GetIndex() >= 0 &&
1010cdf0e10cSrcweir                aIndex.GetIndex() <= USHRT_MAX,
1011cdf0e10cSrcweir                "SvxAccessibleTextIndex::SetIndex: index value overflow");
1012cdf0e10cSrcweir     nStartIndex = static_cast< sal_uInt16 > (aIndex.GetIndex());
1013cdf0e10cSrcweir 
1014cdf0e10cSrcweir     aIndex.SetEEIndex( nPara, nEndIndex, *this );
1015cdf0e10cSrcweir     DBG_ASSERT(aIndex.GetIndex() >= 0 &&
1016cdf0e10cSrcweir                aIndex.GetIndex() <= USHRT_MAX,
1017cdf0e10cSrcweir                "SvxAccessibleTextIndex::SetIndex: index value overflow");
1018cdf0e10cSrcweir     nEndIndex = static_cast< sal_uInt16 > (aIndex.GetIndex());
1019cdf0e10cSrcweir 
1020cdf0e10cSrcweir     return sal_True;
1021cdf0e10cSrcweir }
1022cdf0e10cSrcweir 
GetLineCount(sal_uInt16 nPara) const1023cdf0e10cSrcweir sal_uInt16 SvxAccessibleTextAdapter::GetLineCount( sal_uInt16 nPara ) const
1024cdf0e10cSrcweir {
1025cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1026cdf0e10cSrcweir 
1027cdf0e10cSrcweir     return mrTextForwarder->GetLineCount( nPara );
1028cdf0e10cSrcweir }
1029cdf0e10cSrcweir 
GetLineLen(sal_uInt16 nPara,sal_uInt16 nLine) const1030cdf0e10cSrcweir sal_uInt16 SvxAccessibleTextAdapter::GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const
1031cdf0e10cSrcweir {
1032cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
1035cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
1036cdf0e10cSrcweir     sal_uInt16 nCurrLine;
1037cdf0e10cSrcweir     sal_uInt16 nCurrIndex, nLastIndex;
1038cdf0e10cSrcweir     for( nCurrLine=0, nCurrIndex=0, nLastIndex=0; nCurrLine<=nLine; ++nCurrLine )
1039cdf0e10cSrcweir     {
1040cdf0e10cSrcweir         nLastIndex = nCurrIndex;
1041cdf0e10cSrcweir         nCurrIndex =
1042cdf0e10cSrcweir             nCurrIndex + mrTextForwarder->GetLineLen( nPara, nCurrLine );
1043cdf0e10cSrcweir     }
1044cdf0e10cSrcweir 
1045cdf0e10cSrcweir     aEndIndex.SetEEIndex( nPara, nCurrIndex, *this );
1046cdf0e10cSrcweir     if( nLine > 0 )
1047cdf0e10cSrcweir     {
1048cdf0e10cSrcweir         aStartIndex.SetEEIndex( nPara, nLastIndex, *this );
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir         return static_cast< sal_uInt16 >(aEndIndex.GetIndex() - aStartIndex.GetIndex());
1051cdf0e10cSrcweir     }
1052cdf0e10cSrcweir     else
1053cdf0e10cSrcweir         return static_cast< sal_uInt16 >(aEndIndex.GetIndex());
1054cdf0e10cSrcweir }
1055cdf0e10cSrcweir 
GetLineBoundaries(sal_uInt16 & rStart,sal_uInt16 & rEnd,sal_uInt16 nParagraph,sal_uInt16 nLine) const1056cdf0e10cSrcweir void SvxAccessibleTextAdapter::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const
1057cdf0e10cSrcweir {
1058cdf0e10cSrcweir     mrTextForwarder->GetLineBoundaries( rStart, rEnd, nParagraph, nLine );
1059cdf0e10cSrcweir }
1060cdf0e10cSrcweir 
GetLineNumberAtIndex(sal_uInt16 nPara,sal_uInt16 nIndex) const1061cdf0e10cSrcweir sal_uInt16 SvxAccessibleTextAdapter::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const
1062cdf0e10cSrcweir {
1063cdf0e10cSrcweir     return mrTextForwarder->GetLineNumberAtIndex( nPara, nIndex );
1064cdf0e10cSrcweir }
1065cdf0e10cSrcweir 
Delete(const ESelection & rSel)1066cdf0e10cSrcweir sal_Bool SvxAccessibleTextAdapter::Delete( const ESelection& rSel )
1067cdf0e10cSrcweir {
1068cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
1071cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
1074cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir     return mrTextForwarder->Delete( MakeEESelection(aStartIndex, aEndIndex ) );
1077cdf0e10cSrcweir }
1078cdf0e10cSrcweir 
InsertText(const String & rStr,const ESelection & rSel)1079cdf0e10cSrcweir sal_Bool SvxAccessibleTextAdapter::InsertText( const String& rStr, const ESelection& rSel )
1080cdf0e10cSrcweir {
1081cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
1084cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
1085cdf0e10cSrcweir 
1086cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
1087cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
1088cdf0e10cSrcweir 
1089cdf0e10cSrcweir     return mrTextForwarder->InsertText( rStr, MakeEESelection(aStartIndex, aEndIndex) );
1090cdf0e10cSrcweir }
1091cdf0e10cSrcweir 
QuickFormatDoc(sal_Bool bFull)1092cdf0e10cSrcweir sal_Bool SvxAccessibleTextAdapter::QuickFormatDoc( sal_Bool bFull )
1093cdf0e10cSrcweir {
1094cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir     return mrTextForwarder->QuickFormatDoc( bFull );
1097cdf0e10cSrcweir }
1098cdf0e10cSrcweir 
GetDepth(sal_uInt16 nPara) const1099cdf0e10cSrcweir sal_Int16 SvxAccessibleTextAdapter::GetDepth( sal_uInt16 nPara ) const
1100cdf0e10cSrcweir {
1101cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir     return mrTextForwarder->GetDepth( nPara );
1104cdf0e10cSrcweir }
1105cdf0e10cSrcweir 
SetDepth(sal_uInt16 nPara,sal_Int16 nNewDepth)1106cdf0e10cSrcweir sal_Bool SvxAccessibleTextAdapter::SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth )
1107cdf0e10cSrcweir {
1108cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir     return mrTextForwarder->SetDepth( nPara, nNewDepth );
1111cdf0e10cSrcweir }
1112cdf0e10cSrcweir 
SetForwarder(SvxTextForwarder & rForwarder)1113cdf0e10cSrcweir void SvxAccessibleTextAdapter::SetForwarder( SvxTextForwarder& rForwarder )
1114cdf0e10cSrcweir {
1115cdf0e10cSrcweir     mrTextForwarder = &rForwarder;
1116cdf0e10cSrcweir }
1117cdf0e10cSrcweir 
HaveImageBullet(sal_uInt16 nPara) const1118cdf0e10cSrcweir sal_Bool SvxAccessibleTextAdapter::HaveImageBullet( sal_uInt16 nPara ) const
1119cdf0e10cSrcweir {
1120cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1121cdf0e10cSrcweir 
1122cdf0e10cSrcweir     EBulletInfo aBulletInfo = GetBulletInfo( nPara );
1123cdf0e10cSrcweir 
1124cdf0e10cSrcweir     if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
1125cdf0e10cSrcweir         aBulletInfo.bVisible &&
1126cdf0e10cSrcweir         aBulletInfo.nType == SVX_NUM_BITMAP )
1127cdf0e10cSrcweir     {
1128cdf0e10cSrcweir         return sal_True;
1129cdf0e10cSrcweir     }
1130cdf0e10cSrcweir     else
1131cdf0e10cSrcweir     {
1132cdf0e10cSrcweir         return sal_False;
1133cdf0e10cSrcweir     }
1134cdf0e10cSrcweir }
1135cdf0e10cSrcweir 
HaveTextBullet(sal_uInt16 nPara) const1136cdf0e10cSrcweir sal_Bool SvxAccessibleTextAdapter::HaveTextBullet( sal_uInt16 nPara ) const
1137cdf0e10cSrcweir {
1138cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1139cdf0e10cSrcweir 
1140cdf0e10cSrcweir     EBulletInfo aBulletInfo = GetBulletInfo( nPara );
1141cdf0e10cSrcweir 
1142cdf0e10cSrcweir     if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
1143cdf0e10cSrcweir         aBulletInfo.bVisible &&
1144cdf0e10cSrcweir         aBulletInfo.nType != SVX_NUM_BITMAP )
1145cdf0e10cSrcweir     {
1146cdf0e10cSrcweir         return sal_True;
1147cdf0e10cSrcweir     }
1148cdf0e10cSrcweir     else
1149cdf0e10cSrcweir     {
1150cdf0e10cSrcweir         return sal_False;
1151cdf0e10cSrcweir     }
1152cdf0e10cSrcweir }
1153cdf0e10cSrcweir 
IsEditable(const ESelection & rSel)1154cdf0e10cSrcweir sal_Bool SvxAccessibleTextAdapter::IsEditable( const ESelection& rSel )
1155cdf0e10cSrcweir {
1156cdf0e10cSrcweir     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
1157cdf0e10cSrcweir 
1158cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
1159cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
1160cdf0e10cSrcweir 
1161cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
1162cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
1163cdf0e10cSrcweir 
1164cdf0e10cSrcweir     // normalize selection
1165cdf0e10cSrcweir     if( rSel.nStartPara > rSel.nEndPara ||
1166cdf0e10cSrcweir         (rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
1167cdf0e10cSrcweir     {
1168cdf0e10cSrcweir         ::std::swap( aStartIndex, aEndIndex );
1169cdf0e10cSrcweir     }
1170cdf0e10cSrcweir 
1171cdf0e10cSrcweir     return aStartIndex.IsEditableRange( aEndIndex );
1172cdf0e10cSrcweir }
1173cdf0e10cSrcweir 
GetEmptyItemSetPtr()1174cdf0e10cSrcweir const SfxItemSet * SvxAccessibleTextAdapter::GetEmptyItemSetPtr()
1175cdf0e10cSrcweir {
1176cdf0e10cSrcweir     DBG_ERROR( "not implemented" );
1177cdf0e10cSrcweir     return 0;
1178cdf0e10cSrcweir }
1179cdf0e10cSrcweir 
AppendParagraph()1180cdf0e10cSrcweir void SvxAccessibleTextAdapter::AppendParagraph()
1181cdf0e10cSrcweir {
1182cdf0e10cSrcweir     DBG_ERROR( "not implemented" );
1183cdf0e10cSrcweir }
1184cdf0e10cSrcweir 
AppendTextPortion(sal_uInt16,const String &,const SfxItemSet &)1185cdf0e10cSrcweir xub_StrLen SvxAccessibleTextAdapter::AppendTextPortion( sal_uInt16, const String &, const SfxItemSet & )
1186cdf0e10cSrcweir {
1187cdf0e10cSrcweir     DBG_ERROR( "not implemented" );
1188cdf0e10cSrcweir     return 0;
1189cdf0e10cSrcweir }
CopyText(const SvxTextForwarder &)1190cdf0e10cSrcweir void        SvxAccessibleTextAdapter::CopyText(const SvxTextForwarder&)
1191cdf0e10cSrcweir {
1192cdf0e10cSrcweir     DBG_ERROR( "not implemented" );
1193cdf0e10cSrcweir }
1194cdf0e10cSrcweir 
1195cdf0e10cSrcweir 
1196cdf0e10cSrcweir 
1197cdf0e10cSrcweir //---------------------------------------------------------------------------------------
1198cdf0e10cSrcweir 
SvxAccessibleTextEditViewAdapter()1199cdf0e10cSrcweir SvxAccessibleTextEditViewAdapter::SvxAccessibleTextEditViewAdapter()
1200cdf0e10cSrcweir {
1201cdf0e10cSrcweir }
1202cdf0e10cSrcweir 
~SvxAccessibleTextEditViewAdapter()1203cdf0e10cSrcweir SvxAccessibleTextEditViewAdapter::~SvxAccessibleTextEditViewAdapter()
1204cdf0e10cSrcweir {
1205cdf0e10cSrcweir }
1206cdf0e10cSrcweir 
IsValid() const1207cdf0e10cSrcweir sal_Bool SvxAccessibleTextEditViewAdapter::IsValid() const
1208cdf0e10cSrcweir {
1209cdf0e10cSrcweir     DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir     if( mrViewForwarder )
1212cdf0e10cSrcweir         return mrViewForwarder->IsValid();
1213cdf0e10cSrcweir     else
1214cdf0e10cSrcweir         return sal_False;
1215cdf0e10cSrcweir }
1216cdf0e10cSrcweir 
GetVisArea() const1217cdf0e10cSrcweir Rectangle SvxAccessibleTextEditViewAdapter::GetVisArea() const
1218cdf0e10cSrcweir {
1219cdf0e10cSrcweir     DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1220cdf0e10cSrcweir 
1221cdf0e10cSrcweir     return mrViewForwarder->GetVisArea();
1222cdf0e10cSrcweir }
1223cdf0e10cSrcweir 
LogicToPixel(const Point & rPoint,const MapMode & rMapMode) const1224cdf0e10cSrcweir Point SvxAccessibleTextEditViewAdapter::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
1225cdf0e10cSrcweir {
1226cdf0e10cSrcweir     DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1227cdf0e10cSrcweir 
1228cdf0e10cSrcweir     return mrViewForwarder->LogicToPixel(rPoint, rMapMode);
1229cdf0e10cSrcweir }
1230cdf0e10cSrcweir 
PixelToLogic(const Point & rPoint,const MapMode & rMapMode) const1231cdf0e10cSrcweir Point SvxAccessibleTextEditViewAdapter::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
1232cdf0e10cSrcweir {
1233cdf0e10cSrcweir     DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1234cdf0e10cSrcweir 
1235cdf0e10cSrcweir     return mrViewForwarder->PixelToLogic(rPoint, rMapMode);
1236cdf0e10cSrcweir }
1237cdf0e10cSrcweir 
GetSelection(ESelection & rSel) const1238cdf0e10cSrcweir sal_Bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const
1239cdf0e10cSrcweir {
1240cdf0e10cSrcweir     DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1241cdf0e10cSrcweir 
1242cdf0e10cSrcweir     ESelection aSelection;
1243cdf0e10cSrcweir 
1244cdf0e10cSrcweir     if( !mrViewForwarder->GetSelection( aSelection ) )
1245cdf0e10cSrcweir         return sal_False;
1246cdf0e10cSrcweir 
1247cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
1248cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir     aStartIndex.SetEEIndex( aSelection.nStartPara, aSelection.nStartPos, *mrTextForwarder );
1251cdf0e10cSrcweir     aEndIndex.SetEEIndex( aSelection.nEndPara, aSelection.nEndPos, *mrTextForwarder );
1252cdf0e10cSrcweir 
1253cdf0e10cSrcweir     DBG_ASSERT(aStartIndex.GetIndex() >= 0 && aStartIndex.GetIndex() <= USHRT_MAX &&
1254cdf0e10cSrcweir                aEndIndex.GetIndex() >= 0 && aEndIndex.GetIndex() <= USHRT_MAX,
1255cdf0e10cSrcweir                "SvxAccessibleTextEditViewAdapter::GetSelection: index value overflow");
1256cdf0e10cSrcweir 
1257cdf0e10cSrcweir     rSel = ESelection( aStartIndex.GetParagraph(), static_cast< sal_uInt16 > (aStartIndex.GetIndex()),
1258cdf0e10cSrcweir                        aEndIndex.GetParagraph(), static_cast< sal_uInt16 > (aEndIndex.GetIndex()) );
1259cdf0e10cSrcweir 
1260cdf0e10cSrcweir     return sal_True;
1261cdf0e10cSrcweir }
1262cdf0e10cSrcweir 
SetSelection(const ESelection & rSel)1263cdf0e10cSrcweir sal_Bool SvxAccessibleTextEditViewAdapter::SetSelection( const ESelection& rSel )
1264cdf0e10cSrcweir {
1265cdf0e10cSrcweir     DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1266cdf0e10cSrcweir 
1267cdf0e10cSrcweir     SvxAccessibleTextIndex aStartIndex;
1268cdf0e10cSrcweir     SvxAccessibleTextIndex aEndIndex;
1269cdf0e10cSrcweir 
1270cdf0e10cSrcweir     aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *mrTextForwarder );
1271cdf0e10cSrcweir     aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *mrTextForwarder );
1272cdf0e10cSrcweir 
1273cdf0e10cSrcweir     return mrViewForwarder->SetSelection( MakeEESelection(aStartIndex, aEndIndex) );
1274cdf0e10cSrcweir }
1275cdf0e10cSrcweir 
Copy()1276cdf0e10cSrcweir sal_Bool SvxAccessibleTextEditViewAdapter::Copy()
1277cdf0e10cSrcweir {
1278cdf0e10cSrcweir     DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1279cdf0e10cSrcweir 
1280cdf0e10cSrcweir     return mrViewForwarder->Copy();
1281cdf0e10cSrcweir }
1282cdf0e10cSrcweir 
Cut()1283cdf0e10cSrcweir sal_Bool SvxAccessibleTextEditViewAdapter::Cut()
1284cdf0e10cSrcweir {
1285cdf0e10cSrcweir     DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1286cdf0e10cSrcweir 
1287cdf0e10cSrcweir     return mrViewForwarder->Cut();
1288cdf0e10cSrcweir }
1289cdf0e10cSrcweir 
Paste()1290cdf0e10cSrcweir sal_Bool SvxAccessibleTextEditViewAdapter::Paste()
1291cdf0e10cSrcweir {
1292cdf0e10cSrcweir     DBG_ASSERT(mrViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
1293cdf0e10cSrcweir 
1294cdf0e10cSrcweir     return mrViewForwarder->Paste();
1295cdf0e10cSrcweir }
1296cdf0e10cSrcweir 
SetForwarder(SvxEditViewForwarder & rForwarder,SvxAccessibleTextAdapter & rTextForwarder)1297cdf0e10cSrcweir void SvxAccessibleTextEditViewAdapter::SetForwarder( SvxEditViewForwarder& 		rForwarder,
1298cdf0e10cSrcweir                                                      SvxAccessibleTextAdapter&	rTextForwarder )
1299cdf0e10cSrcweir {
1300cdf0e10cSrcweir     mrViewForwarder = &rForwarder;
1301cdf0e10cSrcweir     mrTextForwarder = &rTextForwarder;
1302cdf0e10cSrcweir }
1303cdf0e10cSrcweir 
1304