LCOV - code coverage report
Current view: top level - editeng/source/uno - unotext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 879 1235 71.2 %
Date: 2015-06-13 12:38:46 Functions: 108 182 59.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #include <vcl/svapp.hxx>
      21             : #include <com/sun/star/style/LineSpacing.hpp>
      22             : #include <com/sun/star/text/ControlCharacter.hpp>
      23             : #include <com/sun/star/text/XTextField.hpp>
      24             : #include <com/sun/star/text/TextRangeSelection.hpp>
      25             : 
      26             : #include <osl/mutex.hxx>
      27             : #include <svl/itemset.hxx>
      28             : #include <svl/itempool.hxx>
      29             : #include <svl/intitem.hxx>
      30             : #include <svl/eitem.hxx>
      31             : #include <rtl/instance.hxx>
      32             : 
      33             : #include <editeng/fontitem.hxx>
      34             : #include <editeng/tstpitem.hxx>
      35             : #include <editeng/unoprnms.hxx>
      36             : #include <editeng/unotext.hxx>
      37             : #include <editeng/unoedsrc.hxx>
      38             : #include <editeng/unonrule.hxx>
      39             : #include <editeng/unofdesc.hxx>
      40             : #include <editeng/unofield.hxx>
      41             : #include <editeng/flditem.hxx>
      42             : #include <editeng/numitem.hxx>
      43             : #include <editeng/editeng.hxx>
      44             : #include <editeng/outliner.hxx>
      45             : #include <editeng/unoipset.hxx>
      46             : #include <comphelper/servicehelper.hxx>
      47             : #include <comphelper/serviceinfohelper.hxx>
      48             : #include <cppuhelper/supportsservice.hxx>
      49             : 
      50             : #include "editeng/unonames.hxx"
      51             : 
      52             : #include <boost/scoped_ptr.hpp>
      53             : 
      54             : using namespace ::cppu;
      55             : using namespace ::com::sun::star;
      56             : 
      57             : namespace {
      58             : 
      59        1096 : ESelection toESelection(const text::TextRangeSelection& rSel)
      60             : {
      61        1096 :     ESelection aESel;
      62        1096 :     aESel.nStartPara = rSel.Start.Paragraph;
      63        1096 :     aESel.nStartPos = rSel.Start.PositionInParagraph;
      64        1096 :     aESel.nEndPara = rSel.End.Paragraph;
      65        1096 :     aESel.nEndPos = rSel.End.PositionInParagraph;
      66        1096 :     return aESel;
      67             : }
      68             : 
      69             : }
      70             : 
      71             : #define QUERYINT( xint ) \
      72             :     if( rType == cppu::UnoType<xint>::get() ) \
      73             :         return uno::makeAny(uno::Reference< xint >(this))
      74             : 
      75      105044 : const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet()
      76             : {
      77      105044 :     static SvxItemPropertySet aTextCursorSvxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap(), EditEngine::GetGlobalItemPool() );
      78      105044 :     return &aTextCursorSvxPropertySet;
      79             : }
      80             : 
      81          27 : const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap()
      82             : {
      83             :     // Propertymap for an Outliner Text
      84             :     static const SfxItemPropertyMapEntry aSvxTextPortionPropertyMap[] =
      85             :     {
      86        1200 :         SVX_UNOEDIT_CHAR_PROPERTIES,
      87          24 :         SVX_UNOEDIT_FONT_PROPERTIES,
      88         120 :         SVX_UNOEDIT_OUTLINER_PROPERTIES,
      89         336 :         SVX_UNOEDIT_PARA_PROPERTIES,
      90          24 :         {OUString("TextField"),                     EE_FEATURE_FIELD,   cppu::UnoType<text::XTextField>::get(),   beans::PropertyAttribute::READONLY, 0 },
      91          24 :         {OUString("TextPortionType"),               WID_PORTIONTYPE,    ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 },
      92          24 :         {OUString("TextUserDefinedAttributes"),         EE_CHAR_XMLATTRIBS,     cppu::UnoType<com::sun::star::container::XNameContainer>::get(),        0,     0},
      93          24 :         {OUString("ParaUserDefinedAttributes"),         EE_PARA_XMLATTRIBS,     cppu::UnoType<com::sun::star::container::XNameContainer>::get(),        0,     0},
      94             :         { OUString(), 0, css::uno::Type(), 0, 0 }
      95        1827 :     };
      96          27 :     return aSvxTextPortionPropertyMap;
      97             : }
      98        3487 : const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet()
      99             : {
     100        3487 :     static SvxItemPropertySet aSvxTextPortionPropertySet( ImplGetSvxTextPortionPropertyMap(), EditEngine::GetGlobalItemPool() );
     101        3487 :     return &aSvxTextPortionPropertySet;
     102             : }
     103             : 
     104         468 : const SfxItemPropertySet* ImplGetSvxTextPortionSfxPropertySet()
     105             : {
     106         468 :     static SfxItemPropertySet aSvxTextPortionSfxPropertySet( ImplGetSvxTextPortionPropertyMap() );
     107         468 :     return &aSvxTextPortionSfxPropertySet;
     108             : }
     109             : 
     110          77 : const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap()
     111             : {
     112             :     // Propertymap for an Outliner Text
     113             :     static const SfxItemPropertyMapEntry aSvxUnoOutlinerTextCursorPropertyMap[] =
     114             :     {
     115        3450 :         SVX_UNOEDIT_CHAR_PROPERTIES,
     116          69 :         SVX_UNOEDIT_FONT_PROPERTIES,
     117         345 :         SVX_UNOEDIT_OUTLINER_PROPERTIES,
     118         966 :         SVX_UNOEDIT_PARA_PROPERTIES,
     119          69 :         {OUString("TextUserDefinedAttributes"),         EE_CHAR_XMLATTRIBS,     cppu::UnoType<com::sun::star::container::XNameContainer>::get(),        0,     0},
     120          69 :         {OUString("ParaUserDefinedAttributes"),         EE_PARA_XMLATTRIBS,     cppu::UnoType<com::sun::star::container::XNameContainer>::get(),        0,     0},
     121             :         { OUString(), 0, css::uno::Type(), 0, 0 }
     122        5114 :     };
     123             : 
     124          77 :     return aSvxUnoOutlinerTextCursorPropertyMap;
     125             : }
     126         153 : const SfxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSfxPropertySet()
     127             : {
     128         153 :     static SfxItemPropertySet aTextCursorSfxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap() );
     129         153 :     return &aTextCursorSfxPropertySet;
     130             : }
     131             : 
     132             : 
     133             : // helper for Item/Property conversion
     134             : 
     135             : 
     136      449693 : void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw()
     137             : {
     138             :     DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
     139      449693 :     if( pForwarder )
     140             :     {
     141      449693 :         sal_Int32 nParaCount = pForwarder->GetParagraphCount();
     142      449693 :         if(nParaCount>0)
     143      449693 :             nParaCount--;
     144             : 
     145      449693 :         rSel = ESelection( 0,0, nParaCount, pForwarder->GetTextLen( nParaCount ));
     146             :     }
     147      449693 : }
     148             : 
     149      397579 : void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw()
     150             : {
     151             :     DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
     152      397579 :     if( pForwarder )
     153             :     {
     154      397579 :         if( rSel.nStartPara == EE_PARA_MAX_COUNT )
     155             :         {
     156        3440 :             ::GetSelection( rSel, pForwarder );
     157             :         }
     158             :         else
     159             :         {
     160      394139 :             ESelection aMaxSelection;
     161      394139 :             GetSelection( aMaxSelection, pForwarder );
     162             : 
     163             :             // check start position
     164      394139 :             if( rSel.nStartPara < aMaxSelection.nStartPara )
     165             :             {
     166           0 :                 rSel.nStartPara = aMaxSelection.nStartPara;
     167           0 :                 rSel.nStartPos = aMaxSelection.nStartPos;
     168             :             }
     169      394139 :             else if( rSel.nStartPara > aMaxSelection.nEndPara )
     170             :             {
     171           0 :                 rSel.nStartPara = aMaxSelection.nEndPara;
     172           0 :                 rSel.nStartPos = aMaxSelection.nEndPos;
     173             :             }
     174      394139 :             else if( rSel.nStartPos  > pForwarder->GetTextLen( rSel.nStartPara ) )
     175             :             {
     176           0 :                 rSel.nStartPos = pForwarder->GetTextLen( rSel.nStartPara );
     177             :             }
     178             : 
     179             :             // check end position
     180      394139 :             if( rSel.nEndPara < aMaxSelection.nStartPara )
     181             :             {
     182           0 :                 rSel.nEndPara = aMaxSelection.nStartPara;
     183           0 :                 rSel.nEndPos = aMaxSelection.nStartPos;
     184             :             }
     185      394139 :             else if( rSel.nEndPara > aMaxSelection.nEndPara )
     186             :             {
     187        2421 :                 rSel.nEndPara = aMaxSelection.nEndPara;
     188        2421 :                 rSel.nEndPos = aMaxSelection.nEndPos;
     189             :             }
     190      391718 :             else if( rSel.nEndPos > pForwarder->GetTextLen( rSel.nEndPara ) )
     191             :             {
     192         740 :                 rSel.nEndPos = pForwarder->GetTextLen( rSel.nEndPara );
     193             :             }
     194             :         }
     195             :     }
     196      397579 : }
     197             : 
     198      123890 : void CheckSelection( struct ESelection& rSel, SvxEditSource *pEdit ) throw()
     199             : {
     200      123890 :     if (!pEdit)
     201      123890 :         return;
     202      123890 :     CheckSelection( rSel, pEdit->GetTextForwarder() );
     203             : }
     204             : 
     205             : 
     206             : // class SvxUnoTextRangeBase
     207             : 
     208             : 
     209      121442 : UNO3_GETIMPLEMENTATION_IMPL( SvxUnoTextRangeBase );
     210             : 
     211      105153 : SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw()
     212      105153 : : mpEditSource(NULL) , mpPropSet(_pSet)
     213             : {
     214      105153 : }
     215             : 
     216       13823 : SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw()
     217       13823 : : mpPropSet(_pSet)
     218             : {
     219       13823 :     SolarMutexGuard aGuard;
     220             : 
     221             :     DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!");
     222             : 
     223       13823 :     mpEditSource = pSource->Clone();
     224       13823 :     if (mpEditSource != NULL)
     225             :     {
     226       13823 :         ESelection aSelection;
     227       13823 :         ::GetSelection( aSelection, mpEditSource->GetTextForwarder() );
     228       13823 :         SetSelection( aSelection );
     229             : 
     230       13823 :         mpEditSource->addRange( this );
     231       13823 :     }
     232       13823 : }
     233             : 
     234       14286 : SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw()
     235             : :   text::XTextRange()
     236             : ,   beans::XPropertySet()
     237             : ,   beans::XMultiPropertySet()
     238             : ,   beans::XMultiPropertyStates()
     239             : ,   beans::XPropertyState()
     240             : ,   lang::XServiceInfo()
     241             : ,   text::XTextRangeCompare()
     242             : ,   lang::XUnoTunnel()
     243             : ,   osl::DebugBase<SvxUnoTextRangeBase>()
     244       14286 : ,   mpPropSet(rRange.getPropertySet())
     245             : {
     246       14286 :     SolarMutexGuard aGuard;
     247             : 
     248       14286 :     mpEditSource = rRange.mpEditSource ? rRange.mpEditSource->Clone() : NULL;
     249             : 
     250       14286 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     251       14286 :     if( pForwarder )
     252             :     {
     253       14286 :         maSelection  = rRange.maSelection;
     254       14286 :         CheckSelection( maSelection, pForwarder );
     255             :     }
     256             : 
     257       14286 :     if( mpEditSource )
     258       14286 :         mpEditSource->addRange( this );
     259       14286 : }
     260             : 
     261      262090 : SvxUnoTextRangeBase::~SvxUnoTextRangeBase() throw()
     262             : {
     263      131045 :     if( mpEditSource )
     264      128902 :         mpEditSource->removeRange( this );
     265             : 
     266      131045 :     delete mpEditSource;
     267      131045 : }
     268             : 
     269      103010 : void SvxUnoTextRangeBase::SetEditSource( SvxEditSource* pSource ) throw()
     270             : {
     271             :     DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!");
     272             :     DBG_ASSERT(mpEditSource==NULL,"SvxUnoTextRangeBase::SetEditSource called while SvxEditSource already set" );
     273             : 
     274      103010 :     mpEditSource = pSource;
     275             : 
     276      103010 :     maSelection.nStartPara = EE_PARA_MAX_COUNT;
     277             : 
     278      103010 :     if( mpEditSource )
     279      103010 :         mpEditSource->addRange( this );
     280      103010 : }
     281             : 
     282             : /** puts a field item with a copy of the given FieldData into the itemset
     283             :     corresponding with this range */
     284           1 : void SvxUnoTextRangeBase::attachField( const SvxFieldData* pData ) throw()
     285             : {
     286           1 :     SolarMutexGuard aGuard;
     287             : 
     288           1 :     if( pData )
     289             :     {
     290           1 :         SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     291           1 :         if( pForwarder )
     292             :         {
     293           1 :             SvxFieldItem aField( *pData, EE_FEATURE_FIELD );
     294           1 :             pForwarder->QuickInsertField( aField, maSelection );
     295             :         }
     296           1 :     }
     297           1 : }
     298             : 
     299       64960 : void SvxUnoTextRangeBase::SetSelection( const ESelection& rSelection ) throw()
     300             : {
     301       64960 :     SolarMutexGuard aGuard;
     302             : 
     303       64960 :     maSelection = rSelection;
     304       64960 :     CheckSelection( maSelection, mpEditSource );
     305       64960 : }
     306             : 
     307             : // Interface XTextRange ( XText )
     308             : 
     309        7668 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart()
     310             :     throw( uno::RuntimeException, std::exception )
     311             : {
     312        7668 :     SolarMutexGuard aGuard;
     313             : 
     314        7668 :     uno::Reference< text::XTextRange > xRange;
     315             : 
     316        7668 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     317        7668 :     if( pForwarder )
     318             :     {
     319        7668 :         CheckSelection( maSelection, pForwarder );
     320             : 
     321        7668 :         SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() );
     322             : 
     323        7668 :         if(pText == NULL)
     324           0 :             throw uno::RuntimeException();
     325             : 
     326        7668 :         SvxUnoTextRange* pRange = new SvxUnoTextRange( *pText );
     327        7668 :         xRange = pRange;
     328             : 
     329        7668 :         ESelection aNewSel = maSelection;
     330        7668 :         aNewSel.nEndPara = aNewSel.nStartPara;
     331        7668 :         aNewSel.nEndPos  = aNewSel.nStartPos;
     332        7668 :         pRange->SetSelection( aNewSel );
     333             :     }
     334             : 
     335        7668 :     return xRange;
     336             : }
     337             : 
     338          40 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd()
     339             :     throw( uno::RuntimeException, std::exception )
     340             : {
     341          40 :     SolarMutexGuard aGuard;
     342             : 
     343          40 :     uno::Reference< text::XTextRange > xRet;
     344             : 
     345          40 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     346          40 :     if( pForwarder )
     347             :     {
     348          40 :         CheckSelection( maSelection, pForwarder );
     349             : 
     350          40 :         SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() );
     351             : 
     352          40 :         if(pText == NULL)
     353           0 :             throw uno::RuntimeException();
     354             : 
     355          40 :         SvxUnoTextRange* pNew = new SvxUnoTextRange( *pText );
     356          40 :         xRet = pNew;
     357             : 
     358          40 :         ESelection aNewSel = maSelection;
     359          40 :         aNewSel.nStartPara = aNewSel.nEndPara;
     360          40 :         aNewSel.nStartPos  = aNewSel.nEndPos;
     361          40 :         pNew->SetSelection( aNewSel );
     362             :     }
     363          40 :     return xRet;
     364             : }
     365             : 
     366        4427 : OUString SAL_CALL SvxUnoTextRangeBase::getString()
     367             :     throw( uno::RuntimeException, std::exception )
     368             : {
     369        4427 :     SolarMutexGuard aGuard;
     370             : 
     371        4427 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     372        4427 :     if( pForwarder )
     373             :     {
     374        4427 :         CheckSelection( maSelection, pForwarder );
     375             : 
     376        4427 :         return pForwarder->GetText( maSelection );
     377             :     }
     378             :     else
     379             :     {
     380           0 :         const OUString aEmpty;
     381           0 :         return aEmpty;
     382        4427 :     }
     383             : }
     384             : 
     385       33302 : void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString)
     386             :     throw( uno::RuntimeException, std::exception )
     387             : {
     388       33302 :     SolarMutexGuard aGuard;
     389             : 
     390       33302 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     391       33302 :     if( pForwarder )
     392             :     {
     393       33302 :         CheckSelection( maSelection, pForwarder );
     394             : 
     395       33302 :         OUString aConverted(convertLineEnd(aString, LINEEND_LF));  // Simply count the number of line endings
     396             : 
     397       33302 :         pForwarder->QuickInsertText( aConverted, maSelection );
     398       33302 :         mpEditSource->UpdateData();
     399             : 
     400             :         //  Adapt selection
     401             :         //! It would be easier if the EditEngine would return the selection
     402             :         //! on QuickInsertText...
     403       33302 :         CollapseToStart();
     404             : 
     405       33302 :         sal_Int32 nLen = aConverted.getLength();
     406       33302 :         if (nLen)
     407       29868 :             GoRight( nLen, true );
     408       33302 :     }
     409       33302 : }
     410             : 
     411             : // Interface beans::XPropertySet
     412       21895 : uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextRangeBase::getPropertySetInfo()
     413             :     throw( uno::RuntimeException, std::exception )
     414             : {
     415       21895 :     return mpPropSet->getPropertySetInfo();
     416             : }
     417             : 
     418       13984 : void SAL_CALL SvxUnoTextRangeBase::setPropertyValue(const OUString& PropertyName, const uno::Any& aValue)
     419             :     throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     420             : {
     421       13984 :     if (PropertyName == UNO_TR_PROP_SELECTION)
     422             :     {
     423         548 :         text::TextRangeSelection aSel = aValue.get<text::TextRangeSelection>();
     424         548 :         SetSelection(toESelection(aSel));
     425             : 
     426       14501 :         return;
     427             :     }
     428             : 
     429       13436 :     _setPropertyValue( PropertyName, aValue, -1 );
     430             : }
     431             : 
     432       13592 : void SAL_CALL SvxUnoTextRangeBase::_setPropertyValue( const OUString& PropertyName, const uno::Any& aValue, sal_Int32 nPara )
     433             :     throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
     434             : {
     435       13592 :     SolarMutexGuard aGuard;
     436             : 
     437       13592 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     438       13592 :     if( pForwarder )
     439             :     {
     440       13592 :         CheckSelection( maSelection, pForwarder );
     441             : 
     442       13592 :         const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName );
     443       13592 :         if ( pMap )
     444             :         {
     445       13560 :             ESelection aSel( GetSelection() );
     446       13560 :             bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
     447             : 
     448       13560 :             if( nPara == -1 && !bParaAttrib )
     449             :             {
     450        3198 :                 SfxItemSet aOldSet( pForwarder->GetAttribs( aSel ) );
     451             :                 // we have a selection and no para attribute
     452        6396 :                 SfxItemSet aNewSet( *aOldSet.GetPool(), aOldSet.GetRanges() );
     453             : 
     454        3198 :                 setPropertyValue( pMap, aValue, maSelection, aOldSet, aNewSet );
     455             : 
     456             : 
     457        6395 :                 pForwarder->QuickSetAttribs( aNewSet, GetSelection() );
     458             :             }
     459             :             else
     460             :             {
     461             :                 sal_Int32 nEndPara;
     462             : 
     463       10362 :                 if( nPara == -1 )
     464             :                 {
     465       10208 :                     nPara = aSel.nStartPara;
     466       10208 :                     nEndPara = aSel.nEndPara;
     467             :                 }
     468             :                 else
     469             :                 {
     470             :                     // only one paragraph
     471         154 :                     nEndPara = nPara;
     472             :                 }
     473             : 
     474       31172 :                 while( nPara <= nEndPara )
     475             :                 {
     476             :                     // we have a paragraph
     477       10449 :                     SfxItemSet aSet( pForwarder->GetParaAttribs( nPara ) );
     478       10449 :                     setPropertyValue( pMap, aValue, maSelection, aSet, aSet );
     479       10448 :                     pForwarder->SetParaAttribs( nPara, aSet );
     480       10448 :                     nPara++;
     481       10449 :                 }
     482             :             }
     483             : 
     484       13558 :             GetEditSource()->UpdateData();
     485       27116 :             return;
     486             :         }
     487             :     }
     488             : 
     489       13558 :     throw beans::UnknownPropertyException();
     490             : }
     491             : 
     492       98081 : void SvxUnoTextRangeBase::setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet ) throw( beans::UnknownPropertyException, lang::IllegalArgumentException )
     493             : {
     494       98081 :     if(!SetPropertyValueHelper( rOldSet, pMap, rValue, rNewSet, &rSelection, GetEditSource() ))
     495             :     {
     496             :         // For parts of composite items with multiple properties (eg background)
     497             :         // must be taken from the document before the old item.
     498       91079 :         rNewSet.Put(rOldSet.Get(pMap->nWID));  // Old Item in new Set
     499       91079 :         SvxItemPropertySet::setPropertyValue(pMap, rValue, rNewSet, false );
     500             :     }
     501       98079 : }
     502             : 
     503     1593941 : bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemSet&, const SfxItemPropertySimpleEntry* pMap, const uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection /* = NULL */, SvxEditSource* pEditSource /* = NULL*/ )
     504             : {
     505     1593941 :     switch( pMap->nWID )
     506             :     {
     507             :     case WID_FONTDESC:
     508             :         {
     509           0 :             awt::FontDescriptor aDesc;
     510           0 :             if(aValue >>= aDesc)
     511             :             {
     512           0 :                 SvxUnoFontDescriptor::FillItemSet( aDesc, rNewSet );
     513           0 :                 return true;
     514           0 :             }
     515             :         }
     516           0 :         break;
     517             : 
     518             :     case EE_PARA_NUMBULLET:
     519             :         {
     520        4423 :             uno::Reference< container::XIndexReplace > xRule;
     521        4423 :             if( !aValue.hasValue() || ((aValue >>= xRule) && !xRule.is()) )
     522        2823 :                 return true;
     523             : 
     524        1600 :             return false;
     525             :         }
     526             : 
     527             :     case WID_NUMLEVEL:
     528             :         {
     529        2861 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     530        2861 :             if(pForwarder && pSelection)
     531             :             {
     532        2861 :                 sal_Int16 nLevel = sal_Int16();
     533        2861 :                 if( aValue >>= nLevel )
     534             :                 {
     535             :                     // #101004# Call interface method instead of unsafe cast
     536        2861 :                     if(! pForwarder->SetDepth( pSelection->nStartPara, nLevel ) )
     537           0 :                         throw lang::IllegalArgumentException();
     538             : 
     539        2861 :                     return true;
     540             :                 }
     541             :             }
     542             :         }
     543           0 :         break;
     544             :     case WID_NUMBERINGSTARTVALUE:
     545             :         {
     546           2 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     547           2 :             if(pForwarder && pSelection)
     548             :             {
     549           2 :                 sal_Int16 nStartValue = -1;
     550           2 :                 if( aValue >>= nStartValue )
     551             :                 {
     552           0 :                     pForwarder->SetNumberingStartValue( pSelection->nStartPara, nStartValue );
     553           0 :                     return true;
     554             :                 }
     555             :             }
     556             :         }
     557           2 :         break;
     558             :     case WID_PARAISNUMBERINGRESTART:
     559             :         {
     560           4 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     561           4 :             if(pForwarder && pSelection)
     562             :             {
     563           4 :                 bool bParaIsNumberingRestart = false;
     564           4 :                 if( aValue >>= bParaIsNumberingRestart )
     565             :                 {
     566           4 :                     pForwarder->SetParaIsNumberingRestart( pSelection->nStartPara, bParaIsNumberingRestart );
     567           4 :                     return true;
     568             :                 }
     569             :             }
     570             :         }
     571           0 :         break;
     572             :     case EE_PARA_BULLETSTATE:
     573             :         {
     574        2152 :             bool bBullet = true;
     575        2152 :             if( aValue >>= bBullet )
     576             :             {
     577        2152 :                 SfxBoolItem aItem( EE_PARA_BULLETSTATE, bBullet );
     578        2152 :                 rNewSet.Put(aItem);
     579        2152 :                 return true;
     580             :             }
     581             :         }
     582           0 :         break;
     583             : 
     584             :     default:
     585     1584499 :         return false;
     586             :     }
     587             : 
     588           2 :     throw lang::IllegalArgumentException();
     589             : }
     590             : 
     591       23324 : uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyValue(const OUString& PropertyName)
     592             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     593             : {
     594       23324 :     if (PropertyName == UNO_TR_PROP_SELECTION)
     595             :     {
     596         553 :         const ESelection& rSel = GetSelection();
     597         553 :         text::TextRangeSelection aSel;
     598         553 :         aSel.Start.Paragraph = rSel.nStartPara;
     599         553 :         aSel.Start.PositionInParagraph = static_cast<sal_Int32>(rSel.nStartPos);
     600         553 :         aSel.End.Paragraph = rSel.nEndPara;
     601         553 :         aSel.End.PositionInParagraph = static_cast<sal_Int32>(rSel.nEndPos);
     602         553 :         return uno::makeAny(aSel);
     603             :     }
     604             : 
     605       22771 :     return _getPropertyValue( PropertyName, -1 );
     606             : }
     607             : 
     608       31102 : uno::Any SAL_CALL SvxUnoTextRangeBase::_getPropertyValue(const OUString& PropertyName, sal_Int32 nPara )
     609             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
     610             : {
     611       31102 :     SolarMutexGuard aGuard;
     612             : 
     613       31102 :     uno::Any aAny;
     614             : 
     615       31102 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     616       31102 :     if( pForwarder )
     617             :     {
     618       31102 :         const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName );
     619       31102 :         if( pMap )
     620             :         {
     621       29952 :             SfxItemSet* pAttribs = NULL;
     622       29952 :             if( nPara != -1 )
     623        8331 :                 pAttribs = pForwarder->GetParaAttribs( nPara ).Clone();
     624             :             else
     625       21621 :                 pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
     626             : 
     627             :             //  Replace Dontcare with Default, so that one always has a mirror
     628       29952 :             pAttribs->ClearInvalidItems();
     629             : 
     630       29952 :             getPropertyValue( pMap, aAny, *pAttribs );
     631             : 
     632       29952 :             delete pAttribs;
     633       59904 :             return aAny;
     634             :         }
     635             :     }
     636             : 
     637        1150 :     throw beans::UnknownPropertyException();
     638             : }
     639             : 
     640       31459 : void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertySimpleEntry* pMap, uno::Any& rAny, const SfxItemSet& rSet )
     641             :     throw (beans::UnknownPropertyException, uno::RuntimeException)
     642             : {
     643       31459 :     switch( pMap->nWID )
     644             :     {
     645             :     case EE_FEATURE_FIELD:
     646         741 :         if ( rSet.GetItemState( EE_FEATURE_FIELD, false ) == SfxItemState::SET )
     647             :         {
     648         741 :             const SvxFieldItem* pItem = static_cast<const SvxFieldItem*>(rSet.GetItem( EE_FEATURE_FIELD ));
     649         741 :             const SvxFieldData* pData = pItem->GetField();
     650         741 :             uno::Reference< text::XTextRange > xAnchor( this );
     651             : 
     652             :             // get presentation string for field
     653         741 :             Color* pTColor = NULL;
     654         741 :             Color* pFColor = NULL;
     655             : 
     656         741 :             SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder();
     657        1482 :             OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.nStartPara, maSelection.nStartPos, pTColor, pFColor ) );
     658             : 
     659         741 :             delete pTColor;
     660         741 :             delete pFColor;
     661             : 
     662        1482 :             uno::Reference< text::XTextField > xField( new SvxUnoTextField( xAnchor, aPresentation, pData ) );
     663        1482 :             rAny <<= xField;
     664             :         }
     665         741 :         break;
     666             : 
     667             :     case WID_PORTIONTYPE:
     668        2586 :         if ( rSet.GetItemState( EE_FEATURE_FIELD, false ) == SfxItemState::SET )
     669             :         {
     670         686 :             OUString aType("TextField");
     671         686 :             rAny <<= aType;
     672             :         }
     673             :         else
     674             :         {
     675        1900 :             OUString aType("Text");
     676        1900 :             rAny <<= aType;
     677             :         }
     678        2586 :         break;
     679             : 
     680             :     default:
     681       28132 :         if(!GetPropertyValueHelper( *const_cast<SfxItemSet*>(&rSet), pMap, rAny, &maSelection, GetEditSource() ))
     682       20612 :             rAny = SvxItemPropertySet::getPropertyValue(pMap, rSet, true, false );
     683             :     }
     684       31459 : }
     685             : 
     686      106052 : bool SvxUnoTextRangeBase::GetPropertyValueHelper(  SfxItemSet& rSet, const SfxItemPropertySimpleEntry* pMap, uno::Any& aAny, const ESelection* pSelection /* = NULL */, SvxEditSource* pEditSource /* = NULL */ )
     687             :     throw( uno::RuntimeException )
     688             : {
     689      106052 :     switch( pMap->nWID )
     690             :     {
     691             :     case WID_FONTDESC:
     692             :         {
     693           0 :             awt::FontDescriptor aDesc;
     694           0 :             SvxUnoFontDescriptor::FillFromItemSet( rSet, aDesc );
     695           0 :             aAny <<= aDesc;
     696             :         }
     697           0 :         break;
     698             : 
     699             :     case EE_PARA_NUMBULLET:
     700             :         {
     701        4942 :             SfxItemState eState = rSet.GetItemState( EE_PARA_NUMBULLET, true );
     702        4942 :             if( eState != SfxItemState::SET && eState != SfxItemState::DEFAULT)
     703           0 :                 throw uno::RuntimeException();
     704             : 
     705        4942 :             const SvxNumBulletItem* pBulletItem = static_cast<const SvxNumBulletItem*>(rSet.GetItem( EE_PARA_NUMBULLET, true ));
     706             : 
     707        4942 :             if( pBulletItem == NULL )
     708           0 :                 throw uno::RuntimeException();
     709             : 
     710        4942 :             aAny <<= SvxCreateNumRule( pBulletItem->GetNumRule() );
     711             :         }
     712        4942 :         break;
     713             : 
     714             :     case WID_NUMLEVEL:
     715             :         {
     716        2529 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     717        2529 :             if(pForwarder && pSelection)
     718             :             {
     719        2529 :                 sal_Int16 nLevel = pForwarder->GetDepth( pSelection->nStartPara );
     720        2529 :                 if( nLevel >= 0 )
     721         285 :                     aAny <<= nLevel;
     722             :             }
     723             :         }
     724        2529 :         break;
     725             :     case WID_NUMBERINGSTARTVALUE:
     726             :         {
     727           2 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     728           2 :             if(pForwarder && pSelection)
     729           2 :                 aAny <<= pForwarder->GetNumberingStartValue( pSelection->nStartPara );
     730             :         }
     731           2 :         break;
     732             :     case WID_PARAISNUMBERINGRESTART:
     733             :         {
     734          10 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     735          10 :             if(pForwarder && pSelection)
     736          10 :                 aAny <<= pForwarder->IsParaIsNumberingRestart( pSelection->nStartPara );
     737             :         }
     738          10 :         break;
     739             : 
     740             :     case EE_PARA_BULLETSTATE:
     741             :         {
     742         798 :             bool bState = false;
     743         798 :             SfxItemState eState = rSet.GetItemState( EE_PARA_BULLETSTATE, true );
     744         798 :             if( eState == SfxItemState::SET || eState == SfxItemState::DEFAULT )
     745             :             {
     746         798 :                 const SfxBoolItem* pItem = static_cast<const SfxBoolItem*>(rSet.GetItem( EE_PARA_BULLETSTATE, true ));
     747         798 :                 bState = pItem->GetValue();
     748             :             }
     749             : 
     750         798 :             aAny <<= bState;
     751             :         }
     752         798 :         break;
     753             :     default:
     754             : 
     755       97771 :         return false;
     756             :     }
     757             : 
     758        8281 :     return true;
     759             : }
     760             : 
     761             : // is not (yet) supported
     762           0 : void SAL_CALL SvxUnoTextRangeBase::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
     763           0 : void SAL_CALL SvxUnoTextRangeBase::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
     764         108 : void SAL_CALL SvxUnoTextRangeBase::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
     765         100 : void SAL_CALL SvxUnoTextRangeBase::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
     766             : 
     767             : // XMultiPropertySet
     768        6608 : void SAL_CALL SvxUnoTextRangeBase::setPropertyValues( const uno::Sequence< OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     769             : {
     770        6608 :     _setPropertyValues( aPropertyNames, aValues, -1 );
     771        6608 : }
     772             : 
     773        6608 : void SAL_CALL SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues, sal_Int32 nPara ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     774             : {
     775        6608 :     SolarMutexGuard aGuard;
     776             : 
     777        6608 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     778        6608 :     if( pForwarder )
     779             :     {
     780        6608 :         CheckSelection( maSelection, pForwarder );
     781             : 
     782        6608 :         ESelection aSel( GetSelection() );
     783             : 
     784        6608 :         const OUString* pPropertyNames = aPropertyNames.getConstArray();
     785        6608 :         const uno::Any* pValues = aValues.getConstArray();
     786        6608 :         sal_Int32 nCount = aPropertyNames.getLength();
     787             : 
     788        6608 :         sal_Int32 nEndPara = nPara;
     789        6608 :         sal_Int32 nTempPara = nPara;
     790             : 
     791        6608 :         if( nTempPara == -1 )
     792             :         {
     793        6608 :             nTempPara = aSel.nStartPara;
     794        6608 :             nEndPara = aSel.nEndPara;
     795             :         }
     796             : 
     797        6608 :         SfxItemSet* pOldAttrSet = NULL;
     798        6608 :         SfxItemSet* pNewAttrSet = NULL;
     799             : 
     800        6608 :         SfxItemSet* pOldParaSet = NULL;
     801        6608 :         SfxItemSet* pNewParaSet = NULL;
     802             : 
     803       91607 :         for( ; nCount; nCount--, pPropertyNames++, pValues++ )
     804             :         {
     805       84999 :             const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
     806             : 
     807       84999 :             if( pMap )
     808             :             {
     809       84434 :                 bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
     810             : 
     811       84434 :                 if( (nPara == -1) && !bParaAttrib )
     812             :                 {
     813       73973 :                     if( NULL == pNewAttrSet )
     814             :                     {
     815        5617 :                         const SfxItemSet aSet( pForwarder->GetAttribs( aSel ) );
     816        5617 :                         pOldAttrSet = new SfxItemSet( aSet );
     817        5617 :                         pNewAttrSet = new SfxItemSet( *pOldAttrSet->GetPool(), pOldAttrSet->GetRanges() );
     818             :                     }
     819             : 
     820       73973 :                     setPropertyValue( pMap, *pValues, GetSelection(), *pOldAttrSet, *pNewAttrSet );
     821             : 
     822       73973 :                     if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
     823             :                     {
     824             :                         const SfxPoolItem* pItem;
     825       72691 :                         if( pNewAttrSet->GetItemState( pMap->nWID, true, &pItem ) == SfxItemState::SET )
     826             :                         {
     827       72691 :                             pOldAttrSet->Put( *pItem );
     828             :                         }
     829       73973 :                     }
     830             :                 }
     831             :                 else
     832             :                 {
     833       10461 :                     if( NULL == pNewParaSet )
     834             :                     {
     835        2538 :                         const SfxItemSet aSet( pForwarder->GetParaAttribs( nTempPara ) );
     836        2538 :                         pOldParaSet = new SfxItemSet( aSet );
     837        2538 :                         pNewParaSet = new SfxItemSet( *pOldParaSet->GetPool(), pOldParaSet->GetRanges() );
     838             :                     }
     839             : 
     840       10461 :                     setPropertyValue( pMap, *pValues, GetSelection(), *pOldParaSet, *pNewParaSet );
     841             : 
     842       10461 :                     if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
     843             :                     {
     844             :                         const SfxPoolItem* pItem;
     845       10461 :                         if( pNewParaSet->GetItemState( pMap->nWID, true, &pItem ) == SfxItemState::SET )
     846             :                         {
     847       10461 :                             pOldParaSet->Put( *pItem );
     848             :                         }
     849             :                     }
     850             : 
     851             :                 }
     852             :             }
     853             :         }
     854             : 
     855        6608 :         bool bNeedsUpdate = false;
     856             : 
     857        6608 :         if( pNewParaSet )
     858             :         {
     859        2538 :             if( pNewParaSet->Count() )
     860             :             {
     861        7614 :                 while( nTempPara <= nEndPara )
     862             :                 {
     863        2538 :                     SfxItemSet aSet( pForwarder->GetParaAttribs( nTempPara ) );
     864        2538 :                     aSet.Put( *pNewParaSet );
     865        2538 :                     pForwarder->SetParaAttribs( nTempPara, aSet );
     866        2538 :                     nTempPara++;
     867        2538 :                 }
     868        2538 :                 bNeedsUpdate = true;
     869             :             }
     870             : 
     871        2538 :             delete pNewParaSet;
     872        2538 :             delete pOldParaSet;
     873             :         }
     874             : 
     875        6608 :         if( pNewAttrSet )
     876             :         {
     877        5617 :             if( pNewAttrSet->Count() )
     878             :             {
     879        4335 :                 pForwarder->QuickSetAttribs( *pNewAttrSet, GetSelection() );
     880        4335 :                 bNeedsUpdate = true;
     881             :             }
     882        5617 :             delete pNewAttrSet;
     883        5617 :             delete pOldAttrSet;
     884             : 
     885             :         }
     886             : 
     887        6608 :         if( bNeedsUpdate )
     888        6608 :             GetEditSource()->UpdateData();
     889        6608 :     }
     890        6608 : }
     891             : 
     892          98 : uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::getPropertyValues( const uno::Sequence< OUString >& aPropertyNames ) throw (uno::RuntimeException, std::exception)
     893             : {
     894          98 :     return _getPropertyValues( aPropertyNames, -1 );
     895             : }
     896             : 
     897         471 : uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::_getPropertyValues( const uno::Sequence< OUString >& aPropertyNames, sal_Int32 nPara ) throw (uno::RuntimeException)
     898             : {
     899         471 :     SolarMutexGuard aGuard;
     900             : 
     901         471 :     sal_Int32 nCount = aPropertyNames.getLength();
     902             : 
     903             : 
     904         471 :     uno::Sequence< uno::Any > aValues( nCount );
     905             : 
     906         471 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     907         471 :     if( pForwarder )
     908             :     {
     909         471 :         SfxItemSet* pAttribs = NULL;
     910         471 :         if( nPara != -1 )
     911         373 :             pAttribs = pForwarder->GetParaAttribs( nPara ).Clone();
     912             :         else
     913          98 :             pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
     914             : 
     915         471 :         pAttribs->ClearInvalidItems();
     916             : 
     917         471 :         const OUString* pPropertyNames = aPropertyNames.getConstArray();
     918         471 :         uno::Any* pValues = aValues.getArray();
     919             : 
     920        1978 :         for( ; nCount; nCount--, pPropertyNames++, pValues++ )
     921             :         {
     922        1507 :             const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
     923        1507 :             if( pMap )
     924             :             {
     925        1507 :                 getPropertyValue( pMap, *pValues, *pAttribs );
     926             :             }
     927             :         }
     928             : 
     929         471 :         delete pAttribs;
     930             : 
     931             :     }
     932             : 
     933         471 :     return aValues;
     934             : }
     935             : 
     936         108 : void SAL_CALL SvxUnoTextRangeBase::addPropertiesChangeListener( const uno::Sequence< OUString >& , const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException, std::exception)
     937             : {
     938         108 : }
     939             : 
     940         100 : void SAL_CALL SvxUnoTextRangeBase::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException, std::exception)
     941             : {
     942         100 : }
     943             : 
     944           0 : void SAL_CALL SvxUnoTextRangeBase::firePropertiesChangeEvent( const uno::Sequence< OUString >& , const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException, std::exception)
     945             : {
     946           0 : }
     947             : 
     948             : // beans::XPropertyState
     949        2053 : beans::PropertyState SAL_CALL SvxUnoTextRangeBase::getPropertyState( const OUString& PropertyName )
     950             :     throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     951             : {
     952        2053 :     return _getPropertyState( PropertyName, -1 );
     953             : }
     954             : 
     955             : static const sal_uInt16 aSvxUnoFontDescriptorWhichMap[] = { EE_CHAR_FONTINFO, EE_CHAR_FONTHEIGHT, EE_CHAR_ITALIC,
     956             :                                                   EE_CHAR_UNDERLINE, EE_CHAR_WEIGHT, EE_CHAR_STRIKEOUT, EE_CHAR_CASEMAP,
     957             :                                                   EE_CHAR_WLM, 0 };
     958             : 
     959        3574 : beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara)
     960             :     throw( beans::UnknownPropertyException, uno::RuntimeException )
     961             : {
     962        3574 :     if ( pMap )
     963             :     {
     964        3574 :         SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     965        3574 :         if( pForwarder )
     966             :         {
     967        3574 :             SfxItemState eItemState = SfxItemState::UNKNOWN;
     968        3574 :             sal_uInt16 nWID = 0;
     969             : 
     970        3574 :             switch( pMap->nWID )
     971             :             {
     972             :             case WID_FONTDESC:
     973             :                 {
     974           0 :                     const sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap;
     975           0 :                     SfxItemState eTempItemState = SfxItemState::UNKNOWN;
     976           0 :                     while( *pWhichId )
     977             :                     {
     978           0 :                         if(nPara != -1)
     979           0 :                             eTempItemState = pForwarder->GetItemState( nPara, *pWhichId );
     980             :                         else
     981           0 :                             eTempItemState = pForwarder->GetItemState( GetSelection(), *pWhichId );
     982             : 
     983           0 :                         switch( eTempItemState )
     984             :                         {
     985             :                         case SfxItemState::DISABLED:
     986             :                         case SfxItemState::DONTCARE:
     987           0 :                             eItemState = SfxItemState::DONTCARE;
     988           0 :                             break;
     989             : 
     990             :                         case SfxItemState::DEFAULT:
     991           0 :                             if( eItemState != SfxItemState::DEFAULT )
     992             :                             {
     993           0 :                                 if( eItemState == SfxItemState::UNKNOWN )
     994           0 :                                     eItemState = SfxItemState::DEFAULT;
     995             :                             }
     996           0 :                             break;
     997             : 
     998             :                         case SfxItemState::READONLY:
     999             :                         case SfxItemState::SET:
    1000           0 :                             if( eItemState != SfxItemState::SET )
    1001             :                             {
    1002           0 :                                 if( eItemState == SfxItemState::UNKNOWN )
    1003           0 :                                     eItemState = SfxItemState::SET;
    1004             :                             }
    1005           0 :                             break;
    1006             :                         default:
    1007           0 :                             throw beans::UnknownPropertyException();
    1008             :                         }
    1009             : 
    1010           0 :                         pWhichId++;
    1011             :                     }
    1012             :                 }
    1013           0 :                 break;
    1014             : 
    1015             :             case WID_NUMLEVEL:
    1016             :             case WID_NUMBERINGSTARTVALUE:
    1017             :             case WID_PARAISNUMBERINGRESTART:
    1018          21 :                 eItemState = SfxItemState::SET;
    1019          21 :                 break;
    1020             : 
    1021             :             default:
    1022        3553 :                 nWID = pMap->nWID;
    1023             :             }
    1024             : 
    1025        3574 :             if( nWID != 0 )
    1026             :             {
    1027        3553 :                 if( nPara != -1 )
    1028        1500 :                     eItemState = pForwarder->GetItemState( nPara, nWID );
    1029             :                 else
    1030        2053 :                     eItemState = pForwarder->GetItemState( GetSelection(), nWID );
    1031             :             }
    1032             : 
    1033        3574 :             switch( eItemState )
    1034             :             {
    1035             :             case SfxItemState::DONTCARE:
    1036             :             case SfxItemState::DISABLED:
    1037           0 :                 return beans::PropertyState_AMBIGUOUS_VALUE;
    1038             :             case SfxItemState::READONLY:
    1039             :             case SfxItemState::SET:
    1040         778 :                 return beans::PropertyState_DIRECT_VALUE;
    1041             :             case SfxItemState::DEFAULT:
    1042        2796 :                 return beans::PropertyState_DEFAULT_VALUE;
    1043           0 :             default: break;
    1044             : //              case SfxItemState::UNKNOWN:
    1045             :             }
    1046             :         }
    1047             :     }
    1048           0 :     throw beans::UnknownPropertyException();
    1049             : }
    1050             : 
    1051        3574 : beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
    1052             :     throw( beans::UnknownPropertyException, uno::RuntimeException )
    1053             : {
    1054        3574 :     SolarMutexGuard aGuard;
    1055             : 
    1056        3574 :     return _getPropertyState( mpPropSet->getPropertyMapEntry( PropertyName ), nPara);
    1057             : }
    1058             : 
    1059        2284 : uno::Sequence< beans::PropertyState > SAL_CALL SvxUnoTextRangeBase::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
    1060             :     throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    1061             : {
    1062        2284 :     return _getPropertyStates( aPropertyName, -1 );
    1063             : }
    1064             : 
    1065        2762 : uno::Sequence< beans::PropertyState > SvxUnoTextRangeBase::_getPropertyStates(const uno::Sequence< OUString >& PropertyName, sal_Int32 nPara /* = -1 */)
    1066             :     throw( beans::UnknownPropertyException, uno::RuntimeException )
    1067             : {
    1068        2762 :     const sal_Int32 nCount = PropertyName.getLength();
    1069        2762 :     const OUString* pNames = PropertyName.getConstArray();
    1070             : 
    1071        2762 :     uno::Sequence< beans::PropertyState > aRet( nCount );
    1072        2762 :     beans::PropertyState* pState = aRet.getArray();
    1073             : 
    1074        2762 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1075        2762 :     if( pForwarder )
    1076             :     {
    1077        2762 :         SfxItemSet* pSet = NULL;
    1078        2762 :         if( nPara != -1 )
    1079             :         {
    1080         478 :             pSet = new SfxItemSet( pForwarder->GetParaAttribs( nPara ) );
    1081             :         }
    1082             :         else
    1083             :         {
    1084        2284 :             ESelection aSel( GetSelection() );
    1085        2284 :             CheckSelection( aSel, pForwarder );
    1086        2284 :             pSet = new SfxItemSet( pForwarder->GetAttribs( aSel, EditEngineAttribs_OnlyHard ) );
    1087             :         }
    1088             : 
    1089        2762 :         bool bUnknownPropertyFound = false;
    1090      151378 :         for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
    1091             :         {
    1092      148616 :             const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pNames++ );
    1093      148616 :             if( NULL == pMap )
    1094             :             {
    1095           0 :                 bUnknownPropertyFound = true;
    1096           0 :                 break;
    1097             :             }
    1098      148616 :             bUnknownPropertyFound = !_getOnePropertyStates(pSet, pMap, *pState++);
    1099             :         }
    1100             : 
    1101        2762 :         delete pSet;
    1102             : 
    1103        2762 :         if( bUnknownPropertyFound )
    1104           0 :             throw beans::UnknownPropertyException();
    1105             :     }
    1106             : 
    1107        2762 :     return aRet;
    1108             : }
    1109             : 
    1110      148616 : bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertySimpleEntry* pMap, beans::PropertyState& rState)
    1111             : {
    1112      148616 :     bool bUnknownPropertyFound = false;
    1113      148616 :     if(pSet && pMap)
    1114             :     {
    1115      148616 :         SfxItemState eItemState = SfxItemState::UNKNOWN;
    1116      148616 :         sal_uInt16 nWID = 0;
    1117             : 
    1118      148616 :         switch( pMap->nWID )
    1119             :         {
    1120             :             case WID_FONTDESC:
    1121             :                 {
    1122           0 :                     const sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap;
    1123           0 :                     SfxItemState eTempItemState = SfxItemState::UNKNOWN;
    1124           0 :                     while( *pWhichId )
    1125             :                     {
    1126           0 :                         eTempItemState = pSet->GetItemState( *pWhichId );
    1127             : 
    1128           0 :                         switch( eTempItemState )
    1129             :                         {
    1130             :                         case SfxItemState::DISABLED:
    1131             :                         case SfxItemState::DONTCARE:
    1132           0 :                             eItemState = SfxItemState::DONTCARE;
    1133           0 :                             break;
    1134             : 
    1135             :                         case SfxItemState::DEFAULT:
    1136           0 :                             if( eItemState != SfxItemState::DEFAULT )
    1137             :                             {
    1138           0 :                                 if( eItemState == SfxItemState::UNKNOWN )
    1139           0 :                                     eItemState = SfxItemState::DEFAULT;
    1140             :                             }
    1141           0 :                             break;
    1142             : 
    1143             :                         case SfxItemState::READONLY:
    1144             :                         case SfxItemState::SET:
    1145           0 :                             if( eItemState != SfxItemState::SET )
    1146             :                             {
    1147           0 :                                 if( eItemState == SfxItemState::UNKNOWN )
    1148           0 :                                     eItemState = SfxItemState::SET;
    1149             :                             }
    1150           0 :                             break;
    1151             :                         default:
    1152           0 :                             bUnknownPropertyFound = true;
    1153           0 :                             break;
    1154             :                         }
    1155             : 
    1156           0 :                         pWhichId++;
    1157             :                     }
    1158             :                 }
    1159           0 :                 break;
    1160             : 
    1161             :             case WID_NUMLEVEL:
    1162             :             case WID_NUMBERINGSTARTVALUE:
    1163             :             case WID_PARAISNUMBERINGRESTART:
    1164           0 :                 eItemState = SfxItemState::SET;
    1165           0 :                 break;
    1166             : 
    1167             :             default:
    1168      148616 :                 nWID = pMap->nWID;
    1169             :         }
    1170             : 
    1171      148616 :         if( bUnknownPropertyFound )
    1172           0 :             return !bUnknownPropertyFound;
    1173             : 
    1174      148616 :         if( nWID != 0 )
    1175      148616 :             eItemState = pSet->GetItemState( nWID, false );
    1176             : 
    1177      148616 :         switch( eItemState )
    1178             :         {
    1179             :                 case SfxItemState::READONLY:
    1180             :                 case SfxItemState::SET:
    1181        1286 :                     rState = beans::PropertyState_DIRECT_VALUE;
    1182        1286 :                     break;
    1183             :                 case SfxItemState::DEFAULT:
    1184      147330 :                     rState = beans::PropertyState_DEFAULT_VALUE;
    1185      147330 :                     break;
    1186             : //                  case SfxItemState::UNKNOWN:
    1187             : //                  case SfxItemState::DONTCARE:
    1188             : //                  case SfxItemState::DISABLED:
    1189             :                 default:
    1190           0 :                     rState = beans::PropertyState_AMBIGUOUS_VALUE;
    1191             :         }
    1192             :     }
    1193      148616 :     return !bUnknownPropertyFound;
    1194             : }
    1195             : 
    1196           4 : void SAL_CALL SvxUnoTextRangeBase::setPropertyToDefault( const OUString& PropertyName )
    1197             :     throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    1198             : {
    1199           4 :     _setPropertyToDefault( PropertyName, -1 );
    1200           4 : }
    1201             : 
    1202           5 : void SvxUnoTextRangeBase::_setPropertyToDefault(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
    1203             :     throw( beans::UnknownPropertyException, uno::RuntimeException )
    1204             : {
    1205           5 :     SolarMutexGuard aGuard;
    1206             : 
    1207           5 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1208             : 
    1209           5 :     if( pForwarder )
    1210             :     {
    1211           5 :         const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( PropertyName );
    1212           5 :         if ( pMap )
    1213             :         {
    1214           5 :             CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
    1215           5 :             _setPropertyToDefault( pForwarder, pMap, nPara );
    1216          10 :             return;
    1217             :         }
    1218             :     }
    1219             : 
    1220           0 :     throw beans::UnknownPropertyException();
    1221             : }
    1222             : 
    1223           5 : void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara )
    1224             :     throw( beans::UnknownPropertyException, uno::RuntimeException )
    1225             : {
    1226             :     do
    1227             :     {
    1228           5 :         SfxItemSet aSet( *pForwarder->GetPool(), true );
    1229             : 
    1230           5 :         if( pMap->nWID == WID_FONTDESC )
    1231             :         {
    1232           0 :             SvxUnoFontDescriptor::setPropertyToDefault( aSet );
    1233             :         }
    1234           5 :         else if( pMap->nWID == WID_NUMLEVEL )
    1235             :         {
    1236             :             // #101004# Call interface method instead of unsafe cast
    1237           0 :             pForwarder->SetDepth( maSelection.nStartPara, -1 );
    1238           0 :             return;
    1239             :         }
    1240           5 :         else if( pMap->nWID == WID_NUMBERINGSTARTVALUE )
    1241             :         {
    1242           0 :             pForwarder->SetNumberingStartValue( maSelection.nStartPara, -1 );
    1243             :         }
    1244           5 :         else if( pMap->nWID == WID_PARAISNUMBERINGRESTART )
    1245             :         {
    1246           0 :             pForwarder->SetParaIsNumberingRestart( maSelection.nStartPara, false );
    1247             :         }
    1248             :         else
    1249             :         {
    1250           5 :             aSet.InvalidateItem( pMap->nWID );
    1251             :         }
    1252             : 
    1253           5 :         if(nPara != -1)
    1254           1 :             pForwarder->SetParaAttribs( nPara, aSet );
    1255             :         else
    1256           4 :             pForwarder->QuickSetAttribs( aSet, GetSelection() );
    1257             : 
    1258           5 :         GetEditSource()->UpdateData();
    1259             : 
    1260           5 :         return;
    1261             :     }
    1262             :     while(false);
    1263             : }
    1264             : 
    1265           5 : uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aPropertyName )
    1266             :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    1267             : {
    1268           5 :     SolarMutexGuard aGuard;
    1269             : 
    1270           5 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1271           5 :     if( pForwarder )
    1272             :     {
    1273           5 :         const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( aPropertyName );
    1274           5 :         if( pMap )
    1275             :         {
    1276           5 :             SfxItemPool* pPool = pForwarder->GetPool();
    1277             : 
    1278           5 :             switch( pMap->nWID )
    1279             :             {
    1280             :             case WID_FONTDESC:
    1281           0 :                 return SvxUnoFontDescriptor::getPropertyDefault( pPool );
    1282             : 
    1283             :             case WID_NUMLEVEL:
    1284             :                 {
    1285           0 :                     uno::Any aAny;
    1286           0 :                     return aAny;
    1287             :                 }
    1288             : 
    1289             :             case WID_NUMBERINGSTARTVALUE:
    1290           0 :                 return uno::Any( (sal_Int16)-1 );
    1291             : 
    1292             :             case WID_PARAISNUMBERINGRESTART:
    1293           0 :                 return uno::Any( false );
    1294             : 
    1295             :             default:
    1296             :                 {
    1297             :                     // Get Default from ItemPool
    1298           5 :                     if(SfxItemPool::IsWhich(pMap->nWID))
    1299             :                     {
    1300           5 :                         SfxItemSet aSet( *pPool,    pMap->nWID, pMap->nWID);
    1301           5 :                         aSet.Put(pPool->GetDefaultItem(pMap->nWID));
    1302           5 :                         return SvxItemPropertySet::getPropertyValue(pMap, aSet, true, false );
    1303             :                     }
    1304             :                 }
    1305             :             }
    1306             :         }
    1307             :     }
    1308           0 :     throw beans::UnknownPropertyException();
    1309             : }
    1310             : 
    1311             : // beans::XMultiPropertyStates
    1312           0 : void SAL_CALL SvxUnoTextRangeBase::setAllPropertiesToDefault()
    1313             :     throw (uno::RuntimeException, std::exception)
    1314             : {
    1315           0 :     SolarMutexGuard aGuard;
    1316             : 
    1317           0 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1318             : 
    1319           0 :     if( pForwarder )
    1320             :     {
    1321           0 :         PropertyEntryVector_t aEntries = mpPropSet->getPropertyMap().getPropertyEntries();
    1322           0 :         PropertyEntryVector_t::const_iterator aIt = aEntries.begin();
    1323           0 :         while( aIt != aEntries.end() )
    1324             :         {
    1325           0 :             _setPropertyToDefault( pForwarder, &(*aIt), -1 );
    1326           0 :             ++aIt;
    1327           0 :         }
    1328           0 :     }
    1329           0 : }
    1330             : 
    1331           0 : void SAL_CALL SvxUnoTextRangeBase::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    1332             : {
    1333           0 :     sal_Int32 nCount = aPropertyNames.getLength();
    1334           0 :     for( const OUString* pName = aPropertyNames.getConstArray(); nCount; pName++, nCount-- )
    1335             :     {
    1336           0 :         setPropertyToDefault( *pName );
    1337             :     }
    1338           0 : }
    1339             : 
    1340           0 : uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    1341             : {
    1342           0 :     sal_Int32 nCount = aPropertyNames.getLength();
    1343           0 :     uno::Sequence< uno::Any > ret( nCount );
    1344           0 :     uno::Any* pDefaults = ret.getArray();
    1345             : 
    1346           0 :     for( const OUString* pName = aPropertyNames.getConstArray(); nCount; pName++, nCount--, pDefaults++ )
    1347             :     {
    1348           0 :         *pDefaults = getPropertyDefault( *pName );
    1349             :     }
    1350             : 
    1351           0 :     return ret;
    1352             : }
    1353             : 
    1354             : // internal
    1355       33345 : void SvxUnoTextRangeBase::CollapseToStart() throw()
    1356             : {
    1357       33345 :     CheckSelection( maSelection, mpEditSource );
    1358             : 
    1359       33345 :     maSelection.nEndPara = maSelection.nStartPara;
    1360       33345 :     maSelection.nEndPos  = maSelection.nStartPos;
    1361       33345 : }
    1362             : 
    1363       16103 : void SvxUnoTextRangeBase::CollapseToEnd() throw()
    1364             : {
    1365       16103 :     CheckSelection( maSelection, mpEditSource );
    1366             : 
    1367       16103 :     maSelection.nStartPara = maSelection.nEndPara;
    1368       16103 :     maSelection.nStartPos  = maSelection.nEndPos;
    1369       16103 : }
    1370             : 
    1371         146 : bool SvxUnoTextRangeBase::IsCollapsed() throw()
    1372             : {
    1373         146 :     CheckSelection( maSelection, mpEditSource );
    1374             : 
    1375         292 :     return ( maSelection.nStartPara == maSelection.nEndPara &&
    1376         292 :              maSelection.nStartPos  == maSelection.nEndPos );
    1377             : }
    1378             : 
    1379        3047 : bool SvxUnoTextRangeBase::GoLeft(sal_Int16 nCount, bool Expand) throw()
    1380             : {
    1381        3047 :     CheckSelection( maSelection, mpEditSource );
    1382             : 
    1383             :     //  #75098# use end position, as in Writer (start is anchor, end is cursor)
    1384        3047 :     sal_uInt16 nNewPos = maSelection.nEndPos;
    1385        3047 :     sal_Int32  nNewPar = maSelection.nEndPara;
    1386             : 
    1387        3047 :     bool bOk = true;
    1388        3047 :     SvxTextForwarder* pForwarder = NULL;
    1389        9092 :     while ( nCount > nNewPos && bOk )
    1390             :     {
    1391        2998 :         if ( nNewPar == 0 )
    1392         580 :             bOk = false;
    1393             :         else
    1394             :         {
    1395        2418 :             if ( !pForwarder )
    1396        2418 :                 pForwarder = mpEditSource->GetTextForwarder();  // first here, it is necessary...
    1397             : 
    1398        2418 :             --nNewPar;
    1399        2418 :             nCount -= nNewPos + 1;
    1400        2418 :             nNewPos = pForwarder->GetTextLen( nNewPar );
    1401             :         }
    1402             :     }
    1403             : 
    1404        3047 :     if ( bOk )
    1405             :     {
    1406        2467 :         nNewPos = nNewPos - nCount;
    1407        2467 :         maSelection.nStartPara = nNewPar;
    1408        2467 :         maSelection.nStartPos  = nNewPos;
    1409             :     }
    1410             : 
    1411        3047 :     if (!Expand)
    1412           5 :         CollapseToStart();
    1413             : 
    1414        3047 :     return bOk;
    1415             : }
    1416             : 
    1417       29886 : bool SvxUnoTextRangeBase::GoRight(sal_Int16 nCount, bool Expand)  throw()
    1418             : {
    1419       29886 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1420       29886 :     if( pForwarder )
    1421             :     {
    1422       29886 :         CheckSelection( maSelection, pForwarder );
    1423             : 
    1424       29886 :         sal_Int32 nNewPos = maSelection.nEndPos + nCount; //! Overflow???
    1425       29886 :         sal_Int32  nNewPar = maSelection.nEndPara;
    1426             : 
    1427       29886 :         bool bOk = true;
    1428       29886 :         sal_Int32 nParCount = pForwarder->GetParagraphCount();
    1429       29886 :         sal_Int32 nThisLen = pForwarder->GetTextLen( nNewPar );
    1430       63589 :         while ( nNewPos > nThisLen && bOk )
    1431             :         {
    1432        3817 :             if ( nNewPar + 1 >= nParCount )
    1433           3 :                 bOk = false;
    1434             :             else
    1435             :             {
    1436        3814 :                 nNewPos -= nThisLen+1;
    1437        3814 :                 ++nNewPar;
    1438        3814 :                 nThisLen = pForwarder->GetTextLen( nNewPar );
    1439             :             }
    1440             :         }
    1441             : 
    1442       29886 :         if (bOk)
    1443             :         {
    1444       29883 :             maSelection.nEndPara = nNewPar;
    1445       29883 :             maSelection.nEndPos  = nNewPos;
    1446             :         }
    1447             : 
    1448       29886 :         if (!Expand)
    1449           5 :             CollapseToEnd();
    1450             : 
    1451       29886 :         return bOk;
    1452             :     }
    1453           0 :     return false;
    1454             : }
    1455             : 
    1456         104 : void SvxUnoTextRangeBase::GotoStart(bool Expand) throw()
    1457             : {
    1458         104 :     maSelection.nStartPara = 0;
    1459         104 :     maSelection.nStartPos  = 0;
    1460             : 
    1461         104 :     if (!Expand)
    1462          27 :         CollapseToStart();
    1463         104 : }
    1464             : 
    1465        6289 : void SvxUnoTextRangeBase::GotoEnd(bool Expand) throw()
    1466             : {
    1467        6289 :     CheckSelection( maSelection, mpEditSource );
    1468             : 
    1469        6289 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1470        6289 :     if( pForwarder )
    1471             :     {
    1472             : 
    1473        6289 :         sal_Int32 nPar = pForwarder->GetParagraphCount();
    1474        6289 :         if (nPar)
    1475        6289 :             --nPar;
    1476             : 
    1477        6289 :         maSelection.nEndPara = nPar;
    1478        6289 :         maSelection.nEndPos  = pForwarder->GetTextLen( nPar );
    1479             : 
    1480        6289 :         if (!Expand)
    1481        3353 :             CollapseToEnd();
    1482             :     }
    1483        6289 : }
    1484             : 
    1485             : // lang::XServiceInfo
    1486        1508 : sal_Bool SAL_CALL SvxUnoTextRangeBase::supportsService( const OUString& ServiceName )
    1487             :     throw(uno::RuntimeException, std::exception)
    1488             : {
    1489        1508 :     return cppu::supportsService( this, ServiceName );
    1490             : }
    1491             : 
    1492        1523 : uno::Sequence< OUString > SAL_CALL SvxUnoTextRangeBase::getSupportedServiceNames()
    1493             :     throw(uno::RuntimeException, std::exception)
    1494             : {
    1495        1523 :     return getSupportedServiceNames_Static();
    1496             : }
    1497             : 
    1498        1577 : uno::Sequence< OUString > SAL_CALL SvxUnoTextRangeBase::getSupportedServiceNames_Static()
    1499             : {
    1500        1577 :     uno::Sequence< OUString > aSeq(3);
    1501        1577 :     aSeq[0] = "com.sun.star.style.CharacterProperties";
    1502        1577 :     aSeq[1] = "com.sun.star.style.CharacterPropertiesComplex";
    1503        1577 :     aSeq[2] = "com.sun.star.style.CharacterPropertiesAsian";
    1504        1577 :     return aSeq;
    1505             : }
    1506             : 
    1507             : // XTextRangeCompare
    1508           0 : sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionStarts( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 ) throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
    1509             : {
    1510           0 :     SvxUnoTextRangeBase* pR1 = SvxUnoTextRangeBase::getImplementation( xR1 );
    1511           0 :     SvxUnoTextRangeBase* pR2 = SvxUnoTextRangeBase::getImplementation( xR2 );
    1512             : 
    1513           0 :     if( (pR1 == 0) || (pR2 == 0) )
    1514           0 :         throw lang::IllegalArgumentException();
    1515             : 
    1516           0 :     const ESelection& r1 = pR1->maSelection;
    1517           0 :     const ESelection& r2 = pR2->maSelection;
    1518             : 
    1519           0 :     if( r1.nStartPara == r2.nStartPara )
    1520             :     {
    1521           0 :         if( r1.nStartPos == r2.nStartPos )
    1522           0 :             return 0;
    1523             :         else
    1524           0 :             return r1.nStartPos < r2.nStartPos ? 1 : -1;
    1525             :     }
    1526             :     else
    1527             :     {
    1528           0 :         return r1.nStartPara < r2.nStartPara ? 1 : -1;
    1529             :     }
    1530             : }
    1531             : 
    1532           0 : sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionEnds( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 ) throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
    1533             : {
    1534           0 :     SvxUnoTextRangeBase* pR1 = SvxUnoTextRangeBase::getImplementation( xR1 );
    1535           0 :     SvxUnoTextRangeBase* pR2 = SvxUnoTextRangeBase::getImplementation( xR2 );
    1536             : 
    1537           0 :     if( (pR1 == 0) || (pR2 == 0) )
    1538           0 :         throw lang::IllegalArgumentException();
    1539             : 
    1540           0 :     const ESelection& r1 = pR1->maSelection;
    1541           0 :     const ESelection& r2 = pR2->maSelection;
    1542             : 
    1543           0 :     if( r1.nEndPara == r2.nEndPara )
    1544             :     {
    1545           0 :         if( r1.nEndPos == r2.nEndPos )
    1546           0 :             return 0;
    1547             :         else
    1548           0 :             return r1.nEndPos < r2.nEndPos ? 1 : -1;
    1549             :     }
    1550             :     else
    1551             :     {
    1552           0 :         return r1.nEndPara < r2.nEndPara ? 1 : -1;
    1553             :     }
    1554             : }
    1555             : 
    1556       11663 : SvxUnoTextRange::SvxUnoTextRange( const SvxUnoTextBase& rParent, bool bPortion /* = false */ ) throw()
    1557       19839 : :SvxUnoTextRangeBase( rParent.GetEditSource(), bPortion ? ImplGetSvxTextPortionSvxPropertySet() : rParent.getPropertySet() ),
    1558       31502 :  mbPortion( bPortion )
    1559             : {
    1560       11663 :     xParentText =  static_cast<text::XText*>(const_cast<SvxUnoTextBase *>(&rParent));
    1561       11663 : }
    1562             : 
    1563       23326 : SvxUnoTextRange::~SvxUnoTextRange() throw()
    1564             : {
    1565       23326 : }
    1566             : 
    1567       25370 : uno::Any SAL_CALL SvxUnoTextRange::queryAggregation( const uno::Type & rType )
    1568             :     throw(uno::RuntimeException, std::exception)
    1569             : {
    1570       25370 :     QUERYINT( text::XTextRange );
    1571       23052 :     else if( rType == cppu::UnoType<beans::XMultiPropertyStates>::get())
    1572           0 :         return uno::makeAny(uno::Reference< beans::XMultiPropertyStates >(this));
    1573       23052 :     else if( rType == cppu::UnoType<beans::XPropertySet>::get())
    1574        8050 :         return uno::makeAny(uno::Reference< beans::XPropertySet >(this));
    1575       15002 :     else QUERYINT( beans::XPropertyState );
    1576       12256 :     else QUERYINT( text::XTextRangeCompare );
    1577       12256 :     else if( rType == cppu::UnoType<beans::XMultiPropertySet>::get())
    1578        2280 :         return uno::makeAny(uno::Reference< beans::XMultiPropertySet >(this));
    1579        9976 :     else QUERYINT( lang::XServiceInfo );
    1580        9973 :     else QUERYINT( lang::XTypeProvider );
    1581        9973 :     else QUERYINT( lang::XUnoTunnel );
    1582             :     else
    1583        2303 :         return OWeakAggObject::queryAggregation( rType );
    1584             : }
    1585             : 
    1586       25370 : uno::Any SAL_CALL SvxUnoTextRange::queryInterface( const uno::Type & rType )
    1587             :     throw(uno::RuntimeException, std::exception)
    1588             : {
    1589       25370 :     return OWeakAggObject::queryInterface(rType);
    1590             : }
    1591             : 
    1592       79770 : void SAL_CALL SvxUnoTextRange::acquire()
    1593             :     throw( )
    1594             : {
    1595       79770 :     OWeakAggObject::acquire();
    1596       79770 : }
    1597             : 
    1598       79770 : void SAL_CALL SvxUnoTextRange::release()
    1599             :     throw( )
    1600             : {
    1601       79770 :     OWeakAggObject::release();
    1602       79770 : }
    1603             : 
    1604             : // XTypeProvider
    1605             : 
    1606             : namespace
    1607             : {
    1608             :     struct theSvxUnoTextRangeTypes :
    1609             :         public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextRangeTypes>
    1610             :     {
    1611           0 :         uno::Sequence<uno::Type> operator () ()
    1612             :         {
    1613           0 :             uno::Sequence< uno::Type > aTypeSequence;
    1614             : 
    1615           0 :             aTypeSequence.realloc( 9 ); // !DANGER! keep this updated
    1616           0 :             uno::Type* pTypes = aTypeSequence.getArray();
    1617             : 
    1618           0 :             *pTypes++ = cppu::UnoType<text::XTextRange>::get();
    1619           0 :             *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
    1620           0 :             *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
    1621           0 :             *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
    1622           0 :             *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
    1623           0 :             *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
    1624           0 :             *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
    1625           0 :             *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
    1626           0 :             *pTypes++ = cppu::UnoType<text::XTextRangeCompare>::get();
    1627             : 
    1628           0 :             return aTypeSequence;
    1629             :         }
    1630             :     };
    1631             : }
    1632             : 
    1633           0 : uno::Sequence< uno::Type > SAL_CALL SvxUnoTextRange::getTypes()
    1634             :     throw (uno::RuntimeException, std::exception)
    1635             : {
    1636           0 :     return theSvxUnoTextRangeTypes::get();
    1637             : }
    1638             : 
    1639           0 : uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextRange::getImplementationId()
    1640             :     throw (uno::RuntimeException, std::exception)
    1641             : {
    1642           0 :     return css::uno::Sequence<sal_Int8>();
    1643             : }
    1644             : 
    1645             : // XTextRange
    1646           2 : uno::Reference< text::XText > SAL_CALL SvxUnoTextRange::getText()
    1647             :     throw(uno::RuntimeException, std::exception)
    1648             : {
    1649           2 :     return xParentText;
    1650             : }
    1651             : 
    1652             : // lang::XServiceInfo
    1653           0 : OUString SAL_CALL SvxUnoTextRange::getImplementationName()
    1654             :     throw(uno::RuntimeException, std::exception)
    1655             : {
    1656           0 :     return OUString("SvxUnoTextRange");
    1657             : }
    1658             : 
    1659             : 
    1660             : // class SvxUnoText
    1661             : 
    1662             : 
    1663      105153 : SvxUnoTextBase::SvxUnoTextBase( const SvxItemPropertySet* _pSet  ) throw()
    1664      105153 : : SvxUnoTextRangeBase( _pSet )
    1665             : {
    1666      105153 : }
    1667             : 
    1668        2158 : SvxUnoTextBase::SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, uno::Reference < text::XText > xParent ) throw()
    1669        2158 : : SvxUnoTextRangeBase( pSource, _pSet )
    1670             : {
    1671        2158 :     xParentText = xParent;
    1672        2158 :     ESelection aSelection;
    1673        2158 :     ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
    1674        2158 :     SetSelection( aSelection );
    1675        2158 : }
    1676             : 
    1677           0 : SvxUnoTextBase::SvxUnoTextBase( const SvxUnoTextBase& rText ) throw()
    1678             : :   SvxUnoTextRangeBase( rText )
    1679             : , text::XTextAppend()
    1680             : ,   text::XTextCopy()
    1681             : ,   container::XEnumerationAccess()
    1682             : ,   text::XTextRangeMover()
    1683           0 : ,   lang::XTypeProvider()
    1684             : {
    1685           0 :     xParentText = rText.xParentText;
    1686           0 : }
    1687             : 
    1688      105094 : SvxUnoTextBase::~SvxUnoTextBase() throw()
    1689             : {
    1690      105094 : }
    1691             : 
    1692             : // XInterface
    1693       87824 : uno::Any SAL_CALL SvxUnoTextBase::queryAggregation( const uno::Type & rType )
    1694             :     throw(uno::RuntimeException, std::exception)
    1695             : {
    1696       87824 :     QUERYINT( text::XText );
    1697       81409 :     QUERYINT( text::XSimpleText );
    1698       80588 :     if( rType == cppu::UnoType<text::XTextRange>::get())
    1699       21492 :         return uno::makeAny(uno::Reference< text::XTextRange >(static_cast<text::XText*>(this)));
    1700       59096 :     QUERYINT(container::XEnumerationAccess );
    1701       57385 :     QUERYINT( container::XElementAccess );
    1702       57384 :     QUERYINT( beans::XMultiPropertyStates );
    1703       57384 :     QUERYINT( beans::XPropertySet );
    1704       55078 :     QUERYINT( beans::XMultiPropertySet );
    1705       54388 :     QUERYINT( beans::XPropertyState );
    1706       54279 :     QUERYINT( text::XTextRangeCompare );
    1707       54279 :     QUERYINT( lang::XServiceInfo );
    1708       54225 :     QUERYINT( text::XTextRangeMover );
    1709       54225 :     QUERYINT( text::XTextCopy );
    1710       54225 :     QUERYINT( text::XTextAppend );
    1711       53295 :     QUERYINT( text::XParagraphAppend );
    1712       53295 :     QUERYINT( text::XTextPortionAppend );
    1713       53295 :     QUERYINT( lang::XTypeProvider );
    1714       53295 :     QUERYINT( lang::XUnoTunnel );
    1715             : 
    1716       52829 :     return uno::Any();
    1717             : }
    1718             : 
    1719             : // XTypeProvider
    1720             : 
    1721             : namespace
    1722             : {
    1723             :     struct theSvxUnoTextBaseTypes :
    1724             :         public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextBaseTypes>
    1725             :     {
    1726           0 :         uno::Sequence<uno::Type> operator () ()
    1727             :         {
    1728           0 :             uno::Sequence< uno::Type > aTypeSequence;
    1729             : 
    1730           0 :             aTypeSequence.realloc( 15 ); // !DANGER! keep this updated
    1731           0 :             uno::Type* pTypes = aTypeSequence.getArray();
    1732             : 
    1733           0 :             *pTypes++ = cppu::UnoType<text::XText>::get();
    1734           0 :             *pTypes++ = cppu::UnoType<container::XEnumerationAccess>::get();
    1735           0 :             *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
    1736           0 :             *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
    1737           0 :             *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
    1738           0 :             *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
    1739           0 :             *pTypes++ = cppu::UnoType<text::XTextRangeMover>::get();
    1740           0 :             *pTypes++ = cppu::UnoType<text::XTextAppend>::get();
    1741           0 :             *pTypes++ = cppu::UnoType<text::XTextCopy>::get();
    1742           0 :             *pTypes++ = cppu::UnoType<text::XParagraphAppend>::get();
    1743           0 :             *pTypes++ = cppu::UnoType<text::XTextPortionAppend>::get();
    1744           0 :             *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
    1745           0 :             *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
    1746           0 :             *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
    1747           0 :             *pTypes++ = cppu::UnoType<text::XTextRangeCompare>::get();
    1748             : 
    1749           0 :             return aTypeSequence;
    1750             :         }
    1751             :     };
    1752             : }
    1753           0 : uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getStaticTypes() throw()
    1754             : {
    1755           0 :     return theSvxUnoTextBaseTypes::get();
    1756             : }
    1757             : 
    1758           0 : uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getTypes()
    1759             :     throw (uno::RuntimeException, std::exception)
    1760             : {
    1761           0 :     return getStaticTypes();
    1762             : }
    1763             : 
    1764           0 : uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextBase::getImplementationId()
    1765             :     throw (uno::RuntimeException, std::exception)
    1766             : {
    1767           0 :     return css::uno::Sequence<sal_Int8>();
    1768             : }
    1769             : 
    1770        3658 : uno::Reference< text::XTextCursor > SvxUnoTextBase::createTextCursorBySelection( const ESelection& rSel )
    1771             : {
    1772        3658 :     SvxUnoTextCursor* pCursor = new SvxUnoTextCursor( *this );
    1773        3658 :     uno::Reference< text::XTextCursor >  xCursor( pCursor );
    1774        3658 :     pCursor->SetSelection( rSel );
    1775        3658 :     return xCursor;
    1776             : }
    1777             : 
    1778             : // XSimpleText
    1779             : 
    1780        4070 : uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursor()
    1781             :     throw(uno::RuntimeException, std::exception)
    1782             : {
    1783        4070 :     SolarMutexGuard aGuard;
    1784        4070 :     return new SvxUnoTextCursor( *this );
    1785             : }
    1786             : 
    1787        3658 : uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursorByRange( const uno::Reference< text::XTextRange >& aTextPosition )
    1788             :     throw(uno::RuntimeException, std::exception)
    1789             : {
    1790        3658 :     SolarMutexGuard aGuard;
    1791             : 
    1792        3658 :     uno::Reference< text::XTextCursor >  xCursor;
    1793             : 
    1794        3658 :     if( aTextPosition.is() )
    1795             :     {
    1796        3658 :         SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( aTextPosition );
    1797        3658 :         if(pRange)
    1798        3658 :             xCursor = createTextCursorBySelection( pRange->GetSelection() );
    1799             :     }
    1800             : 
    1801        3658 :     return xCursor;
    1802             : }
    1803             : 
    1804        6825 : void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb )
    1805             :     throw(uno::RuntimeException, std::exception)
    1806             : {
    1807        6825 :     SolarMutexGuard aGuard;
    1808             : 
    1809        6825 :     if( !xRange.is() )
    1810        6825 :         return;
    1811             : 
    1812        6825 :     ESelection aSelection;
    1813        6825 :     if (GetEditSource())
    1814             :     {
    1815        6825 :         ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
    1816        6825 :         SetSelection( aSelection );
    1817             :     }
    1818             : 
    1819        6825 :     SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
    1820        6825 :     if(pRange)
    1821             :     {
    1822             :         // setString on SvxUnoTextRangeBase instead of itself QuickInsertText
    1823             :         // and UpdateData, so that the selection will be adjusted to
    1824             :         // SvxUnoTextRangeBase. Actually all cursor objects of this Text must
    1825             :         // to be statement to be adapted!
    1826             : 
    1827        6825 :         if (!bAbsorb)                   // do not replace -> append on tail
    1828        5917 :             pRange->CollapseToEnd();
    1829             : 
    1830        6825 :         pRange->setString( aString );
    1831             : 
    1832        6825 :         pRange->CollapseToEnd();
    1833        6825 :     }
    1834             : }
    1835             : 
    1836        3459 : void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb )
    1837             :     throw(lang::IllegalArgumentException, uno::RuntimeException, std::exception)
    1838             : {
    1839        3459 :     SolarMutexGuard aGuard;
    1840             : 
    1841        3459 :     SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
    1842             : 
    1843        3459 :     if( pForwarder )
    1844             :     {
    1845        3459 :         ESelection aSelection;
    1846        3459 :         ::GetSelection( aSelection, pForwarder );
    1847        3459 :         SetSelection( aSelection );
    1848             : 
    1849        3459 :         switch( nControlCharacter )
    1850             :         {
    1851             :         case text::ControlCharacter::PARAGRAPH_BREAK:
    1852             :         {
    1853          54 :             const OUString aText( (sal_Unicode)13 );  // '\r' does not work on Mac
    1854          54 :             insertString( xRange, aText, bAbsorb );
    1855             : 
    1856          54 :             return;
    1857             :         }
    1858             :         case text::ControlCharacter::LINE_BREAK:
    1859             :         {
    1860          43 :             SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
    1861          43 :             if(pRange)
    1862             :             {
    1863          43 :                 ESelection aRange = pRange->GetSelection();
    1864             : 
    1865          43 :                 if( bAbsorb )
    1866             :                 {
    1867           0 :                     const OUString aEmpty;
    1868           0 :                     pForwarder->QuickInsertText( aEmpty, aRange );
    1869             : 
    1870           0 :                     aRange.nEndPos = aRange.nStartPos;
    1871           0 :                     aRange.nEndPara = aRange.nStartPara;
    1872             :                 }
    1873             :                 else
    1874             :                 {
    1875          43 :                     aRange.nStartPara = aRange.nEndPara;
    1876          43 :                     aRange.nStartPos = aRange.nEndPos;
    1877             :                 }
    1878             : 
    1879          43 :                 pForwarder->QuickInsertLineBreak( aRange );
    1880          43 :                 GetEditSource()->UpdateData();
    1881             : 
    1882          43 :                 aRange.nEndPos += 1;
    1883          43 :                 if( !bAbsorb )
    1884          43 :                     aRange.nStartPos += 1;
    1885             : 
    1886          43 :                 pRange->SetSelection( aRange );
    1887             :             }
    1888          43 :             return;
    1889             :         }
    1890             :         case text::ControlCharacter::APPEND_PARAGRAPH:
    1891             :         {
    1892        3362 :             SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
    1893        3362 :             if(pRange)
    1894             :             {
    1895        3362 :                 ESelection aRange = pRange->GetSelection();
    1896             : //              ESelection aOldSelection = aRange;
    1897             : 
    1898        3362 :                 aRange.nStartPos  = pForwarder->GetTextLen( aRange.nStartPara );
    1899             : 
    1900        3362 :                 aRange.nEndPara = aRange.nStartPara;
    1901        3362 :                 aRange.nEndPos  = aRange.nStartPos;
    1902             : 
    1903        3362 :                 pRange->SetSelection( aRange );
    1904        3362 :                 const OUString aText( (sal_Unicode)13 );  // '\r' geht auf'm Mac nicht
    1905        3362 :                 pRange->setString( aText );
    1906             : 
    1907        3362 :                 aRange.nStartPos = 0;
    1908        3362 :                 aRange.nStartPara += 1;
    1909        3362 :                 aRange.nEndPos = 0;
    1910        3362 :                 aRange.nEndPara += 1;
    1911             : 
    1912        3362 :                 pRange->SetSelection( aRange );
    1913             : 
    1914        3362 :                 return;
    1915             :             }
    1916             :         }
    1917             :         default:
    1918           0 :             throw lang::IllegalArgumentException();
    1919             :         }
    1920           0 :     }
    1921             : }
    1922             : 
    1923             : // XText
    1924         554 : void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTextRange >& xRange, const uno::Reference< text::XTextContent >& xContent, sal_Bool bAbsorb )
    1925             :     throw(lang::IllegalArgumentException, uno::RuntimeException, std::exception)
    1926             : {
    1927         554 :     SolarMutexGuard aGuard;
    1928             : 
    1929         554 :     SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
    1930         554 :     if (!pForwarder)
    1931         548 :         return;
    1932             : 
    1933        1108 :     uno::Reference<beans::XPropertySet> xPropSet(xRange, uno::UNO_QUERY);
    1934         554 :     if (!xPropSet.is())
    1935           1 :         throw lang::IllegalArgumentException();
    1936             : 
    1937        1106 :     uno::Any aAny = xPropSet->getPropertyValue(UNO_TR_PROP_SELECTION);
    1938         553 :     text::TextRangeSelection aSel = aAny.get<text::TextRangeSelection>();
    1939         553 :     if (!bAbsorb)
    1940         553 :         aSel.Start = aSel.End;
    1941             : 
    1942        1106 :     boost::scoped_ptr<SvxFieldData> pFieldData(SvxFieldData::Create(xContent));
    1943         553 :     if (!pFieldData)
    1944           5 :         throw lang::IllegalArgumentException();
    1945             : 
    1946        1096 :     SvxFieldItem aField( *pFieldData, EE_FEATURE_FIELD );
    1947         548 :     pForwarder->QuickInsertField(aField, toESelection(aSel));
    1948         548 :     GetEditSource()->UpdateData();
    1949             : 
    1950        1096 :     uno::Reference<beans::XPropertySet> xPropSetContent(xContent, uno::UNO_QUERY);
    1951         548 :     if (!xContent.is())
    1952           0 :         throw lang::IllegalArgumentException();
    1953             : 
    1954         548 :     xPropSetContent->setPropertyValue(UNO_TC_PROP_ANCHOR, uno::makeAny(xRange));
    1955             : 
    1956         548 :     aSel.End.PositionInParagraph += 1;
    1957         548 :     aSel.Start.PositionInParagraph = aSel.End.PositionInParagraph;
    1958        1102 :     xPropSet->setPropertyValue(UNO_TR_PROP_SELECTION, uno::makeAny(aSel));
    1959             : }
    1960             : 
    1961           3 : void SAL_CALL SvxUnoTextBase::removeTextContent( const uno::Reference< text::XTextContent >& ) throw(container::NoSuchElementException, uno::RuntimeException, std::exception)
    1962             : {
    1963           3 : }
    1964             : 
    1965             : // XTextRange
    1966             : 
    1967          81 : uno::Reference< text::XText > SAL_CALL SvxUnoTextBase::getText()
    1968             :     throw(uno::RuntimeException, std::exception)
    1969             : {
    1970          81 :     SolarMutexGuard aGuard;
    1971             : 
    1972          81 :     if (GetEditSource())
    1973             :     {
    1974          81 :         ESelection aSelection;
    1975          81 :         ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
    1976          81 :         SetSelection( aSelection );
    1977             :     }
    1978             : 
    1979          81 :     return static_cast<text::XText*>(this);
    1980             : }
    1981             : 
    1982           5 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::getStart()
    1983             :     throw(uno::RuntimeException, std::exception)
    1984             : {
    1985           5 :     return SvxUnoTextRangeBase::getStart();
    1986             : }
    1987             : 
    1988          40 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::getEnd()
    1989             :     throw(uno::RuntimeException, std::exception)
    1990             : {
    1991          40 :     return SvxUnoTextRangeBase::getEnd();
    1992             : }
    1993             : 
    1994        1949 : OUString SAL_CALL SvxUnoTextBase::getString() throw( uno::RuntimeException, std::exception )
    1995             : {
    1996        1949 :     return SvxUnoTextRangeBase::getString();
    1997             : }
    1998             : 
    1999       21508 : void SAL_CALL SvxUnoTextBase::setString( const OUString& aString ) throw(uno::RuntimeException, std::exception)
    2000             : {
    2001       21508 :     SvxUnoTextRangeBase::setString(aString);
    2002       21508 : }
    2003             : 
    2004             : 
    2005             : // XEnumerationAccess
    2006        2342 : uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextBase::createEnumeration()
    2007             :     throw(uno::RuntimeException, std::exception)
    2008             : {
    2009        2342 :     SolarMutexGuard aGuard;
    2010             : 
    2011        2342 :     ESelection aSelection;
    2012        2342 :     ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
    2013        2342 :     SetSelection( aSelection );
    2014             : 
    2015        2342 :     uno::Reference< container::XEnumeration > xEnum( static_cast<container::XEnumeration*>(new SvxUnoTextContentEnumeration( *this )) );
    2016        2342 :     return xEnum;
    2017             : }
    2018             : 
    2019             : // XElementAccess ( container::XEnumerationAccess )
    2020           3 : uno::Type SAL_CALL SvxUnoTextBase::getElementType(  ) throw(uno::RuntimeException, std::exception)
    2021             : {
    2022           3 :     return cppu::UnoType<text::XTextRange>::get();
    2023             : }
    2024             : 
    2025         119 : sal_Bool SAL_CALL SvxUnoTextBase::hasElements(  ) throw(uno::RuntimeException, std::exception)
    2026             : {
    2027         119 :     SolarMutexGuard aGuard;
    2028             : 
    2029         119 :     if(GetEditSource())
    2030             :     {
    2031         119 :         SvxTextForwarder* pForwarder = GetEditSource()->GetTextForwarder();
    2032         119 :         if(pForwarder)
    2033         119 :             return pForwarder->GetParagraphCount() != 0;
    2034             :     }
    2035             : 
    2036           0 :     return sal_False;
    2037             : }
    2038             : 
    2039             : // text::XTextRangeMover
    2040           0 : void SAL_CALL SvxUnoTextBase::moveTextRange( const uno::Reference< text::XTextRange >&, sal_Int16 )
    2041             :     throw(uno::RuntimeException, std::exception)
    2042             : {
    2043           0 : }
    2044             : 
    2045         621 : void SvxPropertyValuesToItemSet(
    2046             :         SfxItemSet &rItemSet,
    2047             :         const uno::Sequence< beans::PropertyValue >& rPropertyVaules,
    2048             :         const SfxItemPropertySet *pPropSet,
    2049             :         SvxTextForwarder *pForwarder /*needed for WID_NUMLEVEL*/,
    2050             :         sal_Int32 nPara /*needed for WID_NUMLEVEL*/)
    2051             :     throw(lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
    2052             : {
    2053         621 :     sal_Int32 nProps = rPropertyVaules.getLength();
    2054         621 :     const beans::PropertyValue *pProps = rPropertyVaules.getConstArray();
    2055        1629 :     for (sal_Int32 i = 0;  i < nProps;  ++i)
    2056             :     {
    2057        1161 :         const SfxItemPropertySimpleEntry *pEntry = pPropSet->getPropertyMap().getByName( pProps[i].Name );
    2058        1161 :         if (pEntry)
    2059             :         {
    2060             :             // Note: there is no need to take special care of the properties
    2061             :             //      TextField (EE_FEATURE_FIELD) and
    2062             :             //      TextPortionType (WID_PORTIONTYPE)
    2063             :             //  since they are read-only and thus are already taken care of below.
    2064             : 
    2065        1008 :             if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
    2066             :                 // should be PropertyVetoException which is not yet defined for the new import API's functions
    2067           0 :                 throw uno::RuntimeException("Property is read-only: " + pProps[i].Name, static_cast < cppu::OWeakObject * > ( 0 ) );
    2068             :                 //throw PropertyVetoException ("Property is read-only: " + pProps[i].Name, static_cast < cppu::OWeakObject * > ( 0 ) );
    2069             : 
    2070        1008 :             if (pEntry->nWID == WID_FONTDESC)
    2071             :             {
    2072           0 :                 awt::FontDescriptor aDesc;
    2073           0 :                 if (pProps[i].Value >>= aDesc)
    2074           0 :                     SvxUnoFontDescriptor::FillItemSet( aDesc, rItemSet );
    2075             :             }
    2076        1008 :             else if (pEntry->nWID == WID_NUMLEVEL)
    2077             :             {
    2078           0 :                 if (pForwarder)
    2079             :                 {
    2080           0 :                     sal_Int16 nLevel = -1;
    2081           0 :                     pProps[i].Value >>= nLevel;
    2082             : 
    2083             :                     // #101004# Call interface method instead of unsafe cast
    2084           0 :                     if (!pForwarder->SetDepth( nPara, nLevel ))
    2085           0 :                         throw lang::IllegalArgumentException();
    2086             :                 }
    2087             :             }
    2088        1008 :             else if (pEntry->nWID == WID_NUMBERINGSTARTVALUE )
    2089             :             {
    2090           0 :                 if( pForwarder )
    2091             :                 {
    2092           0 :                     sal_Int16 nStartValue = -1;
    2093           0 :                     if( !(pProps[i].Value >>= nStartValue) )
    2094           0 :                         throw lang::IllegalArgumentException();
    2095             : 
    2096           0 :                     pForwarder->SetNumberingStartValue( nPara, nStartValue );
    2097             :                 }
    2098             :             }
    2099        1008 :             else if (pEntry->nWID == WID_PARAISNUMBERINGRESTART )
    2100             :             {
    2101           0 :                 if( pForwarder )
    2102             :                 {
    2103           0 :                     bool bParaIsNumberingRestart = false;
    2104           0 :                     if( !(pProps[i].Value >>= bParaIsNumberingRestart) )
    2105           0 :                         throw lang::IllegalArgumentException();
    2106             : 
    2107           0 :                     pForwarder->SetParaIsNumberingRestart( nPara, bParaIsNumberingRestart );
    2108             :                 }
    2109             :             }
    2110             :             else
    2111        1008 :                 pPropSet->setPropertyValue( pProps[i].Name, pProps[i].Value, rItemSet );
    2112             :         }
    2113             :         else
    2114         153 :             throw beans::UnknownPropertyException( "Unknown property: " + pProps[i].Name, static_cast < cppu::OWeakObject * > ( 0 ) );
    2115             :     }
    2116         468 : }
    2117             : 
    2118           0 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraphInsert(
    2119             :         const uno::Sequence< beans::PropertyValue >& /*rCharAndParaProps*/,
    2120             :         const uno::Reference< text::XTextRange >& /*rTextRange*/ )
    2121             :     throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    2122             : {
    2123           0 :     uno::Reference< text::XTextRange > xRet;
    2124           0 :     return xRet;
    2125             : }
    2126             : 
    2127         153 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph(
    2128             :         const uno::Sequence< beans::PropertyValue >& rCharAndParaProps )
    2129             :     throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    2130             : {
    2131         153 :     SolarMutexGuard aGuard;
    2132             : 
    2133         153 :     uno::Reference< text::XTextRange > xRet;
    2134         153 :     SvxEditSource *pEditSource = GetEditSource();
    2135         153 :     SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
    2136         153 :     if (pTextForwarder)
    2137             :     {
    2138         153 :         sal_Int32 nParaCount = pTextForwarder->GetParagraphCount();
    2139             :         DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
    2140         153 :         pTextForwarder->AppendParagraph();
    2141             : 
    2142             :         // set properties for the previously last paragraph
    2143         153 :         sal_Int32 nPara = nParaCount - 1;
    2144         153 :         ESelection aSel( nPara, 0, nPara, 0 );
    2145         153 :         SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
    2146             :         SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
    2147         153 :                 ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(), pTextForwarder, nPara );
    2148           0 :         pTextForwarder->QuickSetAttribs( aItemSet, aSel );
    2149           0 :         pEditSource->UpdateData();
    2150           0 :         SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
    2151           0 :         xRet = pRange;
    2152         153 :         pRange->SetSelection( aSel );
    2153             :     }
    2154         153 :     return xRet;
    2155             : }
    2156             : 
    2157           0 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::insertTextPortion(
    2158             :         const OUString& /*rText*/,
    2159             :         const uno::Sequence< beans::PropertyValue >& /*rCharAndParaProps*/,
    2160             :         const uno::Reference< text::XTextRange>& /*rTextRange*/ )
    2161             :     throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    2162             : {
    2163           0 :     uno::Reference< text::XTextRange > xRet;
    2164           0 :     return xRet;
    2165             : }
    2166             : 
    2167             : // com::sun::star::text::XTextPortionAppend (new import API)
    2168         468 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion(
    2169             :         const OUString& rText,
    2170             :         const uno::Sequence< beans::PropertyValue >& rCharAndParaProps )
    2171             :     throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    2172             : {
    2173         468 :     SolarMutexGuard aGuard;
    2174             : 
    2175         468 :     SvxEditSource *pEditSource = GetEditSource();
    2176         468 :     SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
    2177         468 :     uno::Reference< text::XTextRange > xRet;
    2178         468 :     if (pTextForwarder)
    2179             :     {
    2180         468 :         sal_Int32 nParaCount = pTextForwarder->GetParagraphCount();
    2181             :         DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
    2182         468 :         sal_Int32 nPara = nParaCount - 1;
    2183         468 :         SfxItemSet aSet( pTextForwarder->GetParaAttribs( nPara ) );
    2184         468 :         sal_Int32 nStart = pTextForwarder->AppendTextPortion( nPara, rText, aSet );
    2185         468 :         pEditSource->UpdateData();
    2186         468 :         sal_Int32 nEnd   = pTextForwarder->GetTextLen( nPara );
    2187             : 
    2188             :         // set properties for the new text portion
    2189         468 :         ESelection aSel( nPara, nStart, nPara, nEnd );
    2190         468 :         pTextForwarder->RemoveAttribs( aSel, false, 0 );
    2191         468 :         pEditSource->UpdateData();
    2192             : 
    2193         936 :         SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
    2194             :         SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
    2195         468 :                 ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, nPara );
    2196         468 :         pTextForwarder->QuickSetAttribs( aItemSet, aSel );
    2197         468 :         SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
    2198         468 :         xRet = pRange;
    2199         468 :         pRange->SetSelection( aSel );
    2200         468 :         const beans::PropertyValue* pProps = rCharAndParaProps.getConstArray();
    2201        1472 :         for( sal_Int32 nProp = 0; nProp < rCharAndParaProps.getLength(); ++nProp )
    2202        1472 :             pRange->setPropertyValue( pProps[nProp].Name, pProps[nProp].Value );
    2203             :     }
    2204         468 :     return xRet;
    2205             : }
    2206             : 
    2207           0 : void SvxUnoTextBase::copyText(
    2208             :     const uno::Reference< text::XTextCopy >& xSource ) throw ( uno::RuntimeException, std::exception )
    2209             : {
    2210           0 :     SolarMutexGuard aGuard;
    2211           0 :     uno::Reference< lang::XUnoTunnel > xUT( xSource, uno::UNO_QUERY );
    2212           0 :     SvxEditSource *pEditSource = GetEditSource();
    2213           0 :     SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
    2214           0 :     if( !pTextForwarder )
    2215           0 :         return;
    2216           0 :     if( xUT.is() )
    2217             :     {
    2218             :         SvxUnoTextBase* pSource = reinterpret_cast<SvxUnoTextBase*>(sal::static_int_cast<sal_uIntPtr>(
    2219           0 :                                                                     xUT->getSomething( SvxUnoTextBase::getUnoTunnelId())));
    2220           0 :         SvxEditSource *pSourceEditSource = pSource->GetEditSource();
    2221           0 :         SvxTextForwarder *pSourceTextForwarder = pSourceEditSource ? pSourceEditSource->GetTextForwarder() : 0;
    2222           0 :         if( pSourceTextForwarder )
    2223             :         {
    2224           0 :             pTextForwarder->CopyText( *pSourceTextForwarder );
    2225           0 :             pEditSource->UpdateData();
    2226             :         }
    2227             :     }
    2228             :     else
    2229             :     {
    2230           0 :         uno::Reference< text::XText > xSourceText( xSource, uno::UNO_QUERY );
    2231           0 :         if( xSourceText.is() )
    2232             :         {
    2233           0 :             setString( xSourceText->getString() );
    2234           0 :         }
    2235           0 :     }
    2236             : }
    2237             : 
    2238             : // lang::XServiceInfo
    2239           0 : OUString SAL_CALL SvxUnoTextBase::getImplementationName()
    2240             :     throw(uno::RuntimeException, std::exception)
    2241             : {
    2242           0 :     return OUString("SvxUnoTextBase");
    2243             : }
    2244             : 
    2245          54 : uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames(  )
    2246             :     throw(uno::RuntimeException, std::exception)
    2247             : {
    2248          54 :     return getSupportedServiceNames_Static();
    2249             : }
    2250             : 
    2251          54 : uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames_Static(  )
    2252             : {
    2253          54 :     uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames_Static() );
    2254          54 :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.text.Text" );
    2255          54 :     return aSeq;
    2256             : }
    2257             : 
    2258             : namespace
    2259             : {
    2260             :     class theSvxUnoTextBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextBaseUnoTunnelId > {};
    2261             : }
    2262             : 
    2263       35100 : const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() throw()
    2264             : {
    2265       35100 :     return theSvxUnoTextBaseUnoTunnelId::get().getSeq();
    2266             : }
    2267             : 
    2268        8390 : SvxUnoTextBase* SvxUnoTextBase::getImplementation( const uno::Reference< uno::XInterface >& xInt )
    2269             : {
    2270        8390 :     uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
    2271        8390 :     if( xUT.is() )
    2272        8390 :         return reinterpret_cast<SvxUnoTextBase*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxUnoTextBase::getUnoTunnelId())));
    2273             :     else
    2274           0 :         return NULL;
    2275             : }
    2276             : 
    2277       26710 : sal_Int64 SAL_CALL SvxUnoTextBase::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException, std::exception) \
    2278             : {
    2279       80130 :     if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(),
    2280       53420 :                                                          rId.getConstArray(), 16 ) )
    2281             :     {
    2282        8368 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
    2283             :     }
    2284             :     else
    2285             :     {
    2286       18342 :         return SvxUnoTextRangeBase::getSomething( rId );
    2287             :     }
    2288             : }
    2289             : 
    2290         109 : SvxUnoText::SvxUnoText( const SvxItemPropertySet* _pSet ) throw()
    2291         109 : : SvxUnoTextBase( _pSet )
    2292             : {
    2293         109 : }
    2294             : 
    2295        2158 : SvxUnoText::SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, uno::Reference < text::XText > xParent ) throw()
    2296        2158 : : SvxUnoTextBase( pSource, _pSet, xParent )
    2297             : {
    2298        2158 : }
    2299             : 
    2300           0 : SvxUnoText::SvxUnoText( const SvxUnoText& rText ) throw()
    2301             : : SvxUnoTextBase( rText )
    2302           0 : , cppu::OWeakAggObject()
    2303             : {
    2304           0 : }
    2305             : 
    2306         214 : SvxUnoText::~SvxUnoText() throw()
    2307             : {
    2308         214 : }
    2309             : 
    2310             : // uno::XInterface
    2311        2014 : uno::Any SAL_CALL SvxUnoText::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException, std::exception )
    2312             : {
    2313        2014 :     uno::Any aAny( SvxUnoTextBase::queryAggregation( rType ) );
    2314        2014 :     if( !aAny.hasValue() )
    2315        1082 :         aAny = OWeakAggObject::queryAggregation( rType );
    2316             : 
    2317        2014 :     return aAny;
    2318             : }
    2319             : 
    2320         985 : uno::Any SAL_CALL SvxUnoText::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException, std::exception )
    2321             : {
    2322         985 :     return OWeakAggObject::queryInterface( rType );
    2323             : }
    2324             : 
    2325       16756 : void SAL_CALL SvxUnoText::acquire() throw( )
    2326             : {
    2327       16756 :     OWeakAggObject::acquire();
    2328       16756 : }
    2329             : 
    2330       14673 : void SAL_CALL SvxUnoText::release() throw( )
    2331             : {
    2332       14673 :     OWeakAggObject::release();
    2333       14673 : }
    2334             : 
    2335             : // lang::XTypeProvider
    2336           0 : uno::Sequence< uno::Type > SAL_CALL SvxUnoText::getTypes(  ) throw( uno::RuntimeException, std::exception )
    2337             : {
    2338           0 :     return SvxUnoTextBase::getTypes();
    2339             : }
    2340             : 
    2341           0 : uno::Sequence< sal_Int8 > SAL_CALL SvxUnoText::getImplementationId(  ) throw( uno::RuntimeException, std::exception )
    2342             : {
    2343           0 :     return css::uno::Sequence<sal_Int8>();
    2344             : }
    2345             : 
    2346             : namespace
    2347             : {
    2348             :     class theSvxUnoTextUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextUnoTunnelId > {};
    2349             : }
    2350             : 
    2351         402 : const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() throw()
    2352             : {
    2353         402 :     return theSvxUnoTextUnoTunnelId::get().getSeq();
    2354             : }
    2355             : 
    2356         402 : sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException, std::exception) \
    2357             : {
    2358        1206 :     if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(),
    2359         804 :                                                          rId.getConstArray(), 16 ) )
    2360             :     {
    2361           0 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
    2362             :     }
    2363             :     else
    2364             :     {
    2365         402 :         return SvxUnoTextBase::getSomething( rId );
    2366             :     }
    2367             : }
    2368             : 
    2369             : 
    2370             : 
    2371             : 
    2372           0 : SvxDummyTextSource::~SvxDummyTextSource()
    2373             : {
    2374           0 : };
    2375             : 
    2376           0 : SvxEditSource* SvxDummyTextSource::Clone() const
    2377             : {
    2378           0 :     return new SvxDummyTextSource();
    2379             : }
    2380             : 
    2381           0 : SvxTextForwarder* SvxDummyTextSource::GetTextForwarder()
    2382             : {
    2383           0 :     return this;
    2384             : }
    2385             : 
    2386           0 : void SvxDummyTextSource::UpdateData()
    2387             : {
    2388           0 : }
    2389             : 
    2390           0 : sal_Int32 SvxDummyTextSource::GetParagraphCount() const
    2391             : {
    2392           0 :     return 0;
    2393             : }
    2394             : 
    2395           0 : sal_Int32 SvxDummyTextSource::GetTextLen( sal_Int32 ) const
    2396             : {
    2397           0 :     return 0;
    2398             : }
    2399             : 
    2400           0 : OUString SvxDummyTextSource::GetText( const ESelection& ) const
    2401             : {
    2402           0 :     return OUString();
    2403             : }
    2404             : 
    2405           0 : SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection&, EditEngineAttribs ) const
    2406             : {
    2407             :     // Very dangerous: The former implementation used a SfxItemPool created on the
    2408             :     // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using
    2409             :     // a deleted Pool by design.
    2410           0 :     return SfxItemSet(EditEngine::GetGlobalItemPool());
    2411             : }
    2412             : 
    2413           0 : SfxItemSet SvxDummyTextSource::GetParaAttribs( sal_Int32 ) const
    2414             : {
    2415           0 :     return GetAttribs(ESelection());
    2416             : }
    2417             : 
    2418           0 : void SvxDummyTextSource::SetParaAttribs( sal_Int32, const SfxItemSet& )
    2419             : {
    2420           0 : }
    2421             : 
    2422           0 : void SvxDummyTextSource::RemoveAttribs( const ESelection& , bool , sal_uInt16 )
    2423             : {
    2424           0 : }
    2425             : 
    2426           0 : void SvxDummyTextSource::GetPortions( sal_Int32, std::vector<sal_Int32>& ) const
    2427             : {
    2428           0 : }
    2429             : 
    2430           0 : SfxItemState SvxDummyTextSource::GetItemState( const ESelection&, sal_uInt16 ) const
    2431             : {
    2432           0 :     return SfxItemState::UNKNOWN;
    2433             : }
    2434             : 
    2435           0 : SfxItemState SvxDummyTextSource::GetItemState( sal_Int32, sal_uInt16 ) const
    2436             : {
    2437           0 :     return SfxItemState::UNKNOWN;
    2438             : }
    2439             : 
    2440           0 : SfxItemPool* SvxDummyTextSource::GetPool() const
    2441             : {
    2442           0 :     return NULL;
    2443             : }
    2444             : 
    2445           0 : void SvxDummyTextSource::QuickInsertText( const OUString&, const ESelection& )
    2446             : {
    2447           0 : }
    2448             : 
    2449           0 : void SvxDummyTextSource::QuickInsertField( const SvxFieldItem&, const ESelection& )
    2450             : {
    2451           0 : }
    2452             : 
    2453           0 : void SvxDummyTextSource::QuickSetAttribs( const SfxItemSet&, const ESelection& )
    2454             : {
    2455           0 : }
    2456             : 
    2457           0 : void SvxDummyTextSource::QuickInsertLineBreak( const ESelection& )
    2458             : {
    2459           0 : };
    2460             : 
    2461           0 : OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, Color*&, Color*& )
    2462             : {
    2463           0 :     return OUString();
    2464             : }
    2465             : 
    2466           0 : void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, sal_Int32, sal_Int32 )
    2467             : {
    2468           0 : }
    2469             : 
    2470           0 : bool SvxDummyTextSource::IsValid() const
    2471             : {
    2472           0 :     return false;
    2473             : }
    2474             : 
    2475           0 : LanguageType SvxDummyTextSource::GetLanguage( sal_Int32, sal_Int32 ) const
    2476             : {
    2477           0 :     return LANGUAGE_DONTKNOW;
    2478             : }
    2479             : 
    2480           0 : sal_Int32 SvxDummyTextSource::GetFieldCount( sal_Int32 ) const
    2481             : {
    2482           0 :     return 0;
    2483             : }
    2484             : 
    2485           0 : EFieldInfo SvxDummyTextSource::GetFieldInfo( sal_Int32, sal_uInt16 ) const
    2486             : {
    2487           0 :     return EFieldInfo();
    2488             : }
    2489             : 
    2490           0 : EBulletInfo SvxDummyTextSource::GetBulletInfo( sal_Int32 ) const
    2491             : {
    2492           0 :     return EBulletInfo();
    2493             : }
    2494             : 
    2495           0 : Rectangle SvxDummyTextSource::GetCharBounds( sal_Int32, sal_Int32 ) const
    2496             : {
    2497           0 :     return Rectangle();
    2498             : }
    2499             : 
    2500           0 : Rectangle SvxDummyTextSource::GetParaBounds( sal_Int32 ) const
    2501             : {
    2502           0 :     return Rectangle();
    2503             : }
    2504             : 
    2505           0 : MapMode SvxDummyTextSource::GetMapMode() const
    2506             : {
    2507           0 :     return MapMode();
    2508             : }
    2509             : 
    2510           0 : OutputDevice* SvxDummyTextSource::GetRefDevice() const
    2511             : {
    2512           0 :     return NULL;
    2513             : }
    2514             : 
    2515           0 : bool SvxDummyTextSource::GetIndexAtPoint( const Point&, sal_Int32&, sal_Int32& ) const
    2516             : {
    2517           0 :     return false;
    2518             : }
    2519             : 
    2520           0 : bool SvxDummyTextSource::GetWordIndices( sal_Int32, sal_Int32, sal_Int32&, sal_Int32& ) const
    2521             : {
    2522           0 :     return false;
    2523             : }
    2524             : 
    2525           0 : bool SvxDummyTextSource::GetAttributeRun( sal_Int32&, sal_Int32&, sal_Int32, sal_Int32, bool ) const
    2526             : {
    2527           0 :     return false;
    2528             : }
    2529             : 
    2530           0 : sal_Int32 SvxDummyTextSource::GetLineCount( sal_Int32 ) const
    2531             : {
    2532           0 :     return 0;
    2533             : }
    2534             : 
    2535           0 : sal_Int32 SvxDummyTextSource::GetLineLen( sal_Int32, sal_Int32 ) const
    2536             : {
    2537           0 :     return 0;
    2538             : }
    2539             : 
    2540           0 : void SvxDummyTextSource::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 /*nParagraph*/, sal_Int32 /*nLine*/ ) const
    2541             : {
    2542           0 :     rStart = rEnd = 0;
    2543           0 : }
    2544             : 
    2545           0 : sal_Int32 SvxDummyTextSource::GetLineNumberAtIndex( sal_Int32 /*nPara*/, sal_Int32 /*nIndex*/ ) const
    2546             : {
    2547           0 :     return 0;
    2548             : }
    2549             : 
    2550           0 : bool SvxDummyTextSource::QuickFormatDoc( bool )
    2551             : {
    2552           0 :     return false;
    2553             : }
    2554             : 
    2555           0 : sal_Int16 SvxDummyTextSource::GetDepth( sal_Int32 ) const
    2556             : {
    2557           0 :     return -1;
    2558             : }
    2559             : 
    2560           0 : bool SvxDummyTextSource::SetDepth( sal_Int32, sal_Int16 nNewDepth )
    2561             : {
    2562           0 :     return nNewDepth == 0;
    2563             : }
    2564             : 
    2565           0 : bool SvxDummyTextSource::Delete( const ESelection& )
    2566             : {
    2567           0 :     return false;
    2568             : }
    2569             : 
    2570           0 : bool SvxDummyTextSource::InsertText( const OUString&, const ESelection& )
    2571             : {
    2572           0 :     return false;
    2573             : }
    2574             : 
    2575           0 : const SfxItemSet * SvxDummyTextSource::GetEmptyItemSetPtr()
    2576             : {
    2577           0 :     return 0;
    2578             : }
    2579             : 
    2580           0 : void SvxDummyTextSource::AppendParagraph()
    2581             : {
    2582           0 : }
    2583             : 
    2584           0 : sal_Int32 SvxDummyTextSource::AppendTextPortion( sal_Int32, const OUString &, const SfxItemSet & )
    2585             : {
    2586           0 :     return 0;
    2587             : }
    2588             : 
    2589           0 : void  SvxDummyTextSource::CopyText(const SvxTextForwarder& )
    2590             : {
    2591           0 : }
    2592             : 
    2593             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11