LCOV - code coverage report
Current view: top level - editeng/source/uno - unotext2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 191 218 87.6 %
Date: 2012-08-25 Functions: 49 57 86.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 146 288 50.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <vcl/svapp.hxx>
      30                 :            : #include <osl/mutex.hxx>
      31                 :            : #include <rtl/instance.hxx>
      32                 :            : 
      33                 :            : #include <editeng/eeitem.hxx>
      34                 :            : #include <editeng/flditem.hxx>
      35                 :            : #include <editeng/unofield.hxx>
      36                 :            : #include <editeng/unotext.hxx>
      37                 :            : #include <comphelper/serviceinfohelper.hxx>
      38                 :            : #include <comphelper/servicehelper.hxx>
      39                 :            : 
      40                 :            : using namespace ::rtl;
      41                 :            : using namespace ::cppu;
      42                 :            : using namespace ::com::sun::star;
      43                 :            : 
      44                 :            : // ====================================================================
      45                 :            : // SvxUnoTextContentEnumeration
      46                 :            : // ====================================================================
      47                 :            : 
      48                 :        243 : SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText ) throw()
      49                 :        243 : : mrText( _rText )
      50                 :            : {
      51         [ +  - ]:        243 :     mxParentText = const_cast<SvxUnoTextBase*>(&_rText);
      52         [ +  - ]:        243 :     if( mrText.GetEditSource() )
      53         [ +  - ]:        243 :         mpEditSource = mrText.GetEditSource()->Clone();
      54                 :            :     else
      55                 :          0 :         mpEditSource = NULL;
      56                 :        243 :     mnNextParagraph = 0;
      57                 :        243 : }
      58                 :            : 
      59                 :        243 : SvxUnoTextContentEnumeration::~SvxUnoTextContentEnumeration() throw()
      60                 :            : {
      61 [ +  - ][ +  - ]:        243 :     delete mpEditSource;
      62         [ -  + ]:        486 : }
      63                 :            : 
      64                 :            : // container::XEnumeration
      65                 :        686 : sal_Bool SAL_CALL SvxUnoTextContentEnumeration::hasMoreElements(void)
      66                 :            :     throw( uno::RuntimeException )
      67                 :            : {
      68         [ +  - ]:        686 :     SolarMutexGuard aGuard;
      69 [ +  - ][ +  - ]:        686 :     if( mpEditSource && mpEditSource->GetTextForwarder() )
         [ +  - ][ +  - ]
      70 [ +  - ][ +  - ]:        686 :         return mnNextParagraph < mpEditSource->GetTextForwarder()->GetParagraphCount();
      71                 :            :     else
      72         [ +  - ]:        686 :         return sal_False;
      73                 :            : }
      74                 :            : 
      75                 :        250 : uno::Any SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
      76                 :            : {
      77         [ +  - ]:        250 :     SolarMutexGuard aGuard;
      78                 :            : 
      79 [ +  - ][ +  + ]:        250 :     if(!hasMoreElements())
      80         [ +  - ]:          5 :         throw container::NoSuchElementException();
      81                 :            : 
      82                 :        245 :     SvxUnoTextContent* pContent = 0;
      83                 :            : 
      84         [ +  - ]:        245 :     const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
      85         [ +  - ]:        245 :     SvxUnoTextRangeBaseList::const_iterator aIter;
      86 [ +  - ][ +  - ]:        400 :     for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pContent == 0); ++aIter )
         [ +  + ][ +  - ]
                 [ +  - ]
           [ +  +  #  # ]
      87                 :            :     {
      88 [ +  - ][ -  + ]:        155 :         SvxUnoTextContent* pIterContent = dynamic_cast< SvxUnoTextContent* >( (*aIter ) );
      89 [ +  + ][ -  + ]:        155 :         if( pIterContent && (pIterContent->mnParagraph == mnNextParagraph) )
      90                 :          0 :             pContent = pIterContent;
      91                 :            :     }
      92                 :            : 
      93         [ +  - ]:        245 :     if( pContent == 0 )
      94                 :        245 :      pContent = new SvxUnoTextContent( mrText, mnNextParagraph );
      95                 :            : 
      96                 :        245 :     mnNextParagraph++;
      97                 :            : 
      98 [ +  - ][ +  - ]:        245 :     uno::Reference< text::XTextContent > xRef( pContent );
      99 [ +  - ][ +  - ]:        250 :     return uno::makeAny( xRef );
     100                 :            : }
     101                 :            : 
     102                 :            : // ====================================================================
     103                 :            : // class SvxUnoTextContent
     104                 :            : // ====================================================================
     105                 :            : 
     106                 :        245 : SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw()
     107                 :            : :       SvxUnoTextContent_Base(rText)
     108                 :            : ,   mnParagraph(nPara)
     109                 :            : ,   mrParentText(rText)
     110                 :            : ,   maDisposeListeners(maDisposeContainerMutex)
     111 [ +  - ][ +  - ]:        245 : ,   mbDisposing( false )
     112                 :            : {
     113         [ +  - ]:        245 :     mxParentText = const_cast<SvxUnoTextBase*>(&rText);
     114 [ +  - ][ +  - ]:        245 :     if( GetEditSource() && GetEditSource()->GetTextForwarder() )
         [ +  - ][ +  - ]
     115 [ +  - ][ +  - ]:        245 :         SetSelection( ESelection( mnParagraph,0, mnParagraph, GetEditSource()->GetTextForwarder()->GetTextLen( mnParagraph ) ) );
     116                 :        245 : }
     117                 :            : 
     118                 :          0 : SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw()
     119                 :            : :       SvxUnoTextContent_Base(rContent)
     120                 :            : ,   mrParentText(rContent.mrParentText)
     121                 :            : ,   maDisposeListeners(maDisposeContainerMutex)
     122 [ #  # ][ #  # ]:          0 : ,   mbDisposing( false )
     123                 :            : {
     124         [ #  # ]:          0 :     mxParentText = rContent.mxParentText;
     125                 :          0 :     mnParagraph  = rContent.mnParagraph;
     126                 :          0 :     SetSelection( rContent.GetSelection() );
     127                 :          0 : }
     128                 :            : 
     129 [ +  - ][ +  - ]:        245 : SvxUnoTextContent::~SvxUnoTextContent() throw()
     130                 :            : {
     131         [ -  + ]:        490 : }
     132                 :            : 
     133                 :            : // text::XTextRange
     134                 :            : 
     135                 :          0 : uno::Reference< text::XText > SAL_CALL SvxUnoTextContent::getText()
     136                 :            :     throw(uno::RuntimeException)
     137                 :            : {
     138                 :          0 :     return mxParentText;
     139                 :            : }
     140                 :            : 
     141                 :            : // text::XTextContent
     142                 :          2 : void SAL_CALL SvxUnoTextContent::attach( const uno::Reference< text::XTextRange >& )
     143                 :            :     throw(lang::IllegalArgumentException, uno::RuntimeException)
     144                 :            : {
     145                 :          2 : }
     146                 :            : 
     147                 :          2 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextContent::getAnchor() throw( uno::RuntimeException )
     148                 :            : {
     149                 :          2 :     return uno::Reference< text::XTextRange >::query( mxParentText );
     150                 :            : }
     151                 :            : 
     152                 :            : // XComponent
     153                 :            : 
     154                 :          2 : void SAL_CALL SvxUnoTextContent::dispose()
     155                 :            :     throw(uno::RuntimeException)
     156                 :            : {
     157         [ +  - ]:          2 :     SolarMutexGuard aGuard;
     158                 :            : 
     159         [ -  + ]:          2 :     if( mbDisposing )
     160                 :          2 :         return; // catched a recursion
     161                 :            : 
     162                 :          2 :     mbDisposing = true;
     163                 :            : 
     164         [ +  - ]:          2 :     lang::EventObject aEvt;
     165 [ +  - ][ +  - ]:          2 :     aEvt.Source = *(OWeakAggObject*) this;
     166         [ +  - ]:          2 :     maDisposeListeners.disposeAndClear(aEvt);
     167                 :            : 
     168         [ +  - ]:          2 :     if( mxParentText.is() )
     169 [ +  - ][ +  - ]:          2 :         mxParentText->removeTextContent( this );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     170                 :            : }
     171                 :            : 
     172                 :          4 : void SAL_CALL SvxUnoTextContent::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
     173                 :            :     throw(uno::RuntimeException)
     174                 :            : {
     175                 :          4 :     maDisposeListeners.addInterface(xListener);
     176                 :          4 : }
     177                 :            : 
     178                 :          2 : void SAL_CALL SvxUnoTextContent::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
     179                 :            :     throw(uno::RuntimeException)
     180                 :            : {
     181                 :          2 :    maDisposeListeners.removeInterface(aListener);
     182                 :          2 : }
     183                 :            : 
     184                 :            : // XEnumerationAccess
     185                 :            : 
     186                 :        223 : uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextContent::createEnumeration(  )
     187                 :            :     throw(uno::RuntimeException)
     188                 :            : {
     189         [ +  - ]:        223 :     SolarMutexGuard aGuard;
     190                 :            : 
     191 [ +  - ][ +  - ]:        223 :     return new SvxUnoTextRangeEnumeration( mrParentText, mnParagraph );
                 [ +  - ]
     192                 :            : }
     193                 :            : 
     194                 :            : // XElementAccess ( container::XEnumerationAccess )
     195                 :            : 
     196                 :          2 : uno::Type SAL_CALL SvxUnoTextContent::getElementType()
     197                 :            :     throw(uno::RuntimeException)
     198                 :            : {
     199                 :          2 :     return ::getCppuType((const uno::Reference< text::XTextRange >*)0);
     200                 :            : }
     201                 :            : 
     202                 :          2 : sal_Bool SAL_CALL SvxUnoTextContent::hasElements()
     203                 :            :     throw(uno::RuntimeException)
     204                 :            : {
     205         [ +  - ]:          2 :     SolarMutexGuard aGuard;
     206                 :            : 
     207 [ +  - ][ +  - ]:          2 :     SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
     208         [ +  - ]:          2 :     if( pForwarder )
     209                 :            :     {
     210         [ +  - ]:          2 :         std::vector<sal_uInt16> aPortions;
     211         [ +  - ]:          2 :         pForwarder->GetPortions( mnParagraph, aPortions );
     212                 :          2 :         return !aPortions.empty();
     213                 :            :     }
     214                 :            :     else
     215                 :            :     {
     216                 :          0 :         return 0;
     217         [ +  - ]:          2 :     }
     218                 :            : }
     219                 :            : 
     220                 :            : // XPropertySet
     221                 :            : 
     222                 :        298 : void SAL_CALL SvxUnoTextContent::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
     223                 :            :     throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     224                 :            : {
     225                 :        298 :     _setPropertyValue( aPropertyName, aValue, mnParagraph );
     226                 :        294 : }
     227                 :            : 
     228                 :        769 : uno::Any SAL_CALL SvxUnoTextContent::getPropertyValue( const OUString& PropertyName )
     229                 :            :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     230                 :            : {
     231                 :        769 :     return _getPropertyValue( PropertyName, mnParagraph );
     232                 :            : }
     233                 :            : 
     234                 :            : // XMultiPropertySet
     235                 :          0 : 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)
     236                 :            : {
     237                 :          0 :     _setPropertyValues( aPropertyNames, aValues, mnParagraph );
     238                 :          0 : }
     239                 :            : 
     240                 :        135 : uno::Sequence< uno::Any > SAL_CALL SvxUnoTextContent::getPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (uno::RuntimeException)
     241                 :            : {
     242                 :        135 :     return _getPropertyValues( aPropertyNames, mnParagraph );
     243                 :            : }
     244                 :            : 
     245                 :            : /*// XTolerantMultiPropertySet
     246                 :            : 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)
     247                 :            : {
     248                 :            :     return _setPropertyValuesTolerant(aPropertyNames, aValues, mnParagraph);
     249                 :            : }
     250                 :            : 
     251                 :            : uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL SvxUnoTextContent::getPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (uno::RuntimeException)
     252                 :            : {
     253                 :            :     return _getPropertyValuesTolerant(aPropertyNames, mnParagraph);
     254                 :            : }
     255                 :            : 
     256                 :            : uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SvxUnoTextContent::getDirectPropertyValuesTolerant( const uno::Sequence< ::rtl::OUString >& aPropertyNames )
     257                 :            :     throw (uno::RuntimeException)
     258                 :            : {
     259                 :            :     return _getDirectPropertyValuesTolerant(aPropertyNames, mnParagraph);
     260                 :            : }*/
     261                 :            : 
     262                 :            : // beans::XPropertyState
     263                 :          2 : beans::PropertyState SAL_CALL SvxUnoTextContent::getPropertyState( const OUString& PropertyName )
     264                 :            :     throw(beans::UnknownPropertyException, uno::RuntimeException)
     265                 :            : {
     266                 :          2 :     return _getPropertyState( PropertyName, mnParagraph );
     267                 :            : }
     268                 :            : 
     269                 :         96 : uno::Sequence< beans::PropertyState > SAL_CALL SvxUnoTextContent::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
     270                 :            :     throw(beans::UnknownPropertyException, uno::RuntimeException)
     271                 :            : {
     272                 :         96 :     return _getPropertyStates( aPropertyName, mnParagraph );
     273                 :            : }
     274                 :            : 
     275                 :          2 : void SAL_CALL SvxUnoTextContent::setPropertyToDefault( const OUString& PropertyName )
     276                 :            :     throw(beans::UnknownPropertyException, uno::RuntimeException)
     277                 :            : {
     278                 :          2 :     _setPropertyToDefault( PropertyName, mnParagraph );
     279                 :          2 : }
     280                 :            : 
     281                 :            : // lang::XServiceInfo
     282                 :            : 
     283                 :          0 : OUString SAL_CALL SvxUnoTextContent::getImplementationName()
     284                 :            :     throw(uno::RuntimeException)
     285                 :            : {
     286                 :          0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextContent") );
     287                 :            : }
     288                 :            : 
     289                 :        225 : uno::Sequence< OUString > SAL_CALL SvxUnoTextContent::getSupportedServiceNames()
     290                 :            :     throw(uno::RuntimeException)
     291                 :            : {
     292                 :        225 :     uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
     293                 :            :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 5, "com.sun.star.style.ParagraphProperties",
     294                 :            :                                                   "com.sun.star.style.ParagraphPropertiesComplex",
     295                 :            :                                                   "com.sun.star.style.ParagraphPropertiesAsian",
     296                 :            :                                                   "com.sun.star.text.TextContent",
     297                 :        225 :                                                   "com.sun.star.text.Paragraph");
     298                 :        225 :     return aSeq;
     299                 :            : }
     300                 :            : 
     301                 :            : // ====================================================================
     302                 :            : //  class SvxUnoTextRangeEnumeration
     303                 :            : // ====================================================================
     304                 :            : 
     305                 :        223 : SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw()
     306                 :            : :   mxParentText(  const_cast<SvxUnoTextBase*>(&rText) ),
     307                 :            :     mrParentText( rText ),
     308                 :            :     mnParagraph( nPara ),
     309         [ +  - ]:        223 :     mnNextPortion( 0 )
     310                 :            : {
     311 [ +  - ][ +  - ]:        223 :     mpEditSource = rText.GetEditSource() ? rText.GetEditSource()->Clone() : NULL;
     312                 :            : 
     313 [ +  - ][ +  - ]:        223 :     if( mpEditSource && mpEditSource->GetTextForwarder() )
         [ +  - ][ +  - ]
     314                 :            :     {
     315 [ +  - ][ +  - ]:        223 :         mpPortions = new std::vector<sal_uInt16>;
     316 [ +  - ][ +  - ]:        223 :         mpEditSource->GetTextForwarder()->GetPortions( nPara, *mpPortions );
     317                 :            :     }
     318                 :            :     else
     319                 :            :     {
     320                 :          0 :         mpPortions = NULL;
     321                 :            :     }
     322                 :        223 : }
     323                 :            : 
     324                 :        223 : SvxUnoTextRangeEnumeration::~SvxUnoTextRangeEnumeration() throw()
     325                 :            : {
     326 [ +  - ][ +  - ]:        223 :     delete mpEditSource;
     327         [ +  - ]:        223 :     delete mpPortions;
     328         [ -  + ]:        446 : }
     329                 :            : 
     330                 :            : // container::XEnumeration
     331                 :            : 
     332                 :        502 : sal_Bool SAL_CALL SvxUnoTextRangeEnumeration::hasMoreElements()
     333                 :            :     throw(uno::RuntimeException)
     334                 :            : {
     335         [ +  - ]:        502 :     SolarMutexGuard aGuard;
     336                 :            : 
     337 [ +  - ][ +  + ]:        502 :     return mpPortions && mnNextPortion < mpPortions->size();
                 [ +  - ]
     338                 :            : }
     339                 :            : 
     340                 :        295 : uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement()
     341                 :            :     throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
     342                 :            : {
     343         [ +  - ]:        295 :     SolarMutexGuard aGuard;
     344                 :            : 
     345 [ +  - ][ +  + ]:        295 :     if( mpPortions == NULL || mnNextPortion >= mpPortions->size() )
                 [ +  + ]
     346         [ +  - ]:          2 :         throw container::NoSuchElementException();
     347                 :            : 
     348                 :        293 :     sal_uInt16 nStartPos = 0;
     349         [ +  + ]:        293 :     if (mnNextPortion > 0)
     350         [ +  - ]:         72 :         nStartPos = mpPortions->at(mnNextPortion-1);
     351         [ +  - ]:        293 :     sal_uInt16 nEndPos = mpPortions->at(mnNextPortion);
     352                 :        293 :     ESelection aSel( mnParagraph, nStartPos, mnParagraph, nEndPos );
     353                 :            : 
     354                 :        293 :     uno::Reference< text::XTextRange > xRange;
     355                 :            : 
     356         [ +  - ]:        293 :     const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
     357                 :            : 
     358                 :        293 :     SvxUnoTextRange* pRange = 0;
     359                 :            : 
     360         [ +  - ]:        293 :     SvxUnoTextRangeBaseList::const_iterator aIter;
     361 [ +  - ][ +  - ]:        493 :     for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pRange == 0); ++aIter )
         [ +  + ][ +  - ]
                 [ +  - ]
           [ +  +  #  # ]
     362                 :            :     {
     363 [ +  - ][ -  + ]:        200 :         SvxUnoTextRange* pIterRange = dynamic_cast< SvxUnoTextRange* >( (*aIter ) );
     364 [ -  + ][ #  # ]:        200 :         if( pIterRange && pIterRange->mbPortion && (aSel.IsEqual( pIterRange->maSelection ) ) )
         [ #  # ][ -  + ]
     365                 :          0 :             pRange = pIterRange;
     366                 :            :     }
     367                 :            : 
     368         [ +  - ]:        293 :     if( pRange == 0 )
     369                 :            :     {
     370                 :        293 :         pRange = new SvxUnoTextRange( mrParentText, sal_True );
     371                 :        293 :         pRange->SetSelection(aSel);
     372                 :            :     }
     373                 :            : 
     374 [ +  - ][ +  - ]:        293 :     xRange = pRange;
     375                 :            : 
     376                 :        293 :     mnNextPortion++;
     377                 :            : 
     378 [ +  - ][ +  - ]:        295 :     return uno::makeAny( xRange );
     379                 :            : }
     380                 :            : 
     381                 :            : // ====================================================================
     382                 :            : // class SvxUnoTextCursor
     383                 :            : // ====================================================================
     384                 :            : 
     385                 :       1106 : SvxUnoTextCursor_Base::SvxUnoTextCursor_Base(SvxUnoTextCursor_Base const & base)
     386                 :            :     throw ():
     387                 :       1106 :     SvxUnoTextCursor_Base0(base)
     388                 :       1106 : {}
     389                 :            : 
     390                 :       4134 : SvxUnoTextCursor_Base::SvxUnoTextCursor_Base(SvxUnoTextRangeBase const & base)
     391                 :            :     throw ():
     392                 :       4134 :     SvxUnoTextCursor_Base0(base)
     393                 :       4134 : {}
     394                 :            : 
     395         [ -  + ]:       5240 : SvxUnoTextCursor_Base::~SvxUnoTextCursor_Base() throw () {}
     396                 :            : 
     397                 :          0 : uno::Reference< uno::XInterface > SvxUnoTextCursor_NewInstance()
     398                 :            : {
     399                 :          0 :     SvxUnoText aText;
     400         [ #  # ]:          0 :     uno::Reference< text::XText > xText( (text::XText*)new SvxUnoTextCursor( aText ) );
     401         [ #  # ]:          0 :     uno::Reference< uno::XInterface > xInt( xText, uno::UNO_QUERY );
     402                 :          0 :     return xInt;
     403                 :            : }
     404                 :            : 
     405                 :       4134 : SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw()
     406                 :            : :       SvxUnoTextCursor_Base(rText),
     407         [ +  - ]:       4134 :     mxParentText( const_cast<SvxUnoTextBase*>(&rText) )
     408                 :            : {
     409                 :       4134 : }
     410                 :            : 
     411                 :       1106 : SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw()
     412                 :            : :       SvxUnoTextCursor_Base(rCursor)
     413                 :       1106 : ,   mxParentText(rCursor.mxParentText)
     414                 :            : {
     415                 :       1106 : }
     416                 :            : 
     417                 :       5240 : SvxUnoTextCursor::~SvxUnoTextCursor() throw()
     418                 :            : {
     419         [ -  + ]:       8203 : }
     420                 :            : 
     421                 :            : // text::XTextCursor
     422                 :          4 : void SAL_CALL SvxUnoTextCursor::collapseToStart()
     423                 :            :     throw(uno::RuntimeException)
     424                 :            : {
     425         [ +  - ]:          4 :     SolarMutexGuard aGuard;
     426         [ +  - ]:          4 :     CollapseToStart();
     427                 :          4 : }
     428                 :            : 
     429                 :          4 : void SAL_CALL SvxUnoTextCursor::collapseToEnd()
     430                 :            :     throw(uno::RuntimeException)
     431                 :            : {
     432         [ +  - ]:          4 :     SolarMutexGuard aGuard;
     433         [ +  - ]:          4 :     CollapseToEnd();
     434                 :          4 : }
     435                 :            : 
     436                 :        170 : sal_Bool SAL_CALL SvxUnoTextCursor::isCollapsed()
     437                 :            :     throw(uno::RuntimeException)
     438                 :            : {
     439         [ +  - ]:        170 :     SolarMutexGuard aGuard;
     440         [ +  - ]:        170 :     return IsCollapsed();
     441                 :            : }
     442                 :            : 
     443                 :        871 : sal_Bool SAL_CALL SvxUnoTextCursor::goLeft( sal_Int16 nCount, sal_Bool bExpand )
     444                 :            :     throw(uno::RuntimeException)
     445                 :            : {
     446         [ +  - ]:        871 :     SolarMutexGuard aGuard;
     447         [ +  - ]:        871 :     return GoLeft( nCount, bExpand );
     448                 :            : }
     449                 :            : 
     450                 :         12 : sal_Bool SAL_CALL SvxUnoTextCursor::goRight( sal_Int16 nCount, sal_Bool bExpand )
     451                 :            :     throw(uno::RuntimeException)
     452                 :            : {
     453         [ +  - ]:         12 :     SolarMutexGuard aGuard;
     454         [ +  - ]:         12 :     return GoRight( nCount, bExpand );
     455                 :            : }
     456                 :            : 
     457                 :         36 : void SAL_CALL SvxUnoTextCursor::gotoStart( sal_Bool bExpand )
     458                 :            :     throw(uno::RuntimeException)
     459                 :            : {
     460         [ +  - ]:         36 :     SolarMutexGuard aGuard;
     461         [ +  - ]:         36 :     GotoStart( bExpand );
     462                 :         36 : }
     463                 :            : 
     464                 :       2808 : void SAL_CALL SvxUnoTextCursor::gotoEnd( sal_Bool bExpand )
     465                 :            :     throw(uno::RuntimeException)
     466                 :            : {
     467         [ +  - ]:       2808 :     SolarMutexGuard aGuard;
     468         [ +  - ]:       2808 :     GotoEnd( bExpand );
     469                 :       2808 : }
     470                 :            : 
     471                 :       1104 : void SAL_CALL SvxUnoTextCursor::gotoRange( const uno::Reference< text::XTextRange >& xRange, sal_Bool bExpand )
     472                 :            :     throw(uno::RuntimeException)
     473                 :            : {
     474         [ -  + ]:       1104 :     if( !xRange.is() )
     475                 :       1104 :         return;
     476                 :            : 
     477                 :       1104 :     SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( xRange );
     478                 :            : 
     479         [ +  - ]:       1104 :     if( pRange )
     480                 :            :     {
     481                 :       1104 :         ESelection aNewSel = pRange->GetSelection();
     482                 :            : 
     483         [ +  + ]:       1104 :         if( bExpand )
     484                 :            :         {
     485                 :        866 :             const ESelection& rOldSel = GetSelection();
     486                 :        866 :             aNewSel.nStartPara = rOldSel.nStartPara;
     487                 :        866 :             aNewSel.nStartPos  = rOldSel.nStartPos;
     488                 :            :         }
     489                 :            : 
     490                 :       1104 :         SetSelection( aNewSel );
     491                 :            :     }
     492                 :            : }
     493                 :            : 
     494                 :            : // text::XTextRange (rest in SvxTextRange)
     495                 :        917 : uno::Reference< text::XText > SAL_CALL SvxUnoTextCursor::getText(void) throw( uno::RuntimeException )
     496                 :            : {
     497                 :        917 :     return mxParentText;
     498                 :            : }
     499                 :            : 
     500                 :        634 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextCursor::getStart()
     501                 :            :     throw(uno::RuntimeException)
     502                 :            : {
     503                 :        634 :     return SvxUnoTextRangeBase::getStart();
     504                 :            : }
     505                 :            : 
     506                 :          0 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextCursor::getEnd()
     507                 :            :     throw(uno::RuntimeException)
     508                 :            : {
     509                 :          0 :     return SvxUnoTextRangeBase::getEnd();
     510                 :            : }
     511                 :            : 
     512                 :         28 : OUString SAL_CALL SvxUnoTextCursor::getString() throw( uno::RuntimeException )
     513                 :            : {
     514                 :         28 :     return SvxUnoTextRangeBase::getString();
     515                 :            : }
     516                 :            : 
     517                 :       3517 : void SAL_CALL SvxUnoTextCursor::setString( const OUString& aString ) throw(uno::RuntimeException)
     518                 :            : {
     519                 :       3517 :     SvxUnoTextRangeBase::setString(aString);
     520                 :       3517 : }
     521                 :            : // lang::XServiceInfo
     522                 :          0 : OUString SAL_CALL SvxUnoTextCursor::getImplementationName() throw(uno::RuntimeException)
     523                 :            : {
     524                 :          0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextCursor"));
     525                 :            : }
     526                 :            : 
     527                 :         20 : sal_Bool SAL_CALL SvxUnoTextCursor::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
     528                 :            : {
     529                 :         20 :     return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
     530                 :            : }
     531                 :            : 
     532                 :         20 : uno::Sequence< OUString > SAL_CALL SvxUnoTextCursor::getSupportedServiceNames() throw(uno::RuntimeException)
     533                 :            : {
     534                 :         20 :     uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
     535                 :            :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 4,"com.sun.star.style.ParagraphProperties",
     536                 :            :                                                   "com.sun.star.style.ParagraphPropertiesComplex",
     537                 :            :                                                   "com.sun.star.style.ParagraphPropertiesAsian",
     538                 :         20 :                                                  "com.sun.star.text.TextCursor");
     539                 :         20 :     return aSeq;
     540                 :            : }
     541                 :            : 
     542                 :            : 
     543                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10