1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unotext2.cxx,v $
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"
33 #include <vcl/svapp.hxx>
34 #include <vos/mutex.hxx>
36 #define _SVSTDARR_USHORTS
37 #include <svtools/svstdarr.hxx>
40 #include <rtl/memory.h>
42 #include <svx/eeitem.hxx>
44 #include <svx/flditem.hxx>
45 #include <svx/unofield.hxx>
46 #include <svx/unotext.hxx>
48 using namespace ::rtl
;
49 using namespace ::vos
;
50 using namespace ::cppu
;
51 using namespace ::com::sun::star
;
53 #define QUERYINT( xint ) \
54 if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
55 return uno::makeAny(uno::Reference< xint >(this))
57 // ====================================================================
58 // SvxUnoTextContentEnumeration
59 // ====================================================================
61 SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase
& _rText
) throw()
64 mxParentText
= const_cast<SvxUnoTextBase
*>(&_rText
);
65 if( mrText
.GetEditSource() )
66 mpEditSource
= mrText
.GetEditSource()->Clone();
72 SvxUnoTextContentEnumeration::~SvxUnoTextContentEnumeration() throw()
77 // container::XEnumeration
78 sal_Bool SAL_CALL
SvxUnoTextContentEnumeration::hasMoreElements(void)
79 throw( uno::RuntimeException
)
81 OGuard
aGuard( Application::GetSolarMutex() );
82 if( mpEditSource
&& mpEditSource
->GetTextForwarder() )
83 return mnNextParagraph
< mpEditSource
->GetTextForwarder()->GetParagraphCount();
88 uno::Any
SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
90 OGuard
aGuard( Application::GetSolarMutex() );
92 if(!hasMoreElements())
93 throw container::NoSuchElementException();
95 SvxUnoTextContent
* pContent
= 0;
97 const SvxUnoTextRangeBaseList
& rRanges( mpEditSource
->getRanges() );
98 SvxUnoTextRangeBaseList::const_iterator aIter
;
99 for( aIter
= rRanges
.begin(); (aIter
!= rRanges
.end()) && (pContent
== 0); aIter
++ )
101 SvxUnoTextContent
* pIterContent
= dynamic_cast< SvxUnoTextContent
* >( (*aIter
) );
102 if( pIterContent
&& (pIterContent
->mnParagraph
== mnNextParagraph
) )
103 pContent
= pIterContent
;
107 pContent
= new SvxUnoTextContent( mrText
, mnNextParagraph
);
111 uno::Reference
< text::XTextContent
> xRef( pContent
);
112 return uno::makeAny( xRef
);
115 // ====================================================================
116 // class SvxUnoTextContent
117 // ====================================================================
118 uno::Reference
< text::XText
> xDummyText
;
119 uno::Sequence
< uno::Type
> SvxUnoTextContent::maTypeSequence
;
121 static SvxUnoText
* getDummyText() throw()
124 xDummyText
= new SvxUnoText();
126 return SvxUnoText::getImplementation( xDummyText
);
129 SvxUnoTextContent::SvxUnoTextContent() throw()
130 : SvxUnoTextRangeBase(*getDummyText())
132 , mrParentText(*getDummyText())
133 , maDisposeListeners(maDisposeContainerMutex
)
134 , mbDisposing( false )
138 SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase
& rText
, sal_uInt16 nPara
) throw()
139 : SvxUnoTextRangeBase(rText
)
141 , mrParentText(rText
)
142 , maDisposeListeners(maDisposeContainerMutex
)
143 , mbDisposing( false )
145 mxParentText
= const_cast<SvxUnoTextBase
*>(&rText
);
146 if( GetEditSource() && GetEditSource()->GetTextForwarder() )
147 SetSelection( ESelection( mnParagraph
,0, mnParagraph
, GetEditSource()->GetTextForwarder()->GetTextLen( mnParagraph
) ) );
150 SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextContent
& rContent
) throw()
151 : SvxUnoTextRangeBase(rContent
)
152 , text::XTextContent()
153 , container::XEnumerationAccess()
154 , lang::XTypeProvider()
155 , cppu::OWeakAggObject()
156 , mrParentText(rContent
.mrParentText
)
157 , maDisposeListeners(maDisposeContainerMutex
)
158 , mbDisposing( false )
160 mxParentText
= rContent
.mxParentText
;
161 mnParagraph
= rContent
.mnParagraph
;
162 SetSelection( rContent
.GetSelection() );
165 SvxUnoTextContent::~SvxUnoTextContent() throw()
170 uno::Any SAL_CALL
SvxUnoTextContent::queryAggregation( const uno::Type
& rType
) throw( uno::RuntimeException
)
172 QUERYINT( text::XTextRange
);
173 else QUERYINT( beans::XMultiPropertyStates
);
174 else QUERYINT( beans::XPropertySet
);
175 else QUERYINT( beans::XMultiPropertySet
);
176 else QUERYINT( beans::XPropertyState
);
177 else QUERYINT( text::XTextContent
);
178 else QUERYINT( text::XTextRangeCompare
);
179 else QUERYINT( lang::XComponent
);
180 else QUERYINT( container::XEnumerationAccess
);
181 else QUERYINT( container::XElementAccess
);
182 else QUERYINT( lang::XServiceInfo
);
183 else QUERYINT( lang::XTypeProvider
);
184 else QUERYINT( lang::XUnoTunnel
);
186 return OWeakAggObject::queryAggregation( rType
);
189 uno::Any SAL_CALL
SvxUnoTextContent::queryInterface( const uno::Type
& rType
) throw( uno::RuntimeException
)
191 return OWeakAggObject::queryInterface(rType
);
194 void SAL_CALL
SvxUnoTextContent::acquire() throw( )
196 OWeakAggObject::acquire();
199 void SAL_CALL
SvxUnoTextContent::release() throw( )
201 OWeakAggObject::release();
206 uno::Sequence
< uno::Type
> SAL_CALL
SvxUnoTextContent::getTypes()
207 throw (uno::RuntimeException
)
209 if( maTypeSequence
.getLength() == 0 )
211 maTypeSequence
.realloc( 11 ); // !DANGER! keep this updated
212 uno::Type
* pTypes
= maTypeSequence
.getArray();
214 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextRange
>*)0);
215 *pTypes
++ = ::getCppuType(( const uno::Reference
< beans::XPropertySet
>*)0);
216 *pTypes
++ = ::getCppuType(( const uno::Reference
< beans::XMultiPropertySet
>*)0);
217 *pTypes
++ = ::getCppuType(( const uno::Reference
< beans::XMultiPropertyStates
>*)0);
218 *pTypes
++ = ::getCppuType(( const uno::Reference
< beans::XPropertyState
>*)0);
219 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextRangeCompare
>*)0);
220 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextContent
>*)0);
221 *pTypes
++ = ::getCppuType(( const uno::Reference
< container::XEnumerationAccess
>*)0);
222 *pTypes
++ = ::getCppuType(( const uno::Reference
< lang::XServiceInfo
>*)0);
223 *pTypes
++ = ::getCppuType(( const uno::Reference
< lang::XTypeProvider
>*)0);
224 *pTypes
++ = ::getCppuType(( const uno::Reference
< lang::XUnoTunnel
>*)0);
226 return maTypeSequence
;
229 uno::Sequence
< sal_Int8
> SAL_CALL
SvxUnoTextContent::getImplementationId()
230 throw (uno::RuntimeException
)
232 static uno::Sequence
< sal_Int8
> aId
;
233 if( aId
.getLength() == 0 )
236 rtl_createUuid( (sal_uInt8
*)aId
.getArray(), 0, sal_True
);
243 uno::Reference
< text::XText
> SAL_CALL
SvxUnoTextContent::getText()
244 throw(uno::RuntimeException
)
249 // text::XTextContent
250 void SAL_CALL
SvxUnoTextContent::attach( const uno::Reference
< text::XTextRange
>& )
251 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
255 uno::Reference
< text::XTextRange
> SAL_CALL
SvxUnoTextContent::getAnchor() throw( uno::RuntimeException
)
257 return uno::Reference
< text::XTextRange
>::query( mxParentText
);
262 void SAL_CALL
SvxUnoTextContent::dispose()
263 throw(uno::RuntimeException
)
265 OGuard
aGuard( Application::GetSolarMutex() );
268 return; // catched a recursion
272 lang::EventObject aEvt
;
273 aEvt
.Source
= *(OWeakAggObject
*) this;
274 maDisposeListeners
.disposeAndClear(aEvt
);
276 if( mxParentText
.is() )
277 mxParentText
->removeTextContent( this );
280 void SAL_CALL
SvxUnoTextContent::addEventListener( const uno::Reference
< lang::XEventListener
>& xListener
)
281 throw(uno::RuntimeException
)
283 maDisposeListeners
.addInterface(xListener
);
286 void SAL_CALL
SvxUnoTextContent::removeEventListener( const uno::Reference
< lang::XEventListener
>& aListener
)
287 throw(uno::RuntimeException
)
289 maDisposeListeners
.removeInterface(aListener
);
292 // XEnumerationAccess
294 uno::Reference
< container::XEnumeration
> SAL_CALL
SvxUnoTextContent::createEnumeration( )
295 throw(uno::RuntimeException
)
297 OGuard
aGuard( Application::GetSolarMutex() );
299 return new SvxUnoTextRangeEnumeration( mrParentText
, mnParagraph
);
302 // XElementAccess ( container::XEnumerationAccess )
304 uno::Type SAL_CALL
SvxUnoTextContent::getElementType()
305 throw(uno::RuntimeException
)
307 return ::getCppuType((const uno::Reference
< text::XTextRange
>*)0);
310 sal_Bool SAL_CALL
SvxUnoTextContent::hasElements()
311 throw(uno::RuntimeException
)
313 OGuard
aGuard( Application::GetSolarMutex() );
315 SvxTextForwarder
* pForwarder
= GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL
;
319 pForwarder
->GetPortions( mnParagraph
, aPortions
);
320 return aPortions
.Count() > 0;
330 void SAL_CALL
SvxUnoTextContent::setPropertyValue( const OUString
& aPropertyName
, const uno::Any
& aValue
)
331 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
333 _setPropertyValue( aPropertyName
, aValue
, mnParagraph
);
336 uno::Any SAL_CALL
SvxUnoTextContent::getPropertyValue( const OUString
& PropertyName
)
337 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
339 return _getPropertyValue( PropertyName
, mnParagraph
);
343 void SAL_CALL
SvxUnoTextContent::setPropertyValues( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
, const uno::Sequence
< uno::Any
>& aValues
) throw (beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
345 _setPropertyValues( aPropertyNames
, aValues
, mnParagraph
);
348 uno::Sequence
< uno::Any
> SAL_CALL
SvxUnoTextContent::getPropertyValues( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (uno::RuntimeException
)
350 return _getPropertyValues( aPropertyNames
, mnParagraph
);
353 /*// XTolerantMultiPropertySet
354 uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SvxUnoTextContent::setPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (lang::IllegalArgumentException, uno::RuntimeException)
356 return _setPropertyValuesTolerant(aPropertyNames, aValues, mnParagraph);
359 uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL SvxUnoTextContent::getPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (uno::RuntimeException)
361 return _getPropertyValuesTolerant(aPropertyNames, mnParagraph);
364 uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SvxUnoTextContent::getDirectPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames )
365 throw (uno::RuntimeException)
367 return _getDirectPropertyValuesTolerant(aPropertyNames, mnParagraph);
370 // beans::XPropertyState
371 beans::PropertyState SAL_CALL
SvxUnoTextContent::getPropertyState( const OUString
& PropertyName
)
372 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
374 return _getPropertyState( PropertyName
, mnParagraph
);
377 uno::Sequence
< beans::PropertyState
> SAL_CALL
SvxUnoTextContent::getPropertyStates( const uno::Sequence
< OUString
>& aPropertyName
)
378 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
380 return _getPropertyStates( aPropertyName
, mnParagraph
);
383 void SAL_CALL
SvxUnoTextContent::setPropertyToDefault( const OUString
& PropertyName
)
384 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
386 _setPropertyToDefault( PropertyName
, mnParagraph
);
389 // lang::XServiceInfo
391 OUString SAL_CALL
SvxUnoTextContent::getImplementationName()
392 throw(uno::RuntimeException
)
394 return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextContent") );
397 uno::Sequence
< OUString
> SAL_CALL
SvxUnoTextContent::getSupportedServiceNames()
398 throw(uno::RuntimeException
)
400 uno::Sequence
< OUString
> aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
401 SvxServiceInfoHelper::addToSequence( aSeq
, 5, "com.sun.star.style.ParagraphProperties",
402 "com.sun.star.style.ParagraphPropertiesComplex",
403 "com.sun.star.style.ParagraphPropertiesAsian",
404 "com.sun.star.text.TextContent",
405 "com.sun.star.text.Paragraph");
409 // ====================================================================
410 // class SvxUnoTextRangeEnumeration
411 // ====================================================================
413 SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration( const SvxUnoTextBase
& rText
, sal_uInt16 nPara
) throw()
414 : mxParentText( const_cast<SvxUnoTextBase
*>(&rText
) ),
415 mrParentText( rText
),
416 mnParagraph( nPara
),
419 mpEditSource
= rText
.GetEditSource() ? rText
.GetEditSource()->Clone() : NULL
;
421 if( mpEditSource
&& mpEditSource
->GetTextForwarder() )
423 mpPortions
= new SvUShorts
;
424 mpEditSource
->GetTextForwarder()->GetPortions( nPara
, *mpPortions
);
432 SvxUnoTextRangeEnumeration::~SvxUnoTextRangeEnumeration() throw()
438 // container::XEnumeration
440 sal_Bool SAL_CALL
SvxUnoTextRangeEnumeration::hasMoreElements()
441 throw(uno::RuntimeException
)
443 OGuard
aGuard( Application::GetSolarMutex() );
445 return mpPortions
&& mnNextPortion
< mpPortions
->Count();
448 uno::Any SAL_CALL
SvxUnoTextRangeEnumeration::nextElement()
449 throw(container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
451 OGuard
aGuard( Application::GetSolarMutex() );
453 if( mpPortions
== NULL
|| mnNextPortion
>= mpPortions
->Count() )
454 throw container::NoSuchElementException();
456 sal_uInt16 nStartPos
= 0;
457 if (mnNextPortion
> 0)
458 nStartPos
= mpPortions
->GetObject(mnNextPortion
-1);
459 sal_uInt16 nEndPos
= mpPortions
->GetObject(mnNextPortion
);
460 ESelection
aSel( mnParagraph
, nStartPos
, mnParagraph
, nEndPos
);
462 uno::Reference
< text::XTextRange
> xRange
;
464 const SvxUnoTextRangeBaseList
& rRanges( mpEditSource
->getRanges() );
466 SvxUnoTextRange
* pRange
= 0;
468 SvxUnoTextRangeBaseList::const_iterator aIter
;
469 for( aIter
= rRanges
.begin(); (aIter
!= rRanges
.end()) && (pRange
== 0); aIter
++ )
471 SvxUnoTextRange
* pIterRange
= dynamic_cast< SvxUnoTextRange
* >( (*aIter
) );
472 if( pIterRange
&& pIterRange
->mbPortion
&& (aSel
.IsEqual( pIterRange
->maSelection
) ) )
478 pRange
= new SvxUnoTextRange( mrParentText
, sal_True
);
479 pRange
->SetSelection(aSel
);
486 return uno::makeAny( xRange
);
489 // ====================================================================
490 // class SvxUnoTextCursor
491 // ====================================================================
493 uno::Sequence
< uno::Type
> SvxUnoTextCursor::maTypeSequence
;
495 uno::Reference
< uno::XInterface
> SvxUnoTextCursor_NewInstance()
498 uno::Reference
< text::XText
> xText( (text::XText
*)new SvxUnoTextCursor( aText
) );
499 uno::Reference
< uno::XInterface
> xInt( xText
, uno::UNO_QUERY
);
503 SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextBase
& rText
) throw()
504 : SvxUnoTextRangeBase(rText
),
505 mxParentText( const_cast<SvxUnoTextBase
*>(&rText
) )
509 SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextCursor
& rCursor
) throw()
510 : SvxUnoTextRangeBase(rCursor
)
511 , text::XTextCursor()
512 , lang::XTypeProvider()
513 , cppu::OWeakAggObject()
514 , mxParentText(rCursor
.mxParentText
)
518 SvxUnoTextCursor::~SvxUnoTextCursor() throw()
522 // automatisch auskommentiert - [getIdlClass(es) or queryInterface] - Bitte XTypeProvider benutzen!
523 //sal_Bool SvxUnoTextCursor::queryInterface( uno::Uik aUIK, Reference< uno::XInterface > & xRef)
524 uno::Any SAL_CALL
SvxUnoTextCursor::queryAggregation( const uno::Type
& rType
)
525 throw(uno::RuntimeException
)
527 if( rType
== ::getCppuType((const uno::Reference
< text::XTextRange
>*)0) )
528 return uno::makeAny(uno::Reference
< text::XTextRange
>((text::XText
*)(this)));
529 else QUERYINT( text::XTextCursor
);
530 else QUERYINT( beans::XMultiPropertyStates
);
531 else QUERYINT( beans::XPropertySet
);
532 else QUERYINT( beans::XMultiPropertySet
);
533 else QUERYINT( beans::XPropertyState
);
534 else QUERYINT( text::XTextRangeCompare
);
535 else QUERYINT( lang::XServiceInfo
);
536 else QUERYINT( lang::XTypeProvider
);
537 else QUERYINT( lang::XUnoTunnel
);
539 return OWeakAggObject::queryAggregation( rType
);
542 uno::Any SAL_CALL
SvxUnoTextCursor::queryInterface( const uno::Type
& rType
)
543 throw(uno::RuntimeException
)
545 return OWeakAggObject::queryInterface(rType
);
548 void SAL_CALL
SvxUnoTextCursor::acquire() throw ( )
550 OWeakAggObject::acquire();
553 void SAL_CALL
SvxUnoTextCursor::release() throw ( )
555 OWeakAggObject::release();
559 uno::Sequence
< uno::Type
> SAL_CALL
SvxUnoTextCursor::getTypes()
560 throw(uno::RuntimeException
)
562 if( maTypeSequence
.getLength() == 0 )
564 maTypeSequence
.realloc( 10 ); // !DANGER! keep this updated
565 uno::Type
* pTypes
= maTypeSequence
.getArray();
567 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextRange
>*)0);
568 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextCursor
>*)0);
569 *pTypes
++ = ::getCppuType(( const uno::Reference
< beans::XPropertySet
>*)0);
570 *pTypes
++ = ::getCppuType(( const uno::Reference
< beans::XMultiPropertySet
>*)0);
571 *pTypes
++ = ::getCppuType(( const uno::Reference
< beans::XMultiPropertyStates
>*)0);
572 *pTypes
++ = ::getCppuType(( const uno::Reference
< beans::XPropertyState
>*)0);
573 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextRangeCompare
>*)0);
574 *pTypes
++ = ::getCppuType(( const uno::Reference
< lang::XServiceInfo
>*)0);
575 *pTypes
++ = ::getCppuType(( const uno::Reference
< lang::XTypeProvider
>*)0);
576 *pTypes
++ = ::getCppuType(( const uno::Reference
< lang::XUnoTunnel
>*)0);
578 return maTypeSequence
;
581 uno::Sequence
< sal_Int8
> SAL_CALL
SvxUnoTextCursor::getImplementationId()
582 throw (uno::RuntimeException
)
584 static uno::Sequence
< sal_Int8
> aId
;
585 if( aId
.getLength() == 0 )
588 rtl_createUuid( (sal_uInt8
*)aId
.getArray(), 0, sal_True
);
594 void SAL_CALL
SvxUnoTextCursor::collapseToStart()
595 throw(uno::RuntimeException
)
597 OGuard
aGuard( Application::GetSolarMutex() );
601 void SAL_CALL
SvxUnoTextCursor::collapseToEnd()
602 throw(uno::RuntimeException
)
604 OGuard
aGuard( Application::GetSolarMutex() );
608 sal_Bool SAL_CALL
SvxUnoTextCursor::isCollapsed()
609 throw(uno::RuntimeException
)
611 OGuard
aGuard( Application::GetSolarMutex() );
612 return IsCollapsed();
615 sal_Bool SAL_CALL
SvxUnoTextCursor::goLeft( sal_Int16 nCount
, sal_Bool bExpand
)
616 throw(uno::RuntimeException
)
618 OGuard
aGuard( Application::GetSolarMutex() );
619 return GoLeft( nCount
, bExpand
);
622 sal_Bool SAL_CALL
SvxUnoTextCursor::goRight( sal_Int16 nCount
, sal_Bool bExpand
)
623 throw(uno::RuntimeException
)
625 OGuard
aGuard( Application::GetSolarMutex() );
626 return GoRight( nCount
, bExpand
);
629 void SAL_CALL
SvxUnoTextCursor::gotoStart( sal_Bool bExpand
)
630 throw(uno::RuntimeException
)
632 OGuard
aGuard( Application::GetSolarMutex() );
633 GotoStart( bExpand
);
636 void SAL_CALL
SvxUnoTextCursor::gotoEnd( sal_Bool bExpand
)
637 throw(uno::RuntimeException
)
639 OGuard
aGuard( Application::GetSolarMutex() );
643 void SAL_CALL
SvxUnoTextCursor::gotoRange( const uno::Reference
< text::XTextRange
>& xRange
, sal_Bool bExpand
)
644 throw(uno::RuntimeException
)
649 SvxUnoTextRangeBase
* pRange
= SvxUnoTextRangeBase::getImplementation( xRange
);
653 ESelection aNewSel
= pRange
->GetSelection();
657 const ESelection
& rOldSel
= GetSelection();
658 aNewSel
.nStartPara
= rOldSel
.nStartPara
;
659 aNewSel
.nStartPos
= rOldSel
.nStartPos
;
662 SetSelection( aNewSel
);
666 // text::XTextRange (rest in SvxTextRange)
667 uno::Reference
< text::XText
> SAL_CALL
SvxUnoTextCursor::getText(void) throw( uno::RuntimeException
)
672 uno::Reference
< text::XTextRange
> SAL_CALL
SvxUnoTextCursor::getStart()
673 throw(uno::RuntimeException
)
675 return SvxUnoTextRangeBase::getStart();
678 uno::Reference
< text::XTextRange
> SAL_CALL
SvxUnoTextCursor::getEnd()
679 throw(uno::RuntimeException
)
681 return SvxUnoTextRangeBase::getEnd();
684 OUString SAL_CALL
SvxUnoTextCursor::getString() throw( uno::RuntimeException
)
686 return SvxUnoTextRangeBase::getString();
689 void SAL_CALL
SvxUnoTextCursor::setString( const OUString
& aString
) throw(uno::RuntimeException
)
691 SvxUnoTextRangeBase::setString(aString
);
693 // lang::XServiceInfo
694 OUString SAL_CALL
SvxUnoTextCursor::getImplementationName() throw(uno::RuntimeException
)
696 return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextCursor"));
699 sal_Bool SAL_CALL
SvxUnoTextCursor::supportsService( const OUString
& ServiceName
) throw(uno::RuntimeException
)
701 return SvxServiceInfoHelper::supportsService( ServiceName
, getSupportedServiceNames() );
704 uno::Sequence
< OUString
> SAL_CALL
SvxUnoTextCursor::getSupportedServiceNames() throw(uno::RuntimeException
)
706 uno::Sequence
< OUString
> aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
707 SvxServiceInfoHelper::addToSequence( aSeq
, 4,"com.sun.star.style.ParagraphProperties",
708 "com.sun.star.style.ParagraphPropertiesComplex",
709 "com.sun.star.style.ParagraphPropertiesAsian",
710 "com.sun.star.text.TextCursor");