update credits
[LibreOffice.git] / editeng / source / uno / unotext2.cxx
blobb82883fb5ed115312984296668f82851d7df51c1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <vcl/svapp.hxx>
21 #include <osl/mutex.hxx>
22 #include <rtl/instance.hxx>
24 #include <editeng/eeitem.hxx>
25 #include <editeng/flditem.hxx>
26 #include <editeng/unofield.hxx>
27 #include <editeng/unotext.hxx>
28 #include <comphelper/serviceinfohelper.hxx>
29 #include <comphelper/servicehelper.hxx>
31 using namespace ::rtl;
32 using namespace ::cppu;
33 using namespace ::com::sun::star;
35 #define QUERYINT( xint ) \
36 if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
37 return uno::makeAny(uno::Reference< xint >(this))
39 // ====================================================================
40 // SvxUnoTextContentEnumeration
41 // ====================================================================
43 SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText ) throw()
44 : mrText( _rText )
46 mxParentText = const_cast<SvxUnoTextBase*>(&_rText);
47 if( mrText.GetEditSource() )
48 mpEditSource = mrText.GetEditSource()->Clone();
49 else
50 mpEditSource = NULL;
51 mnNextParagraph = 0;
54 SvxUnoTextContentEnumeration::~SvxUnoTextContentEnumeration() throw()
56 delete mpEditSource;
59 // container::XEnumeration
60 sal_Bool SAL_CALL SvxUnoTextContentEnumeration::hasMoreElements(void)
61 throw( uno::RuntimeException )
63 SolarMutexGuard aGuard;
64 if( mpEditSource && mpEditSource->GetTextForwarder() )
65 return mnNextParagraph < mpEditSource->GetTextForwarder()->GetParagraphCount();
66 else
67 return sal_False;
70 uno::Any SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
72 SolarMutexGuard aGuard;
74 if(!hasMoreElements())
75 throw container::NoSuchElementException();
77 SvxUnoTextContent* pContent = 0;
79 const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
80 SvxUnoTextRangeBaseList::const_iterator aIter;
81 for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pContent == 0); ++aIter )
83 SvxUnoTextContent* pIterContent = dynamic_cast< SvxUnoTextContent* >( (*aIter ) );
84 if( pIterContent && (pIterContent->mnParagraph == mnNextParagraph) )
85 pContent = pIterContent;
88 if( pContent == 0 )
89 pContent = new SvxUnoTextContent( mrText, mnNextParagraph );
91 mnNextParagraph++;
93 uno::Reference< text::XTextContent > xRef( pContent );
94 return uno::makeAny( xRef );
97 // ====================================================================
98 // class SvxUnoTextContent
99 // ====================================================================
101 SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase& rText, sal_Int32 nPara ) throw()
102 : SvxUnoTextRangeBase(rText)
103 , mnParagraph(nPara)
104 , mrParentText(rText)
105 , maDisposeListeners(maDisposeContainerMutex)
106 , mbDisposing( false )
108 mxParentText = const_cast<SvxUnoTextBase*>(&rText);
109 if( GetEditSource() && GetEditSource()->GetTextForwarder() )
110 SetSelection( ESelection( mnParagraph,0, mnParagraph, GetEditSource()->GetTextForwarder()->GetTextLen( mnParagraph ) ) );
113 SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw()
114 : SvxUnoTextRangeBase(rContent)
115 , text::XTextContent()
116 , container::XEnumerationAccess()
117 , lang::XTypeProvider()
118 , cppu::OWeakAggObject()
119 , mrParentText(rContent.mrParentText)
120 , maDisposeListeners(maDisposeContainerMutex)
121 , mbDisposing( false )
123 mxParentText = rContent.mxParentText;
124 mnParagraph = rContent.mnParagraph;
125 SetSelection( rContent.GetSelection() );
128 SvxUnoTextContent::~SvxUnoTextContent() throw()
132 // uno::XInterface
133 uno::Any SAL_CALL SvxUnoTextContent::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException )
135 QUERYINT( text::XTextRange );
136 else QUERYINT( beans::XMultiPropertyStates );
137 else QUERYINT( beans::XPropertySet );
138 else QUERYINT( beans::XMultiPropertySet );
139 else QUERYINT( beans::XPropertyState );
140 else QUERYINT( text::XTextContent );
141 else QUERYINT( text::XTextRangeCompare );
142 else QUERYINT( lang::XComponent );
143 else QUERYINT( container::XEnumerationAccess );
144 else QUERYINT( container::XElementAccess );
145 else QUERYINT( lang::XServiceInfo );
146 else QUERYINT( lang::XTypeProvider );
147 else QUERYINT( lang::XUnoTunnel );
148 else
149 return OWeakAggObject::queryAggregation( rType );
152 uno::Any SAL_CALL SvxUnoTextContent::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException )
154 return OWeakAggObject::queryInterface(rType);
157 void SAL_CALL SvxUnoTextContent::acquire() throw( )
159 OWeakAggObject::acquire();
162 void SAL_CALL SvxUnoTextContent::release() throw( )
164 OWeakAggObject::release();
167 // XTypeProvider
169 namespace
171 struct theSvxUnoTextContentTypes :
172 public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextContentTypes>
174 uno::Sequence<uno::Type> operator () ()
176 uno::Sequence< uno::Type > aTypeSequence;
178 aTypeSequence.realloc( 11 ); // !DANGER! keep this updated
179 uno::Type* pTypes = aTypeSequence.getArray();
181 *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0);
182 *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
183 *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0);
184 *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0);
185 *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0);
186 *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0);
187 *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextContent >*)0);
188 *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0);
189 *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
190 *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0);
191 *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
193 return aTypeSequence;
198 uno::Sequence< uno::Type > SAL_CALL SvxUnoTextContent::getTypes()
199 throw (uno::RuntimeException)
201 return theSvxUnoTextContentTypes::get();
204 namespace
206 class theSvxUnoTextContentImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextContentImplementationId > {};
209 uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId()
210 throw (uno::RuntimeException)
212 return theSvxUnoTextContentImplementationId::get().getSeq();
215 // text::XTextRange
217 uno::Reference< text::XText > SAL_CALL SvxUnoTextContent::getText()
218 throw(uno::RuntimeException)
220 return mxParentText;
223 // text::XTextContent
224 void SAL_CALL SvxUnoTextContent::attach( const uno::Reference< text::XTextRange >& )
225 throw(lang::IllegalArgumentException, uno::RuntimeException)
229 uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextContent::getAnchor() throw( uno::RuntimeException )
231 return uno::Reference< text::XTextRange >::query( mxParentText );
234 // XComponent
236 void SAL_CALL SvxUnoTextContent::dispose()
237 throw(uno::RuntimeException)
239 SolarMutexGuard aGuard;
241 if( mbDisposing )
242 return; // catched a recursion
244 mbDisposing = true;
246 lang::EventObject aEvt;
247 aEvt.Source = *(OWeakAggObject*) this;
248 maDisposeListeners.disposeAndClear(aEvt);
250 if( mxParentText.is() )
251 mxParentText->removeTextContent( this );
254 void SAL_CALL SvxUnoTextContent::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
255 throw(uno::RuntimeException)
257 maDisposeListeners.addInterface(xListener);
260 void SAL_CALL SvxUnoTextContent::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
261 throw(uno::RuntimeException)
263 maDisposeListeners.removeInterface(aListener);
266 // XEnumerationAccess
268 uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextContent::createEnumeration( )
269 throw(uno::RuntimeException)
271 SolarMutexGuard aGuard;
273 return new SvxUnoTextRangeEnumeration( mrParentText, mnParagraph );
276 // XElementAccess ( container::XEnumerationAccess )
278 uno::Type SAL_CALL SvxUnoTextContent::getElementType()
279 throw(uno::RuntimeException)
281 return ::getCppuType((const uno::Reference< text::XTextRange >*)0);
284 sal_Bool SAL_CALL SvxUnoTextContent::hasElements()
285 throw(uno::RuntimeException)
287 SolarMutexGuard aGuard;
289 SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
290 if( pForwarder )
292 std::vector<sal_uInt16> aPortions;
293 pForwarder->GetPortions( mnParagraph, aPortions );
294 return !aPortions.empty();
296 else
298 return 0;
302 // XPropertySet
304 void SAL_CALL SvxUnoTextContent::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
305 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
307 _setPropertyValue( aPropertyName, aValue, mnParagraph );
310 uno::Any SAL_CALL SvxUnoTextContent::getPropertyValue( const OUString& PropertyName )
311 throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
313 return _getPropertyValue( PropertyName, mnParagraph );
316 // XMultiPropertySet
317 void SAL_CALL SvxUnoTextContent::setPropertyValues( const uno::Sequence< OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
319 _setPropertyValues( aPropertyNames, aValues, mnParagraph );
322 uno::Sequence< uno::Any > SAL_CALL SvxUnoTextContent::getPropertyValues( const uno::Sequence< OUString >& aPropertyNames ) throw (uno::RuntimeException)
324 return _getPropertyValues( aPropertyNames, mnParagraph );
327 /*// XTolerantMultiPropertySet
328 uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SvxUnoTextContent::setPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (lang::IllegalArgumentException, uno::RuntimeException)
330 return _setPropertyValuesTolerant(aPropertyNames, aValues, mnParagraph);
333 uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL SvxUnoTextContent::getPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames ) throw (uno::RuntimeException)
335 return _getPropertyValuesTolerant(aPropertyNames, mnParagraph);
338 uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SvxUnoTextContent::getDirectPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames )
339 throw (uno::RuntimeException)
341 return _getDirectPropertyValuesTolerant(aPropertyNames, mnParagraph);
344 // beans::XPropertyState
345 beans::PropertyState SAL_CALL SvxUnoTextContent::getPropertyState( const OUString& PropertyName )
346 throw(beans::UnknownPropertyException, uno::RuntimeException)
348 return _getPropertyState( PropertyName, mnParagraph );
351 uno::Sequence< beans::PropertyState > SAL_CALL SvxUnoTextContent::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
352 throw(beans::UnknownPropertyException, uno::RuntimeException)
354 return _getPropertyStates( aPropertyName, mnParagraph );
357 void SAL_CALL SvxUnoTextContent::setPropertyToDefault( const OUString& PropertyName )
358 throw(beans::UnknownPropertyException, uno::RuntimeException)
360 _setPropertyToDefault( PropertyName, mnParagraph );
363 // lang::XServiceInfo
365 OUString SAL_CALL SvxUnoTextContent::getImplementationName()
366 throw(uno::RuntimeException)
368 return OUString("SvxUnoTextContent");
371 uno::Sequence< OUString > SAL_CALL SvxUnoTextContent::getSupportedServiceNames()
372 throw(uno::RuntimeException)
374 uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
375 comphelper::ServiceInfoHelper::addToSequence( aSeq, 5, "com.sun.star.style.ParagraphProperties",
376 "com.sun.star.style.ParagraphPropertiesComplex",
377 "com.sun.star.style.ParagraphPropertiesAsian",
378 "com.sun.star.text.TextContent",
379 "com.sun.star.text.Paragraph");
380 return aSeq;
383 // ====================================================================
384 // class SvxUnoTextRangeEnumeration
385 // ====================================================================
387 SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_Int32 nPara ) throw()
388 : mxParentText( const_cast<SvxUnoTextBase*>(&rText) ),
389 mrParentText( rText ),
390 mnParagraph( nPara ),
391 mnNextPortion( 0 )
393 mpEditSource = rText.GetEditSource() ? rText.GetEditSource()->Clone() : NULL;
395 if( mpEditSource && mpEditSource->GetTextForwarder() )
397 mpPortions = new std::vector<sal_uInt16>;
398 mpEditSource->GetTextForwarder()->GetPortions( nPara, *mpPortions );
400 else
402 mpPortions = NULL;
406 SvxUnoTextRangeEnumeration::~SvxUnoTextRangeEnumeration() throw()
408 delete mpEditSource;
409 delete mpPortions;
412 // container::XEnumeration
414 sal_Bool SAL_CALL SvxUnoTextRangeEnumeration::hasMoreElements()
415 throw(uno::RuntimeException)
417 SolarMutexGuard aGuard;
419 return mpPortions && mnNextPortion < mpPortions->size();
422 uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement()
423 throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
425 SolarMutexGuard aGuard;
427 if( mpPortions == NULL || mnNextPortion >= mpPortions->size() )
428 throw container::NoSuchElementException();
430 sal_uInt16 nStartPos = 0;
431 if (mnNextPortion > 0)
432 nStartPos = mpPortions->at(mnNextPortion-1);
433 sal_uInt16 nEndPos = mpPortions->at(mnNextPortion);
434 ESelection aSel( mnParagraph, nStartPos, mnParagraph, nEndPos );
436 uno::Reference< text::XTextRange > xRange;
438 const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
440 SvxUnoTextRange* pRange = 0;
442 SvxUnoTextRangeBaseList::const_iterator aIter;
443 for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pRange == 0); ++aIter )
445 SvxUnoTextRange* pIterRange = dynamic_cast< SvxUnoTextRange* >( (*aIter ) );
446 if( pIterRange && pIterRange->mbPortion && (aSel.IsEqual( pIterRange->maSelection ) ) )
447 pRange = pIterRange;
450 if( pRange == 0 )
452 pRange = new SvxUnoTextRange( mrParentText, sal_True );
453 pRange->SetSelection(aSel);
456 xRange = pRange;
458 mnNextPortion++;
460 return uno::makeAny( xRange );
463 // ====================================================================
464 // class SvxUnoTextCursor
465 // ====================================================================
467 uno::Reference< uno::XInterface > SvxUnoTextCursor_NewInstance()
469 SvxUnoText aText;
470 uno::Reference< text::XText > xText( (text::XText*)new SvxUnoTextCursor( aText ) );
471 uno::Reference< uno::XInterface > xInt( xText, uno::UNO_QUERY );
472 return xInt;
475 SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw()
476 : SvxUnoTextRangeBase(rText),
477 mxParentText( const_cast<SvxUnoTextBase*>(&rText) )
481 SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw()
482 : SvxUnoTextRangeBase(rCursor)
483 , text::XTextCursor()
484 , lang::XTypeProvider()
485 , cppu::OWeakAggObject()
486 , mxParentText(rCursor.mxParentText)
490 SvxUnoTextCursor::~SvxUnoTextCursor() throw()
494 // Comment out automatically - [getIdlClass(es) or queryInterface]
495 // Please use the XTypeProvider!
496 //sal_Bool SvxUnoTextCursor::queryInterface( uno::Uik aUIK, Reference< uno::XInterface > & xRef)
497 uno::Any SAL_CALL SvxUnoTextCursor::queryAggregation( const uno::Type & rType )
498 throw(uno::RuntimeException)
500 if( rType == ::getCppuType((const uno::Reference< text::XTextRange >*)0) )
501 return uno::makeAny(uno::Reference< text::XTextRange >((text::XText*)(this)));
502 else QUERYINT( text::XTextCursor );
503 else QUERYINT( beans::XMultiPropertyStates );
504 else QUERYINT( beans::XPropertySet );
505 else QUERYINT( beans::XMultiPropertySet );
506 else QUERYINT( beans::XPropertyState );
507 else QUERYINT( text::XTextRangeCompare );
508 else QUERYINT( lang::XServiceInfo );
509 else QUERYINT( lang::XTypeProvider );
510 else QUERYINT( lang::XUnoTunnel );
511 else
512 return OWeakAggObject::queryAggregation( rType );
515 uno::Any SAL_CALL SvxUnoTextCursor::queryInterface( const uno::Type & rType )
516 throw(uno::RuntimeException)
518 return OWeakAggObject::queryInterface(rType);
521 void SAL_CALL SvxUnoTextCursor::acquire() throw ( )
523 OWeakAggObject::acquire();
526 void SAL_CALL SvxUnoTextCursor::release() throw ( )
528 OWeakAggObject::release();
531 namespace
533 struct theSvxUnoTextCursorTypes :
534 public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextCursorTypes>
536 uno::Sequence<uno::Type> operator () ()
538 uno::Sequence< uno::Type > aTypeSequence;
540 aTypeSequence.realloc( 10 ); // !DANGER! keep this updated
541 uno::Type* pTypes = aTypeSequence.getArray();
543 *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0);
544 *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCursor >*)0);
545 *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
546 *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0);
547 *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0);
548 *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0);
549 *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0);
550 *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
551 *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0);
552 *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
554 return aTypeSequence;
559 // XTypeProvider
560 uno::Sequence< uno::Type > SAL_CALL SvxUnoTextCursor::getTypes()
561 throw(uno::RuntimeException)
563 return theSvxUnoTextCursorTypes::get();
566 namespace
568 class theSvxUnoTextCursorImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextCursorImplementationId > {};
571 uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId()
572 throw (uno::RuntimeException)
574 return theSvxUnoTextCursorImplementationId::get().getSeq();
577 // text::XTextCursor
578 void SAL_CALL SvxUnoTextCursor::collapseToStart()
579 throw(uno::RuntimeException)
581 SolarMutexGuard aGuard;
582 CollapseToStart();
585 void SAL_CALL SvxUnoTextCursor::collapseToEnd()
586 throw(uno::RuntimeException)
588 SolarMutexGuard aGuard;
589 CollapseToEnd();
592 sal_Bool SAL_CALL SvxUnoTextCursor::isCollapsed()
593 throw(uno::RuntimeException)
595 SolarMutexGuard aGuard;
596 return IsCollapsed();
599 sal_Bool SAL_CALL SvxUnoTextCursor::goLeft( sal_Int16 nCount, sal_Bool bExpand )
600 throw(uno::RuntimeException)
602 SolarMutexGuard aGuard;
603 return GoLeft( nCount, bExpand );
606 sal_Bool SAL_CALL SvxUnoTextCursor::goRight( sal_Int16 nCount, sal_Bool bExpand )
607 throw(uno::RuntimeException)
609 SolarMutexGuard aGuard;
610 return GoRight( nCount, bExpand );
613 void SAL_CALL SvxUnoTextCursor::gotoStart( sal_Bool bExpand )
614 throw(uno::RuntimeException)
616 SolarMutexGuard aGuard;
617 GotoStart( bExpand );
620 void SAL_CALL SvxUnoTextCursor::gotoEnd( sal_Bool bExpand )
621 throw(uno::RuntimeException)
623 SolarMutexGuard aGuard;
624 GotoEnd( bExpand );
627 void SAL_CALL SvxUnoTextCursor::gotoRange( const uno::Reference< text::XTextRange >& xRange, sal_Bool bExpand )
628 throw(uno::RuntimeException)
630 if( !xRange.is() )
631 return;
633 SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( xRange );
635 if( pRange )
637 ESelection aNewSel = pRange->GetSelection();
639 if( bExpand )
641 const ESelection& rOldSel = GetSelection();
642 aNewSel.nStartPara = rOldSel.nStartPara;
643 aNewSel.nStartPos = rOldSel.nStartPos;
646 SetSelection( aNewSel );
650 // text::XTextRange (rest in SvxTextRange)
651 uno::Reference< text::XText > SAL_CALL SvxUnoTextCursor::getText(void) throw( uno::RuntimeException )
653 return mxParentText;
656 uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextCursor::getStart()
657 throw(uno::RuntimeException)
659 return SvxUnoTextRangeBase::getStart();
662 uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextCursor::getEnd()
663 throw(uno::RuntimeException)
665 return SvxUnoTextRangeBase::getEnd();
668 OUString SAL_CALL SvxUnoTextCursor::getString() throw( uno::RuntimeException )
670 return SvxUnoTextRangeBase::getString();
673 void SAL_CALL SvxUnoTextCursor::setString( const OUString& aString ) throw(uno::RuntimeException)
675 SvxUnoTextRangeBase::setString(aString);
677 // lang::XServiceInfo
678 OUString SAL_CALL SvxUnoTextCursor::getImplementationName() throw(uno::RuntimeException)
680 return OUString("SvxUnoTextCursor");
683 sal_Bool SAL_CALL SvxUnoTextCursor::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
685 return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
688 uno::Sequence< OUString > SAL_CALL SvxUnoTextCursor::getSupportedServiceNames() throw(uno::RuntimeException)
690 uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
691 comphelper::ServiceInfoHelper::addToSequence( aSeq, 4,"com.sun.star.style.ParagraphProperties",
692 "com.sun.star.style.ParagraphPropertiesComplex",
693 "com.sun.star.style.ParagraphPropertiesAsian",
694 "com.sun.star.text.TextCursor");
695 return aSeq;
699 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */