LCOV - code coverage report
Current view: top level - editeng/source/uno - unotext.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 878 1237 71.0 %
Date: 2014-11-03 Functions: 110 185 59.5 %
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        1020 : ESelection toESelection(const text::TextRangeSelection& rSel)
      60             : {
      61        1020 :     ESelection aESel;
      62        1020 :     aESel.nStartPara = rSel.Start.Paragraph;
      63        1020 :     aESel.nStartPos = rSel.Start.PositionInParagraph;
      64        1020 :     aESel.nEndPara = rSel.End.Paragraph;
      65        1020 :     aESel.nEndPos = rSel.End.PositionInParagraph;
      66        1020 :     return aESel;
      67             : }
      68             : 
      69             : }
      70             : 
      71             : #define QUERYINT( xint ) \
      72             :     if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
      73             :         return uno::makeAny(uno::Reference< xint >(this))
      74             : 
      75       87288 : const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet()
      76             : {
      77       87288 :     static SvxItemPropertySet aTextCursorSvxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap(), EditEngine::GetGlobalItemPool() );
      78       87288 :     return &aTextCursorSvxPropertySet;
      79             : }
      80             : 
      81          42 : const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap()
      82             : {
      83             :     // Propertymap for an Outliner Text
      84             :     static const SfxItemPropertyMapEntry aSvxTextPortionPropertyMap[] =
      85             :     {
      86        1862 :         SVX_UNOEDIT_CHAR_PROPERTIES,
      87          38 :         SVX_UNOEDIT_FONT_PROPERTIES,
      88         190 :         SVX_UNOEDIT_OUTLINER_PROPERTIES,
      89         532 :         SVX_UNOEDIT_PARA_PROPERTIES,
      90          38 :         {OUString("TextField"),                     EE_FEATURE_FIELD,   cppu::UnoType<text::XTextField>::get(),   beans::PropertyAttribute::READONLY, 0 },
      91          38 :         {OUString("TextPortionType"),               WID_PORTIONTYPE,    ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 },
      92          38 :         {OUString("TextUserDefinedAttributes"),         EE_CHAR_XMLATTRIBS,     cppu::UnoType<com::sun::star::container::XNameContainer>::get(),        0,     0},
      93          38 :         {OUString("ParaUserDefinedAttributes"),         EE_PARA_XMLATTRIBS,     cppu::UnoType<com::sun::star::container::XNameContainer>::get(),        0,     0},
      94             :         { OUString(), 0, css::uno::Type(), 0, 0 }
      95        2854 :     };
      96          42 :     return aSvxTextPortionPropertyMap;
      97             : }
      98        3940 : const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet()
      99             : {
     100        3940 :     static SvxItemPropertySet aSvxTextPortionPropertySet( ImplGetSvxTextPortionPropertyMap(), EditEngine::GetGlobalItemPool() );
     101        3940 :     return &aSvxTextPortionPropertySet;
     102             : }
     103             : 
     104         910 : const SfxItemPropertySet* ImplGetSvxTextPortionSfxPropertySet()
     105             : {
     106         910 :     static SfxItemPropertySet aSvxTextPortionSfxPropertySet( ImplGetSvxTextPortionPropertyMap() );
     107         910 :     return &aSvxTextPortionSfxPropertySet;
     108             : }
     109             : 
     110         116 : const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap()
     111             : {
     112             :     // Propertymap for an Outliner Text
     113             :     static const SfxItemPropertyMapEntry aSvxUnoOutlinerTextCursorPropertyMap[] =
     114             :     {
     115        4900 :         SVX_UNOEDIT_CHAR_PROPERTIES,
     116         100 :         SVX_UNOEDIT_FONT_PROPERTIES,
     117         500 :         SVX_UNOEDIT_OUTLINER_PROPERTIES,
     118        1400 :         SVX_UNOEDIT_PARA_PROPERTIES,
     119         100 :         {OUString("TextUserDefinedAttributes"),         EE_CHAR_XMLATTRIBS,     cppu::UnoType<com::sun::star::container::XNameContainer>::get(),        0,     0},
     120         100 :         {OUString("ParaUserDefinedAttributes"),         EE_PARA_XMLATTRIBS,     cppu::UnoType<com::sun::star::container::XNameContainer>::get(),        0,     0},
     121             :         { OUString(), 0, css::uno::Type(), 0, 0 }
     122        7316 :     };
     123             : 
     124         116 :     return aSvxUnoOutlinerTextCursorPropertyMap;
     125             : }
     126          58 : const SfxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSfxPropertySet()
     127             : {
     128          58 :     static SfxItemPropertySet aTextCursorSfxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap() );
     129          58 :     return &aTextCursorSfxPropertySet;
     130             : }
     131             : 
     132             : 
     133             : // helper for Item/Property conversion
     134             : 
     135             : 
     136      613173 : void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw()
     137             : {
     138             :     DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
     139      613173 :     if( pForwarder )
     140             :     {
     141      613173 :         sal_Int32 nParaCount = pForwarder->GetParagraphCount();
     142      613173 :         if(nParaCount>0)
     143      613173 :             nParaCount--;
     144             : 
     145      613173 :         rSel = ESelection( 0,0, nParaCount, pForwarder->GetTextLen( nParaCount ));
     146             :     }
     147      613173 : }
     148             : 
     149      553180 : void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw()
     150             : {
     151             :     DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
     152      553180 :     if( pForwarder )
     153             :     {
     154      553180 :         if( rSel.nStartPara == EE_PARA_MAX_COUNT )
     155             :         {
     156        4664 :             ::GetSelection( rSel, pForwarder );
     157             :         }
     158             :         else
     159             :         {
     160      548516 :             ESelection aMaxSelection;
     161      548516 :             GetSelection( aMaxSelection, pForwarder );
     162             : 
     163             :             // check start position
     164      548516 :             if( rSel.nStartPara < aMaxSelection.nStartPara )
     165             :             {
     166           0 :                 rSel.nStartPara = aMaxSelection.nStartPara;
     167           0 :                 rSel.nStartPos = aMaxSelection.nStartPos;
     168             :             }
     169      548516 :             else if( rSel.nStartPara > aMaxSelection.nEndPara )
     170             :             {
     171           0 :                 rSel.nStartPara = aMaxSelection.nEndPara;
     172           0 :                 rSel.nStartPos = aMaxSelection.nEndPos;
     173             :             }
     174      548516 :             else if( rSel.nStartPos  > pForwarder->GetTextLen( rSel.nStartPara ) )
     175             :             {
     176           0 :                 rSel.nStartPos = pForwarder->GetTextLen( rSel.nStartPara );
     177             :             }
     178             : 
     179             :             // check end position
     180      548516 :             if( rSel.nEndPara < aMaxSelection.nStartPara )
     181             :             {
     182           0 :                 rSel.nEndPara = aMaxSelection.nStartPara;
     183           0 :                 rSel.nEndPos = aMaxSelection.nStartPos;
     184             :             }
     185      548516 :             else if( rSel.nEndPara > aMaxSelection.nEndPara )
     186             :             {
     187        3532 :                 rSel.nEndPara = aMaxSelection.nEndPara;
     188        3532 :                 rSel.nEndPos = aMaxSelection.nEndPos;
     189             :             }
     190      544984 :             else if( rSel.nEndPos > pForwarder->GetTextLen( rSel.nEndPara ) )
     191             :             {
     192         746 :                 rSel.nEndPos = pForwarder->GetTextLen( rSel.nEndPara );
     193             :             }
     194             :         }
     195             :     }
     196      553180 : }
     197             : 
     198      163950 : void CheckSelection( struct ESelection& rSel, SvxEditSource *pEdit ) throw()
     199             : {
     200      163950 :     if (!pEdit)
     201      163950 :         return;
     202      163950 :     CheckSelection( rSel, pEdit->GetTextForwarder() );
     203             : }
     204             : 
     205             : 
     206             : // class SvxUnoTextRangeBase
     207             : 
     208             : 
     209      196256 : UNO3_GETIMPLEMENTATION_IMPL( SvxUnoTextRangeBase );
     210             : 
     211       87500 : SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw()
     212       87500 : : mpEditSource(NULL) , mpPropSet(_pSet)
     213             : {
     214       87500 : }
     215             : 
     216       20506 : SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw()
     217       20506 : : mpPropSet(_pSet)
     218             : {
     219       20506 :     SolarMutexGuard aGuard;
     220             : 
     221             :     DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!");
     222             : 
     223       20506 :     mpEditSource = pSource->Clone();
     224       20506 :     if (mpEditSource != NULL)
     225             :     {
     226       20506 :         ESelection aSelection;
     227       20506 :         ::GetSelection( aSelection, mpEditSource->GetTextForwarder() );
     228       20506 :         SetSelection( aSelection );
     229             : 
     230       20506 :         mpEditSource->addRange( this );
     231       20506 :     }
     232       20506 : }
     233             : 
     234       19031 : 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       19031 : ,   mpPropSet(rRange.getPropertySet())
     245             : {
     246       19031 :     SolarMutexGuard aGuard;
     247             : 
     248       19031 :     mpEditSource = rRange.mpEditSource ? rRange.mpEditSource->Clone() : NULL;
     249             : 
     250       19031 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     251       19031 :     if( pForwarder )
     252             :     {
     253       19031 :         maSelection  = rRange.maSelection;
     254       19031 :         CheckSelection( maSelection, pForwarder );
     255             :     }
     256             : 
     257       19031 :     if( mpEditSource )
     258       19031 :         mpEditSource->addRange( this );
     259       19031 : }
     260             : 
     261      253526 : SvxUnoTextRangeBase::~SvxUnoTextRangeBase() throw()
     262             : {
     263      126763 :     if( mpEditSource )
     264      122817 :         mpEditSource->removeRange( this );
     265             : 
     266      126763 :     delete mpEditSource;
     267      126763 : }
     268             : 
     269       83554 : 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       83554 :     mpEditSource = pSource;
     275             : 
     276       83554 :     maSelection.nStartPara = EE_PARA_MAX_COUNT;
     277             : 
     278       83554 :     if( mpEditSource )
     279       83554 :         mpEditSource->addRange( this );
     280       83554 : }
     281             : 
     282             : /** puts a field item with a copy of the given FieldData into the itemset
     283             :     corresponding with this range */
     284           2 : void SvxUnoTextRangeBase::attachField( const SvxFieldData* pData ) throw()
     285             : {
     286           2 :     SolarMutexGuard aGuard;
     287             : 
     288           2 :     if( pData )
     289             :     {
     290           2 :         SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     291           2 :         if( pForwarder )
     292             :         {
     293           2 :             SvxFieldItem aField( *pData, EE_FEATURE_FIELD );
     294           2 :             pForwarder->QuickInsertField( aField, maSelection );
     295             :         }
     296           2 :     }
     297           2 : }
     298             : 
     299       95873 : void SvxUnoTextRangeBase::SetSelection( const ESelection& rSelection ) throw()
     300             : {
     301       95873 :     SolarMutexGuard aGuard;
     302             : 
     303       95873 :     maSelection = rSelection;
     304       95873 :     CheckSelection( maSelection, mpEditSource );
     305       95873 : }
     306             : 
     307             : // Interface XTextRange ( XText )
     308             : 
     309       12104 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart(void)
     310             :     throw( uno::RuntimeException, std::exception )
     311             : {
     312       12104 :     SolarMutexGuard aGuard;
     313             : 
     314       12104 :     uno::Reference< text::XTextRange > xRange;
     315             : 
     316       12104 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     317       12104 :     if( pForwarder )
     318             :     {
     319       12104 :         CheckSelection( maSelection, pForwarder );
     320             : 
     321       12104 :         SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() );
     322             : 
     323       12104 :         if(pText == NULL)
     324           0 :             throw uno::RuntimeException();
     325             : 
     326       12104 :         SvxUnoTextRange* pRange = new SvxUnoTextRange( *pText );
     327       12104 :         xRange = pRange;
     328             : 
     329       12104 :         ESelection aNewSel = maSelection;
     330       12104 :         aNewSel.nEndPara = aNewSel.nStartPara;
     331       12104 :         aNewSel.nEndPos  = aNewSel.nStartPos;
     332       12104 :         pRange->SetSelection( aNewSel );
     333             :     }
     334             : 
     335       12104 :     return xRange;
     336             : }
     337             : 
     338          54 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd(void)
     339             :     throw( uno::RuntimeException, std::exception )
     340             : {
     341          54 :     SolarMutexGuard aGuard;
     342             : 
     343          54 :     uno::Reference< text::XTextRange > xRet;
     344             : 
     345          54 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     346          54 :     if( pForwarder )
     347             :     {
     348          54 :         CheckSelection( maSelection, pForwarder );
     349             : 
     350          54 :         SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() );
     351             : 
     352          54 :         if(pText == NULL)
     353           0 :             throw uno::RuntimeException();
     354             : 
     355          54 :         SvxUnoTextRange* pNew = new SvxUnoTextRange( *pText );
     356          54 :         xRet = pNew;
     357             : 
     358          54 :         ESelection aNewSel = maSelection;
     359          54 :         aNewSel.nStartPara = aNewSel.nEndPara;
     360          54 :         aNewSel.nStartPos  = aNewSel.nEndPos;
     361          54 :         pNew->SetSelection( aNewSel );
     362             :     }
     363          54 :     return xRet;
     364             : }
     365             : 
     366        6094 : OUString SAL_CALL SvxUnoTextRangeBase::getString(void)
     367             :     throw( uno::RuntimeException, std::exception )
     368             : {
     369        6094 :     SolarMutexGuard aGuard;
     370             : 
     371        6094 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     372        6094 :     if( pForwarder )
     373             :     {
     374        6094 :         CheckSelection( maSelection, pForwarder );
     375             : 
     376        6094 :         return pForwarder->GetText( maSelection );
     377             :     }
     378             :     else
     379             :     {
     380           0 :         const OUString aEmpty;
     381           0 :         return aEmpty;
     382        6094 :     }
     383             : }
     384             : 
     385       32103 : void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString)
     386             :     throw( uno::RuntimeException, std::exception )
     387             : {
     388       32103 :     SolarMutexGuard aGuard;
     389             : 
     390       32103 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     391       32103 :     if( pForwarder )
     392             :     {
     393       32103 :         CheckSelection( maSelection, pForwarder );
     394             : 
     395       32103 :         OUString aConverted(convertLineEnd(aString, LINEEND_LF));  // Simply count the number of line endings
     396             : 
     397       32103 :         pForwarder->QuickInsertText( aConverted, maSelection );
     398       32103 :         mpEditSource->UpdateData();
     399             : 
     400             :         //  Adapt selection
     401             :         //! It would be easier if the EditEngine would return the selection
     402             :         //! on QuickInsertText...
     403       32103 :         CollapseToStart();
     404             : 
     405       32103 :         sal_Int32 nLen = aConverted.getLength();
     406       32103 :         if (nLen)
     407       27287 :             GoRight( nLen, true );
     408       32103 :     }
     409       32103 : }
     410             : 
     411             : // Interface beans::XPropertySet
     412       31354 : uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextRangeBase::getPropertySetInfo(void)
     413             :     throw( uno::RuntimeException, std::exception )
     414             : {
     415       31354 :     return mpPropSet->getPropertySetInfo();
     416             : }
     417             : 
     418       20256 : 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       20256 :     if (PropertyName == UNO_TR_PROP_SELECTION)
     422             :     {
     423         510 :         text::TextRangeSelection aSel = aValue.get<text::TextRangeSelection>();
     424         510 :         SetSelection(toESelection(aSel));
     425             : 
     426       20730 :         return;
     427             :     }
     428             : 
     429       19746 :     _setPropertyValue( PropertyName, aValue, -1 );
     430             : }
     431             : 
     432       20054 : 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       20054 :     SolarMutexGuard aGuard;
     436             : 
     437       20054 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     438       20054 :     if( pForwarder )
     439             :     {
     440       20054 :         CheckSelection( maSelection, pForwarder );
     441             : 
     442       20054 :         const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName );
     443       20054 :         if ( pMap )
     444             :         {
     445       20016 :             ESelection aSel( GetSelection() );
     446       20016 :             bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
     447             : 
     448       20016 :             if( nPara == -1 && !bParaAttrib )
     449             :             {
     450        5283 :                 SfxItemSet aOldSet( pForwarder->GetAttribs( aSel ) );
     451             :                 // we have a selection and no para attribute
     452       10566 :                 SfxItemSet aNewSet( *aOldSet.GetPool(), aOldSet.GetRanges() );
     453             : 
     454        5283 :                 setPropertyValue( pMap, aValue, maSelection, aOldSet, aNewSet );
     455             : 
     456             : 
     457       10564 :                 pForwarder->QuickSetAttribs( aNewSet, GetSelection() );
     458             :             }
     459             :             else
     460             :             {
     461             :                 sal_Int32 nEndPara;
     462             : 
     463       14733 :                 if( nPara == -1 )
     464             :                 {
     465       14429 :                     nPara = aSel.nStartPara;
     466       14429 :                     nEndPara = aSel.nEndPara;
     467             :                 }
     468             :                 else
     469             :                 {
     470             :                     // only one paragraph
     471         304 :                     nEndPara = nPara;
     472             :                 }
     473             : 
     474       44371 :                 while( nPara <= nEndPara )
     475             :                 {
     476             :                     // we have a paragraph
     477       14907 :                     SfxItemSet aSet( pForwarder->GetParaAttribs( nPara ) );
     478       14907 :                     setPropertyValue( pMap, aValue, maSelection, aSet, aSet );
     479       14905 :                     pForwarder->SetParaAttribs( nPara, aSet );
     480       14905 :                     nPara++;
     481       14907 :                 }
     482             :             }
     483             : 
     484       20012 :             GetEditSource()->UpdateData();
     485       40024 :             return;
     486             :         }
     487             :     }
     488             : 
     489       20012 :     throw beans::UnknownPropertyException();
     490             : }
     491             : 
     492      164844 : 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      164844 :     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      153406 :         rNewSet.Put(rOldSet.Get(pMap->nWID));  // Old Item in new Set
     499      153406 :         mpPropSet->setPropertyValue(pMap, rValue, rNewSet, false );
     500             :     }
     501      164840 : }
     502             : 
     503     1190326 : bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemSet&, const SfxItemPropertySimpleEntry* pMap, const uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection /* = NULL */, SvxEditSource* pEditSource /* = NULL*/ )
     504             : {
     505     1190326 :     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        6832 :             uno::Reference< container::XIndexReplace > xRule;
     521        6832 :             if( !aValue.hasValue() || ((aValue >>= xRule) && !xRule.is()) )
     522        4304 :                 return true;
     523             : 
     524        2528 :             return false;
     525             :         }
     526             : 
     527             :     case WID_NUMLEVEL:
     528             :         {
     529        4896 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     530        4896 :             if(pForwarder && pSelection)
     531             :             {
     532        4896 :                 sal_Int16 nLevel = sal_Int16();
     533        4896 :                 if( aValue >>= nLevel )
     534             :                 {
     535             :                     // #101004# Call interface method instead of unsafe cast
     536        4896 :                     if(! pForwarder->SetDepth( pSelection->nStartPara, nLevel ) )
     537           0 :                         throw lang::IllegalArgumentException();
     538             : 
     539        4896 :                     return true;
     540             :                 }
     541             :             }
     542             :         }
     543           0 :         break;
     544             :     case WID_NUMBERINGSTARTVALUE:
     545             :         {
     546           4 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     547           4 :             if(pForwarder && pSelection)
     548             :             {
     549           4 :                 sal_Int16 nStartValue = -1;
     550           4 :                 if( aValue >>= nStartValue )
     551             :                 {
     552           0 :                     pForwarder->SetNumberingStartValue( pSelection->nStartPara, nStartValue );
     553           0 :                     return true;
     554             :                 }
     555             :             }
     556             :         }
     557           4 :         break;
     558             :     case WID_PARAISNUMBERINGRESTART:
     559             :         {
     560           8 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     561           8 :             if(pForwarder && pSelection)
     562             :             {
     563           8 :                 bool bParaIsNumberingRestart = false;
     564           8 :                 if( aValue >>= bParaIsNumberingRestart )
     565             :                 {
     566           8 :                     pForwarder->SetParaIsNumberingRestart( pSelection->nStartPara, bParaIsNumberingRestart );
     567           8 :                     return true;
     568             :                 }
     569             :             }
     570             :         }
     571           0 :         break;
     572             :     case EE_PARA_BULLETSTATE:
     573             :         {
     574        3396 :             bool bBullet = true;
     575        3396 :             if( aValue >>= bBullet )
     576             :             {
     577        3396 :                 SfxBoolItem aItem( EE_PARA_BULLETSTATE, bBullet );
     578        3396 :                 rNewSet.Put(aItem);
     579        3396 :                 return true;
     580             :             }
     581             :         }
     582           0 :         break;
     583             : 
     584             :     default:
     585     1175190 :         return false;
     586             :     }
     587             : 
     588           4 :     throw lang::IllegalArgumentException();
     589             : }
     590             : 
     591       32355 : uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyValue(const OUString& PropertyName)
     592             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     593             : {
     594       32355 :     if (PropertyName == UNO_TR_PROP_SELECTION)
     595             :     {
     596         520 :         const ESelection& rSel = GetSelection();
     597         520 :         text::TextRangeSelection aSel;
     598         520 :         aSel.Start.Paragraph = rSel.nStartPara;
     599         520 :         aSel.Start.PositionInParagraph = static_cast<sal_Int32>(rSel.nStartPos);
     600         520 :         aSel.End.Paragraph = rSel.nEndPara;
     601         520 :         aSel.End.PositionInParagraph = static_cast<sal_Int32>(rSel.nEndPos);
     602         520 :         return uno::makeAny(aSel);
     603             :     }
     604             : 
     605       31835 :     return _getPropertyValue( PropertyName, -1 );
     606             : }
     607             : 
     608       35569 : uno::Any SAL_CALL SvxUnoTextRangeBase::_getPropertyValue(const OUString& PropertyName, sal_Int32 nPara )
     609             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
     610             : {
     611       35569 :     SolarMutexGuard aGuard;
     612             : 
     613       35569 :     uno::Any aAny;
     614             : 
     615       35569 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     616       35569 :     if( pForwarder )
     617             :     {
     618       35569 :         const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName );
     619       35569 :         if( pMap )
     620             :         {
     621       34633 :             SfxItemSet* pAttribs = NULL;
     622       34633 :             if( nPara != -1 )
     623        3734 :                 pAttribs = pForwarder->GetParaAttribs( nPara ).Clone();
     624             :             else
     625       30899 :                 pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
     626             : 
     627             :             //  Replace Dontcare with Default, so that one always has a mirror
     628       34633 :             pAttribs->ClearInvalidItems();
     629             : 
     630       34633 :             getPropertyValue( pMap, aAny, *pAttribs );
     631             : 
     632       34633 :             delete pAttribs;
     633       69266 :             return aAny;
     634             :         }
     635             :     }
     636             : 
     637         936 :     throw beans::UnknownPropertyException();
     638             : }
     639             : 
     640       36311 : void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertySimpleEntry* pMap, uno::Any& rAny, const SfxItemSet& rSet )
     641             :     throw (beans::UnknownPropertyException, uno::RuntimeException)
     642             : {
     643       36311 :     switch( pMap->nWID )
     644             :     {
     645             :     case EE_FEATURE_FIELD:
     646        1004 :         if ( rSet.GetItemState( EE_FEATURE_FIELD, false ) == SfxItemState::SET )
     647             :         {
     648        1004 :             const SvxFieldItem* pItem = static_cast<const SvxFieldItem*>(rSet.GetItem( EE_FEATURE_FIELD ));
     649        1004 :             const SvxFieldData* pData = pItem->GetField();
     650        1004 :             uno::Reference< text::XTextRange > xAnchor( this );
     651             : 
     652             :             // get presentation string for field
     653        1004 :             Color* pTColor = NULL;
     654        1004 :             Color* pFColor = NULL;
     655             : 
     656        1004 :             SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder();
     657        2008 :             OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.nStartPara, maSelection.nStartPos, pTColor, pFColor ) );
     658             : 
     659        1004 :             delete pTColor;
     660        1004 :             delete pFColor;
     661             : 
     662        2008 :             uno::Reference< text::XTextField > xField( new SvxUnoTextField( xAnchor, aPresentation, pData ) );
     663        2008 :             rAny <<= xField;
     664             :         }
     665        1004 :         break;
     666             : 
     667             :     case WID_PORTIONTYPE:
     668        3200 :         if ( rSet.GetItemState( EE_FEATURE_FIELD, false ) == SfxItemState::SET )
     669             :         {
     670         950 :             OUString aType("TextField");
     671         950 :             rAny <<= aType;
     672             :         }
     673             :         else
     674             :         {
     675        2250 :             OUString aType("Text");
     676        2250 :             rAny <<= aType;
     677             :         }
     678        3200 :         break;
     679             : 
     680             :     default:
     681       32107 :         if(!GetPropertyValueHelper( *((SfxItemSet*)(&rSet)), pMap, rAny, &maSelection, GetEditSource() ))
     682       23941 :             rAny = mpPropSet->getPropertyValue(pMap, rSet, true, false );
     683             :     }
     684       36311 : }
     685             : 
     686      140629 : bool SvxUnoTextRangeBase::GetPropertyValueHelper(  SfxItemSet& rSet, const SfxItemPropertySimpleEntry* pMap, uno::Any& aAny, const ESelection* pSelection /* = NULL */, SvxEditSource* pEditSource /* = NULL */ )
     687             :     throw( uno::RuntimeException )
     688             : {
     689      140629 :     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        7060 :             SfxItemState eState = rSet.GetItemState( EE_PARA_NUMBULLET, true );
     702        7060 :             if( eState != SfxItemState::SET && eState != SfxItemState::DEFAULT)
     703           0 :                 throw uno::RuntimeException();
     704             : 
     705        7060 :             const SvxNumBulletItem* pBulletItem = static_cast<const SvxNumBulletItem*>(rSet.GetItem( EE_PARA_NUMBULLET, true ));
     706             : 
     707        7060 :             if( pBulletItem == NULL )
     708           0 :                 throw uno::RuntimeException();
     709             : 
     710        7060 :             aAny <<= SvxCreateNumRule( pBulletItem->GetNumRule() );
     711             :         }
     712        7060 :         break;
     713             : 
     714             :     case WID_NUMLEVEL:
     715             :         {
     716        1082 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     717        1082 :             if(pForwarder && pSelection)
     718             :             {
     719        1082 :                 sal_Int16 nLevel = pForwarder->GetDepth( pSelection->nStartPara );
     720        1082 :                 if( nLevel >= 0 )
     721         134 :                     aAny <<= nLevel;
     722             :             }
     723             :         }
     724        1082 :         break;
     725             :     case WID_NUMBERINGSTARTVALUE:
     726             :         {
     727           4 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     728           4 :             if(pForwarder && pSelection)
     729           4 :                 aAny <<= pForwarder->GetNumberingStartValue( pSelection->nStartPara );
     730             :         }
     731           4 :         break;
     732             :     case WID_PARAISNUMBERINGRESTART:
     733             :         {
     734          20 :             SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
     735          20 :             if(pForwarder && pSelection)
     736          20 :                 aAny <<= pForwarder->IsParaIsNumberingRestart( pSelection->nStartPara );
     737             :         }
     738          20 :         break;
     739             : 
     740             :     case EE_PARA_BULLETSTATE:
     741             :         {
     742         540 :             bool bState = false;
     743         540 :             SfxItemState eState = rSet.GetItemState( EE_PARA_BULLETSTATE, true );
     744         540 :             if( eState == SfxItemState::SET || eState == SfxItemState::DEFAULT )
     745             :             {
     746         540 :                 const SfxBoolItem* pItem = static_cast<const SfxBoolItem*>(rSet.GetItem( EE_PARA_BULLETSTATE, true ));
     747         540 :                 bState = pItem->GetValue();
     748             :             }
     749             : 
     750         540 :             aAny <<= bState;
     751             :         }
     752         540 :         break;
     753             :     default:
     754             : 
     755      131923 :         return false;
     756             :     }
     757             : 
     758        8706 :     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         212 : void SAL_CALL SvxUnoTextRangeBase::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
     765         196 : 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       10874 : 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       10874 :     _setPropertyValues( aPropertyNames, aValues, -1 );
     771       10874 : }
     772             : 
     773       10874 : 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       10874 :     SolarMutexGuard aGuard;
     776             : 
     777       10874 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     778       10874 :     if( pForwarder )
     779             :     {
     780       10874 :         CheckSelection( maSelection, pForwarder );
     781             : 
     782       10874 :         ESelection aSel( GetSelection() );
     783             : 
     784       10874 :         const OUString* pPropertyNames = aPropertyNames.getConstArray();
     785       10874 :         const uno::Any* pValues = aValues.getConstArray();
     786       10874 :         sal_Int32 nCount = aPropertyNames.getLength();
     787             : 
     788       10874 :         sal_Int32 nEndPara = nPara;
     789       10874 :         sal_Int32 nTempPara = nPara;
     790             : 
     791       10874 :         if( nTempPara == -1 )
     792             :         {
     793       10874 :             nTempPara = aSel.nStartPara;
     794       10874 :             nEndPara = aSel.nEndPara;
     795             :         }
     796             : 
     797       10874 :         SfxItemSet* pOldAttrSet = NULL;
     798       10874 :         SfxItemSet* pNewAttrSet = NULL;
     799             : 
     800       10874 :         SfxItemSet* pOldParaSet = NULL;
     801       10874 :         SfxItemSet* pNewParaSet = NULL;
     802             : 
     803      156476 :         for( ; nCount; nCount--, pPropertyNames++, pValues++ )
     804             :         {
     805      145602 :             const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
     806             : 
     807      145602 :             if( pMap )
     808             :             {
     809      144654 :                 bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
     810             : 
     811      144654 :                 if( (nPara == -1) && !bParaAttrib )
     812             :                 {
     813      126252 :                     if( NULL == pNewAttrSet )
     814             :                     {
     815        8982 :                         const SfxItemSet aSet( pForwarder->GetAttribs( aSel ) );
     816        8982 :                         pOldAttrSet = new SfxItemSet( aSet );
     817        8982 :                         pNewAttrSet = new SfxItemSet( *pOldAttrSet->GetPool(), pOldAttrSet->GetRanges() );
     818             :                     }
     819             : 
     820      126252 :                     setPropertyValue( pMap, *pValues, GetSelection(), *pOldAttrSet, *pNewAttrSet );
     821             : 
     822      126252 :                     if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
     823             :                     {
     824             :                         const SfxPoolItem* pItem;
     825      124086 :                         if( pNewAttrSet->GetItemState( pMap->nWID, true, &pItem ) == SfxItemState::SET )
     826             :                         {
     827      124086 :                             pOldAttrSet->Put( *pItem );
     828             :                         }
     829      126252 :                     }
     830             :                 }
     831             :                 else
     832             :                 {
     833       18402 :                     if( NULL == pNewParaSet )
     834             :                     {
     835        4270 :                         const SfxItemSet aSet( pForwarder->GetParaAttribs( nTempPara ) );
     836        4270 :                         pOldParaSet = new SfxItemSet( aSet );
     837        4270 :                         pNewParaSet = new SfxItemSet( *pOldParaSet->GetPool(), pOldParaSet->GetRanges() );
     838             :                     }
     839             : 
     840       18402 :                     setPropertyValue( pMap, *pValues, GetSelection(), *pOldParaSet, *pNewParaSet );
     841             : 
     842       18402 :                     if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
     843             :                     {
     844             :                         const SfxPoolItem* pItem;
     845       18402 :                         if( pNewParaSet->GetItemState( pMap->nWID, true, &pItem ) == SfxItemState::SET )
     846             :                         {
     847       18402 :                             pOldParaSet->Put( *pItem );
     848             :                         }
     849             :                     }
     850             : 
     851             :                 }
     852             :             }
     853             :         }
     854             : 
     855       10874 :         bool bNeedsUpdate = false;
     856             : 
     857       10874 :         if( pNewParaSet )
     858             :         {
     859        4270 :             if( pNewParaSet->Count() )
     860             :             {
     861       12810 :                 while( nTempPara <= nEndPara )
     862             :                 {
     863        4270 :                     SfxItemSet aSet( pForwarder->GetParaAttribs( nTempPara ) );
     864        4270 :                     aSet.Put( *pNewParaSet );
     865        4270 :                     pForwarder->SetParaAttribs( nTempPara, aSet );
     866        4270 :                     nTempPara++;
     867        4270 :                 }
     868        4270 :                 bNeedsUpdate = true;
     869             :             }
     870             : 
     871        4270 :             delete pNewParaSet;
     872        4270 :             delete pOldParaSet;
     873             :         }
     874             : 
     875       10874 :         if( pNewAttrSet )
     876             :         {
     877        8982 :             if( pNewAttrSet->Count() )
     878             :             {
     879        6816 :                 pForwarder->QuickSetAttribs( *pNewAttrSet, GetSelection() );
     880        6816 :                 bNeedsUpdate = true;
     881             :             }
     882        8982 :             delete pNewAttrSet;
     883        8982 :             delete pOldAttrSet;
     884             : 
     885             :         }
     886             : 
     887       10874 :         if( bNeedsUpdate )
     888       10860 :             GetEditSource()->UpdateData();
     889       10874 :     }
     890       10874 : }
     891             : 
     892          64 : uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::getPropertyValues( const uno::Sequence< OUString >& aPropertyNames ) throw (uno::RuntimeException, std::exception)
     893             : {
     894          64 :     return _getPropertyValues( aPropertyNames, -1 );
     895             : }
     896             : 
     897         374 : uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::_getPropertyValues( const uno::Sequence< OUString >& aPropertyNames, sal_Int32 nPara ) throw (uno::RuntimeException)
     898             : {
     899         374 :     SolarMutexGuard aGuard;
     900             : 
     901         374 :     sal_Int32 nCount = aPropertyNames.getLength();
     902             : 
     903             : 
     904         374 :     uno::Sequence< uno::Any > aValues( nCount );
     905             : 
     906         374 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     907         374 :     if( pForwarder )
     908             :     {
     909         374 :         SfxItemSet* pAttribs = NULL;
     910         374 :         if( nPara != -1 )
     911         310 :             pAttribs = pForwarder->GetParaAttribs( nPara ).Clone();
     912             :         else
     913          64 :             pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
     914             : 
     915         374 :         pAttribs->ClearInvalidItems();
     916             : 
     917         374 :         const OUString* pPropertyNames = aPropertyNames.getConstArray();
     918         374 :         uno::Any* pValues = aValues.getArray();
     919             : 
     920        2052 :         for( ; nCount; nCount--, pPropertyNames++, pValues++ )
     921             :         {
     922        1678 :             const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
     923        1678 :             if( pMap )
     924             :             {
     925        1678 :                 getPropertyValue( pMap, *pValues, *pAttribs );
     926             :             }
     927             :         }
     928             : 
     929         374 :         delete pAttribs;
     930             : 
     931             :     }
     932             : 
     933         374 :     return aValues;
     934             : }
     935             : 
     936         212 : void SAL_CALL SvxUnoTextRangeBase::addPropertiesChangeListener( const uno::Sequence< OUString >& , const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException, std::exception)
     937             : {
     938         212 : }
     939             : 
     940         196 : void SAL_CALL SvxUnoTextRangeBase::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException, std::exception)
     941             : {
     942         196 : }
     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        1220 : beans::PropertyState SAL_CALL SvxUnoTextRangeBase::getPropertyState( const OUString& PropertyName )
     950             :     throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     951             : {
     952        1220 :     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        2112 : beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara)
     960             :     throw( beans::UnknownPropertyException, uno::RuntimeException )
     961             : {
     962        2112 :     if ( pMap )
     963             :     {
     964        2112 :         SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
     965        2112 :         if( pForwarder )
     966             :         {
     967        2112 :             SfxItemState eItemState = SfxItemState::UNKNOWN;
     968        2112 :             sal_uInt16 nWID = 0;
     969             : 
     970        2112 :             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           0 :                 eItemState = SfxItemState::SET;
    1019           0 :                 break;
    1020             : 
    1021             :             default:
    1022        2112 :                 nWID = pMap->nWID;
    1023             :             }
    1024             : 
    1025        2112 :             if( nWID != 0 )
    1026             :             {
    1027        2112 :                 if( nPara != -1 )
    1028         892 :                     eItemState = pForwarder->GetItemState( nPara, nWID );
    1029             :                 else
    1030        1220 :                     eItemState = pForwarder->GetItemState( GetSelection(), nWID );
    1031             :             }
    1032             : 
    1033        2112 :             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         480 :                 return beans::PropertyState_DIRECT_VALUE;
    1041             :             case SfxItemState::DEFAULT:
    1042        1632 :                 return beans::PropertyState_DEFAULT_VALUE;
    1043           0 :             default: break;
    1044             : //              case SfxItemState::UNKNOWN:
    1045             :             }
    1046             :         }
    1047             :     }
    1048           0 :     throw beans::UnknownPropertyException();
    1049             : }
    1050             : 
    1051        2112 : beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
    1052             :     throw( beans::UnknownPropertyException, uno::RuntimeException )
    1053             : {
    1054        2112 :     SolarMutexGuard aGuard;
    1055             : 
    1056        2112 :     return _getPropertyState( mpPropSet->getPropertyMapEntry( PropertyName ), nPara);
    1057             : }
    1058             : 
    1059        2966 : uno::Sequence< beans::PropertyState > SAL_CALL SvxUnoTextRangeBase::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
    1060             :     throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    1061             : {
    1062        2966 :     return _getPropertyStates( aPropertyName, -1 );
    1063             : }
    1064             : 
    1065        3326 : uno::Sequence< beans::PropertyState > SvxUnoTextRangeBase::_getPropertyStates(const uno::Sequence< OUString >& PropertyName, sal_Int32 nPara /* = -1 */)
    1066             :     throw( beans::UnknownPropertyException, uno::RuntimeException )
    1067             : {
    1068        3326 :     const sal_Int32 nCount = PropertyName.getLength();
    1069        3326 :     const OUString* pNames = PropertyName.getConstArray();
    1070             : 
    1071        3326 :     uno::Sequence< beans::PropertyState > aRet( nCount );
    1072        3326 :     beans::PropertyState* pState = aRet.getArray();
    1073             : 
    1074        3326 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1075        3326 :     if( pForwarder )
    1076             :     {
    1077        3326 :         SfxItemSet* pSet = NULL;
    1078        3326 :         if( nPara != -1 )
    1079             :         {
    1080         360 :             pSet = new SfxItemSet( pForwarder->GetParaAttribs( nPara ) );
    1081             :         }
    1082             :         else
    1083             :         {
    1084        2966 :             ESelection aSel( GetSelection() );
    1085        2966 :             CheckSelection( aSel, pForwarder );
    1086        2966 :             pSet = new SfxItemSet( pForwarder->GetAttribs( aSel, EditEngineAttribs_OnlyHard ) );
    1087             :         }
    1088             : 
    1089        3326 :         bool bUnknownPropertyFound = false;
    1090      176390 :         for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
    1091             :         {
    1092      173064 :             const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pNames++ );
    1093      173064 :             if( NULL == pMap )
    1094             :             {
    1095           0 :                 bUnknownPropertyFound = true;
    1096           0 :                 break;
    1097             :             }
    1098      173064 :             bUnknownPropertyFound = !_getOnePropertyStates(pSet, pMap, *pState++);
    1099             :         }
    1100             : 
    1101        3326 :         delete pSet;
    1102             : 
    1103        3326 :         if( bUnknownPropertyFound )
    1104           0 :             throw beans::UnknownPropertyException();
    1105             :     }
    1106             : 
    1107        3326 :     return aRet;
    1108             : }
    1109             : 
    1110      173064 : bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertySimpleEntry* pMap, beans::PropertyState& rState)
    1111             : {
    1112      173064 :     bool bUnknownPropertyFound = false;
    1113      173064 :     if(pSet && pMap)
    1114             :     {
    1115      173064 :         SfxItemState eItemState = SfxItemState::UNKNOWN;
    1116      173064 :         sal_uInt16 nWID = 0;
    1117             : 
    1118      173064 :         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      173064 :                 nWID = pMap->nWID;
    1169             :         }
    1170             : 
    1171      173064 :         if( bUnknownPropertyFound )
    1172           0 :             return !bUnknownPropertyFound;
    1173             : 
    1174      173064 :         if( nWID != 0 )
    1175      173064 :             eItemState = pSet->GetItemState( nWID, false );
    1176             : 
    1177      173064 :         switch( eItemState )
    1178             :         {
    1179             :                 case SfxItemState::READONLY:
    1180             :                 case SfxItemState::SET:
    1181        1510 :                     rState = beans::PropertyState_DIRECT_VALUE;
    1182        1510 :                     break;
    1183             :                 case SfxItemState::DEFAULT:
    1184      171554 :                     rState = beans::PropertyState_DEFAULT_VALUE;
    1185      171554 :                     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      173064 :     return !bUnknownPropertyFound;
    1194             : }
    1195             : 
    1196           8 : void SAL_CALL SvxUnoTextRangeBase::setPropertyToDefault( const OUString& PropertyName )
    1197             :     throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    1198             : {
    1199           8 :     _setPropertyToDefault( PropertyName, -1 );
    1200           8 : }
    1201             : 
    1202          10 : void SvxUnoTextRangeBase::_setPropertyToDefault(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
    1203             :     throw( beans::UnknownPropertyException, uno::RuntimeException )
    1204             : {
    1205          10 :     SolarMutexGuard aGuard;
    1206             : 
    1207          10 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1208             : 
    1209          10 :     if( pForwarder )
    1210             :     {
    1211          10 :         const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( PropertyName );
    1212          10 :         if ( pMap )
    1213             :         {
    1214          10 :             CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
    1215          10 :             _setPropertyToDefault( pForwarder, pMap, nPara );
    1216          20 :             return;
    1217             :         }
    1218             :     }
    1219             : 
    1220           0 :     throw beans::UnknownPropertyException();
    1221             : }
    1222             : 
    1223          10 : void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara )
    1224             :     throw( beans::UnknownPropertyException, uno::RuntimeException )
    1225             : {
    1226             :     do
    1227             :     {
    1228          10 :         SfxItemSet aSet( *pForwarder->GetPool(), true );
    1229             : 
    1230          10 :         if( pMap->nWID == WID_FONTDESC )
    1231             :         {
    1232           0 :             SvxUnoFontDescriptor::setPropertyToDefault( aSet );
    1233             :         }
    1234          10 :         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          10 :         else if( pMap->nWID == WID_NUMBERINGSTARTVALUE )
    1241             :         {
    1242           0 :             pForwarder->SetNumberingStartValue( maSelection.nStartPara, -1 );
    1243             :         }
    1244          10 :         else if( pMap->nWID == WID_PARAISNUMBERINGRESTART )
    1245             :         {
    1246           0 :             pForwarder->SetParaIsNumberingRestart( maSelection.nStartPara, false );
    1247             :         }
    1248             :         else
    1249             :         {
    1250          10 :             aSet.InvalidateItem( pMap->nWID );
    1251             :         }
    1252             : 
    1253          10 :         if(nPara != -1)
    1254           2 :             pForwarder->SetParaAttribs( nPara, aSet );
    1255             :         else
    1256           8 :             pForwarder->QuickSetAttribs( aSet, GetSelection() );
    1257             : 
    1258          10 :         GetEditSource()->UpdateData();
    1259             : 
    1260          10 :         return;
    1261             :     }
    1262             :     while(false);
    1263             : }
    1264             : 
    1265          10 : uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aPropertyName )
    1266             :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    1267             : {
    1268          10 :     SolarMutexGuard aGuard;
    1269             : 
    1270          10 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1271          10 :     if( pForwarder )
    1272             :     {
    1273          10 :         const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( aPropertyName );
    1274          10 :         if( pMap )
    1275             :         {
    1276          10 :             SfxItemPool* pPool = pForwarder->GetPool();
    1277             : 
    1278          10 :             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          10 :                     if(SfxItemPool::IsWhich(pMap->nWID))
    1299             :                     {
    1300          10 :                         SfxItemSet aSet( *pPool,    pMap->nWID, pMap->nWID);
    1301          10 :                         aSet.Put(pPool->GetDefaultItem(pMap->nWID));
    1302          10 :                         return mpPropSet->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       32177 : void SvxUnoTextRangeBase::CollapseToStart(void) throw()
    1356             : {
    1357       32177 :     CheckSelection( maSelection, mpEditSource );
    1358             : 
    1359       32177 :     maSelection.nEndPara = maSelection.nStartPara;
    1360       32177 :     maSelection.nEndPos  = maSelection.nStartPos;
    1361       32177 : }
    1362             : 
    1363       23090 : void SvxUnoTextRangeBase::CollapseToEnd(void) throw()
    1364             : {
    1365       23090 :     CheckSelection( maSelection, mpEditSource );
    1366             : 
    1367       23090 :     maSelection.nStartPara = maSelection.nEndPara;
    1368       23090 :     maSelection.nStartPos  = maSelection.nEndPos;
    1369       23090 : }
    1370             : 
    1371         244 : bool SvxUnoTextRangeBase::IsCollapsed(void) throw()
    1372             : {
    1373         244 :     CheckSelection( maSelection, mpEditSource );
    1374             : 
    1375         488 :     return ( maSelection.nStartPara == maSelection.nEndPara &&
    1376         488 :              maSelection.nStartPos  == maSelection.nEndPos );
    1377             : }
    1378             : 
    1379        4764 : bool SvxUnoTextRangeBase::GoLeft(sal_Int16 nCount, bool Expand) throw()
    1380             : {
    1381        4764 :     CheckSelection( maSelection, mpEditSource );
    1382             : 
    1383             :     //  #75098# use end position, as in Writer (start is anchor, end is cursor)
    1384        4764 :     sal_uInt16 nNewPos = maSelection.nEndPos;
    1385        4764 :     sal_Int32  nNewPar = maSelection.nEndPara;
    1386             : 
    1387        4764 :     bool bOk = true;
    1388        4764 :     SvxTextForwarder* pForwarder = NULL;
    1389       14194 :     while ( nCount > nNewPos && bOk )
    1390             :     {
    1391        4666 :         if ( nNewPar == 0 )
    1392        1140 :             bOk = false;
    1393             :         else
    1394             :         {
    1395        3526 :             if ( !pForwarder )
    1396        3526 :                 pForwarder = mpEditSource->GetTextForwarder();  // first here, it it is necessary...
    1397             : 
    1398        3526 :             --nNewPar;
    1399        3526 :             nCount -= nNewPos + 1;
    1400        3526 :             nNewPos = pForwarder->GetTextLen( nNewPar );
    1401             :         }
    1402             :     }
    1403             : 
    1404        4764 :     if ( bOk )
    1405             :     {
    1406        3624 :         nNewPos = nNewPos - nCount;
    1407        3624 :         maSelection.nStartPara = nNewPar;
    1408        3624 :         maSelection.nStartPos  = nNewPos;
    1409             :     }
    1410             : 
    1411        4764 :     if (!Expand)
    1412          10 :         CollapseToStart();
    1413             : 
    1414        4764 :     return bOk;
    1415             : }
    1416             : 
    1417       27311 : bool SvxUnoTextRangeBase::GoRight(sal_Int16 nCount, bool Expand)  throw()
    1418             : {
    1419       27311 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1420       27311 :     if( pForwarder )
    1421             :     {
    1422       27311 :         CheckSelection( maSelection, pForwarder );
    1423             : 
    1424       27311 :         sal_Int32 nNewPos = maSelection.nEndPos + nCount; //! Overflow???
    1425       27311 :         sal_Int32  nNewPar = maSelection.nEndPara;
    1426             : 
    1427       27311 :         bool bOk = true;
    1428       27311 :         sal_Int32 nParCount = pForwarder->GetParagraphCount();
    1429       27311 :         sal_Int32 nThisLen = pForwarder->GetTextLen( nNewPar );
    1430       60216 :         while ( nNewPos > nThisLen && bOk )
    1431             :         {
    1432        5594 :             if ( nNewPar + 1 >= nParCount )
    1433           6 :                 bOk = false;
    1434             :             else
    1435             :             {
    1436        5588 :                 nNewPos -= nThisLen+1;
    1437        5588 :                 ++nNewPar;
    1438        5588 :                 nThisLen = pForwarder->GetTextLen( nNewPar );
    1439             :             }
    1440             :         }
    1441             : 
    1442       27311 :         if (bOk)
    1443             :         {
    1444       27305 :             maSelection.nEndPara = nNewPar;
    1445       27305 :             maSelection.nEndPos  = nNewPos;
    1446             :         }
    1447             : 
    1448       27311 :         if (!Expand)
    1449          10 :             CollapseToEnd();
    1450             : 
    1451       27311 :         return bOk;
    1452             :     }
    1453           0 :     return false;
    1454             : }
    1455             : 
    1456         142 : void SvxUnoTextRangeBase::GotoStart(bool Expand) throw()
    1457             : {
    1458         142 :     maSelection.nStartPara = 0;
    1459         142 :     maSelection.nStartPos  = 0;
    1460             : 
    1461         142 :     if (!Expand)
    1462          54 :         CollapseToStart();
    1463         142 : }
    1464             : 
    1465        7802 : void SvxUnoTextRangeBase::GotoEnd(bool Expand) throw()
    1466             : {
    1467        7802 :     CheckSelection( maSelection, mpEditSource );
    1468             : 
    1469        7802 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    1470        7802 :     if( pForwarder )
    1471             :     {
    1472             : 
    1473        7802 :         sal_Int32 nPar = pForwarder->GetParagraphCount();
    1474        7802 :         if (nPar)
    1475        7802 :             --nPar;
    1476             : 
    1477        7802 :         maSelection.nEndPara = nPar;
    1478        7802 :         maSelection.nEndPos  = pForwarder->GetTextLen( nPar );
    1479             : 
    1480        7802 :         if (!Expand)
    1481        4076 :             CollapseToEnd();
    1482             :     }
    1483        7802 : }
    1484             : 
    1485             : // lang::XServiceInfo
    1486        1942 : sal_Bool SAL_CALL SvxUnoTextRangeBase::supportsService( const OUString& ServiceName )
    1487             :     throw(uno::RuntimeException, std::exception)
    1488             : {
    1489        1942 :     return cppu::supportsService( this, ServiceName );
    1490             : }
    1491             : 
    1492        1972 : uno::Sequence< OUString > SAL_CALL SvxUnoTextRangeBase::getSupportedServiceNames()
    1493             :     throw(uno::RuntimeException, std::exception)
    1494             : {
    1495        1972 :     return getSupportedServiceNames_Static();
    1496             : }
    1497             : 
    1498        2076 : uno::Sequence< OUString > SAL_CALL SvxUnoTextRangeBase::getSupportedServiceNames_Static()
    1499             : {
    1500        2076 :     uno::Sequence< OUString > aSeq(3);
    1501        2076 :     aSeq[0] = "com.sun.star.style.CharacterProperties";
    1502        2076 :     aSeq[1] = "com.sun.star.style.CharacterPropertiesComplex";
    1503        2076 :     aSeq[2] = "com.sun.star.style.CharacterPropertiesAsian";
    1504        2076 :     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       17008 : SvxUnoTextRange::SvxUnoTextRange( const SvxUnoTextBase& rParent, bool bPortion /* = false */ ) throw()
    1557       30076 : :SvxUnoTextRangeBase( rParent.GetEditSource(), bPortion ? ImplGetSvxTextPortionSvxPropertySet() : rParent.getPropertySet() ),
    1558       47084 :  mbPortion( bPortion )
    1559             : {
    1560       17008 :     xParentText =  (text::XText*)&rParent;
    1561       17008 : }
    1562             : 
    1563       34016 : SvxUnoTextRange::~SvxUnoTextRange() throw()
    1564             : {
    1565       34016 : }
    1566             : 
    1567       32674 : uno::Any SAL_CALL SvxUnoTextRange::queryAggregation( const uno::Type & rType )
    1568             :     throw(uno::RuntimeException, std::exception)
    1569             : {
    1570       32674 :     QUERYINT( text::XTextRange );
    1571       29642 :     else if( rType == cppu::UnoType<beans::XMultiPropertyStates>::get())
    1572           0 :         return uno::makeAny(uno::Reference< beans::XMultiPropertyStates >(this));
    1573       29642 :     else if( rType == cppu::UnoType<beans::XPropertySet>::get())
    1574        8364 :         return uno::makeAny(uno::Reference< beans::XPropertySet >(this));
    1575       21278 :     else QUERYINT( beans::XPropertyState );
    1576       18076 :     else QUERYINT( text::XTextRangeCompare );
    1577       18076 :     else if( rType == cppu::UnoType<beans::XMultiPropertySet>::get())
    1578        2958 :         return uno::makeAny(uno::Reference< beans::XMultiPropertySet >(this));
    1579       15118 :     else QUERYINT( lang::XServiceInfo );
    1580       15112 :     else QUERYINT( lang::XTypeProvider );
    1581       15112 :     else QUERYINT( lang::XUnoTunnel );
    1582             :     else
    1583        3004 :         return OWeakAggObject::queryAggregation( rType );
    1584             : }
    1585             : 
    1586       32674 : uno::Any SAL_CALL SvxUnoTextRange::queryInterface( const uno::Type & rType )
    1587             :     throw(uno::RuntimeException, std::exception)
    1588             : {
    1589       32674 :     return OWeakAggObject::queryInterface(rType);
    1590             : }
    1591             : 
    1592      101112 : void SAL_CALL SvxUnoTextRange::acquire()
    1593             :     throw( )
    1594             : {
    1595      101112 :     OWeakAggObject::acquire();
    1596      101112 : }
    1597             : 
    1598      101112 : void SAL_CALL SvxUnoTextRange::release()
    1599             :     throw( )
    1600             : {
    1601      101112 :     OWeakAggObject::release();
    1602      101112 : }
    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           4 : uno::Reference< text::XText > SAL_CALL SvxUnoTextRange::getText()
    1647             :     throw(uno::RuntimeException, std::exception)
    1648             : {
    1649           4 :     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       87500 : SvxUnoTextBase::SvxUnoTextBase( const SvxItemPropertySet* _pSet  ) throw()
    1664       87500 : : SvxUnoTextRangeBase( _pSet )
    1665             : {
    1666       87500 : }
    1667             : 
    1668        3494 : SvxUnoTextBase::SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, uno::Reference < text::XText > xParent ) throw()
    1669        3494 : : SvxUnoTextRangeBase( pSource, _pSet )
    1670             : {
    1671        3494 :     xParentText = xParent;
    1672        3494 :     ESelection aSelection;
    1673        3494 :     ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
    1674        3494 :     SetSelection( aSelection );
    1675        3494 : }
    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       90720 : SvxUnoTextBase::~SvxUnoTextBase() throw()
    1689             : {
    1690       90720 : }
    1691             : 
    1692             : // XInterface
    1693       72678 : uno::Any SAL_CALL SvxUnoTextBase::queryAggregation( const uno::Type & rType )
    1694             :     throw(uno::RuntimeException, std::exception)
    1695             : {
    1696       72678 :     QUERYINT( text::XText );
    1697       65028 :     QUERYINT( text::XSimpleText );
    1698       63850 :     if( rType == cppu::UnoType<text::XTextRange>::get())
    1699       14967 :         return uno::makeAny(uno::Reference< text::XTextRange >((text::XText*)(this)));
    1700       48883 :     QUERYINT(container::XEnumerationAccess );
    1701       47205 :     QUERYINT( container::XElementAccess );
    1702       47203 :     QUERYINT( beans::XMultiPropertyStates );
    1703       47203 :     QUERYINT( beans::XPropertySet );
    1704       42897 :     QUERYINT( beans::XMultiPropertySet );
    1705       42017 :     QUERYINT( beans::XPropertyState );
    1706       41805 :     QUERYINT( text::XTextRangeCompare );
    1707       41805 :     QUERYINT( lang::XServiceInfo );
    1708       41701 :     QUERYINT( text::XTextRangeMover );
    1709       41701 :     QUERYINT( text::XTextCopy );
    1710       41701 :     QUERYINT( text::XTextAppend );
    1711       39887 :     QUERYINT( text::XParagraphAppend );
    1712       39887 :     QUERYINT( text::XTextPortionAppend );
    1713       39887 :     QUERYINT( lang::XTypeProvider );
    1714       39887 :     QUERYINT( lang::XUnoTunnel );
    1715             : 
    1716       39305 :     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        4621 : uno::Reference< text::XTextCursor > SvxUnoTextBase::createTextCursorBySelection( const ESelection& rSel )
    1771             : {
    1772        4621 :     SvxUnoTextCursor* pCursor = new SvxUnoTextCursor( *this );
    1773        4621 :     uno::Reference< text::XTextCursor >  xCursor( pCursor );
    1774        4621 :     pCursor->SetSelection( rSel );
    1775        4621 :     return xCursor;
    1776             : }
    1777             : 
    1778             : // XSimpleText
    1779             : 
    1780        5326 : uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursor()
    1781             :     throw(uno::RuntimeException, std::exception)
    1782             : {
    1783        5326 :     SolarMutexGuard aGuard;
    1784        5326 :     return new SvxUnoTextCursor( *this );
    1785             : }
    1786             : 
    1787        4621 : uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursorByRange( const uno::Reference< text::XTextRange >& aTextPosition )
    1788             :     throw(uno::RuntimeException, std::exception)
    1789             : {
    1790        4621 :     SolarMutexGuard aGuard;
    1791             : 
    1792        4621 :     uno::Reference< text::XTextCursor >  xCursor;
    1793             : 
    1794        4621 :     if( aTextPosition.is() )
    1795             :     {
    1796        4621 :         SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( aTextPosition );
    1797        4621 :         if(pRange)
    1798        4621 :             xCursor = createTextCursorBySelection( pRange->GetSelection() );
    1799             :     }
    1800             : 
    1801        4621 :     return xCursor;
    1802             : }
    1803             : 
    1804       10232 : 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       10232 :     SolarMutexGuard aGuard;
    1808             : 
    1809       10232 :     if( !xRange.is() )
    1810       10232 :         return;
    1811             : 
    1812       10232 :     ESelection aSelection;
    1813       10232 :     if (GetEditSource())
    1814             :     {
    1815       10232 :         ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
    1816       10232 :         SetSelection( aSelection );
    1817             :     }
    1818             : 
    1819       10232 :     SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
    1820       10232 :     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       10232 :         if (!bAbsorb)                   // do not replace -> append on tail
    1828        8766 :             pRange->CollapseToEnd();
    1829             : 
    1830       10232 :         pRange->setString( aString );
    1831             : 
    1832       10232 :         pRange->CollapseToEnd();
    1833       10232 :     }
    1834             : }
    1835             : 
    1836        5426 : 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        5426 :     SolarMutexGuard aGuard;
    1840             : 
    1841        5426 :     SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
    1842             : 
    1843        5426 :     if( pForwarder )
    1844             :     {
    1845        5426 :         ESelection aSelection;
    1846        5426 :         ::GetSelection( aSelection, pForwarder );
    1847        5426 :         SetSelection( aSelection );
    1848             : 
    1849        5426 :         switch( nControlCharacter )
    1850             :         {
    1851             :         case text::ControlCharacter::PARAGRAPH_BREAK:
    1852             :         {
    1853         108 :             const OUString aText( (sal_Unicode)13 );  // '\r' does not work on Mac
    1854         108 :             insertString( xRange, aText, bAbsorb );
    1855             : 
    1856         108 :             return;
    1857             :         }
    1858             :         case text::ControlCharacter::LINE_BREAK:
    1859             :         {
    1860          78 :             SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
    1861          78 :             if(pRange)
    1862             :             {
    1863          78 :                 ESelection aRange = pRange->GetSelection();
    1864             : 
    1865          78 :                 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          78 :                     aRange.nStartPara = aRange.nEndPara;
    1876          78 :                     aRange.nStartPos = aRange.nEndPos;
    1877             :                 }
    1878             : 
    1879          78 :                 pForwarder->QuickInsertLineBreak( aRange );
    1880          78 :                 GetEditSource()->UpdateData();
    1881             : 
    1882          78 :                 aRange.nEndPos += 1;
    1883          78 :                 if( !bAbsorb )
    1884          78 :                     aRange.nStartPos += 1;
    1885             : 
    1886          78 :                 pRange->SetSelection( aRange );
    1887             :             }
    1888          78 :             return;
    1889             :         }
    1890             :         case text::ControlCharacter::APPEND_PARAGRAPH:
    1891             :         {
    1892        5240 :             SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
    1893        5240 :             if(pRange)
    1894             :             {
    1895        5240 :                 ESelection aRange = pRange->GetSelection();
    1896             : //              ESelection aOldSelection = aRange;
    1897             : 
    1898        5240 :                 aRange.nStartPos  = pForwarder->GetTextLen( aRange.nStartPara );
    1899             : 
    1900        5240 :                 aRange.nEndPara = aRange.nStartPara;
    1901        5240 :                 aRange.nEndPos  = aRange.nStartPos;
    1902             : 
    1903        5240 :                 pRange->SetSelection( aRange );
    1904        5240 :                 const OUString aText( (sal_Unicode)13 );  // '\r' geht auf'm Mac nicht
    1905        5240 :                 pRange->setString( aText );
    1906             : 
    1907        5240 :                 aRange.nStartPos = 0;
    1908        5240 :                 aRange.nStartPara += 1;
    1909        5240 :                 aRange.nEndPos = 0;
    1910        5240 :                 aRange.nEndPara += 1;
    1911             : 
    1912        5240 :                 pRange->SetSelection( aRange );
    1913             : 
    1914        5240 :                 return;
    1915             :             }
    1916             :         }
    1917             :         default:
    1918           0 :             throw lang::IllegalArgumentException();
    1919             :         }
    1920           0 :     }
    1921             : }
    1922             : 
    1923             : // XText
    1924         522 : 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         522 :     SolarMutexGuard aGuard;
    1928             : 
    1929         522 :     SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
    1930         522 :     if (!pForwarder)
    1931         510 :         return;
    1932             : 
    1933        1044 :     uno::Reference<beans::XPropertySet> xPropSet(xRange, uno::UNO_QUERY);
    1934         522 :     if (!xPropSet.is())
    1935           2 :         throw lang::IllegalArgumentException();
    1936             : 
    1937        1040 :     uno::Any aAny = xPropSet->getPropertyValue(UNO_TR_PROP_SELECTION);
    1938         520 :     text::TextRangeSelection aSel = aAny.get<text::TextRangeSelection>();
    1939         520 :     if (!bAbsorb)
    1940         520 :         aSel.Start = aSel.End;
    1941             : 
    1942        1040 :     boost::scoped_ptr<SvxFieldData> pFieldData(SvxFieldData::Create(xContent));
    1943         520 :     if (!pFieldData)
    1944          10 :         throw lang::IllegalArgumentException();
    1945             : 
    1946        1020 :     SvxFieldItem aField( *pFieldData, EE_FEATURE_FIELD );
    1947         510 :     pForwarder->QuickInsertField(aField, toESelection(aSel));
    1948         510 :     GetEditSource()->UpdateData();
    1949             : 
    1950        1020 :     uno::Reference<beans::XPropertySet> xPropSetContent(xContent, uno::UNO_QUERY);
    1951         510 :     if (!xContent.is())
    1952           0 :         throw lang::IllegalArgumentException();
    1953             : 
    1954         510 :     xPropSetContent->setPropertyValue(UNO_TC_PROP_ANCHOR, uno::makeAny(xRange));
    1955             : 
    1956         510 :     aSel.End.PositionInParagraph += 1;
    1957         510 :     aSel.Start.PositionInParagraph = aSel.End.PositionInParagraph;
    1958        1032 :     xPropSet->setPropertyValue(UNO_TR_PROP_SELECTION, uno::makeAny(aSel));
    1959             : }
    1960             : 
    1961           4 : void SAL_CALL SvxUnoTextBase::removeTextContent( const uno::Reference< text::XTextContent >& ) throw(container::NoSuchElementException, uno::RuntimeException, std::exception)
    1962             : {
    1963           4 : }
    1964             : 
    1965             : // XTextRange
    1966             : 
    1967         124 : uno::Reference< text::XText > SAL_CALL SvxUnoTextBase::getText()
    1968             :     throw(uno::RuntimeException, std::exception)
    1969             : {
    1970         124 :     SolarMutexGuard aGuard;
    1971             : 
    1972         124 :     if (GetEditSource())
    1973             :     {
    1974         124 :         ESelection aSelection;
    1975         124 :         ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
    1976         124 :         ((SvxUnoTextBase*)this)->SetSelection( aSelection );
    1977             :     }
    1978             : 
    1979         124 :     return (text::XText*)this;
    1980             : }
    1981             : 
    1982          10 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::getStart()
    1983             :     throw(uno::RuntimeException, std::exception)
    1984             : {
    1985          10 :     return SvxUnoTextRangeBase::getStart();
    1986             : }
    1987             : 
    1988          54 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::getEnd()
    1989             :     throw(uno::RuntimeException, std::exception)
    1990             : {
    1991          54 :     return SvxUnoTextRangeBase::getEnd();
    1992             : }
    1993             : 
    1994        3032 : OUString SAL_CALL SvxUnoTextBase::getString() throw( uno::RuntimeException, std::exception )
    1995             : {
    1996        3032 :     return SvxUnoTextRangeBase::getString();
    1997             : }
    1998             : 
    1999       14409 : void SAL_CALL SvxUnoTextBase::setString( const OUString& aString ) throw(uno::RuntimeException, std::exception)
    2000             : {
    2001       14409 :     SvxUnoTextRangeBase::setString(aString);
    2002       14409 : }
    2003             : 
    2004             : 
    2005             : // XEnumerationAccess
    2006        2806 : uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextBase::createEnumeration()
    2007             :     throw(uno::RuntimeException, std::exception)
    2008             : {
    2009        2806 :     SolarMutexGuard aGuard;
    2010             : 
    2011        2806 :     ESelection aSelection;
    2012        2806 :     ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
    2013        2806 :     SetSelection( aSelection );
    2014             : 
    2015        2806 :     uno::Reference< container::XEnumeration > xEnum( (container::XEnumeration*) new SvxUnoTextContentEnumeration( *this ) );
    2016        2806 :     return xEnum;
    2017             : }
    2018             : 
    2019             : // XElementAccess ( container::XEnumerationAccess )
    2020           6 : uno::Type SAL_CALL SvxUnoTextBase::getElementType(  ) throw(uno::RuntimeException, std::exception)
    2021             : {
    2022           6 :     return cppu::UnoType<text::XTextRange>::get();
    2023             : }
    2024             : 
    2025          98 : sal_Bool SAL_CALL SvxUnoTextBase::hasElements(  ) throw(uno::RuntimeException, std::exception)
    2026             : {
    2027          98 :     SolarMutexGuard aGuard;
    2028             : 
    2029          98 :     if(GetEditSource())
    2030             :     {
    2031          98 :         SvxTextForwarder* pForwarder = GetEditSource()->GetTextForwarder();
    2032          98 :         if(pForwarder)
    2033          98 :             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         968 : 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         968 :     sal_Int32 nProps = rPropertyVaules.getLength();
    2054         968 :     const beans::PropertyValue *pProps = rPropertyVaules.getConstArray();
    2055        2330 :     for (sal_Int32 i = 0;  i < nProps;  ++i)
    2056             :     {
    2057        1420 :         const SfxItemPropertySimpleEntry *pEntry = pPropSet->getPropertyMap().getByName( pProps[i].Name );
    2058        1420 :         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        1362 :             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        1362 :             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        1362 :             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        1362 :             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        1362 :             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        1362 :                 pPropSet->setPropertyValue( pProps[i].Name, pProps[i].Value, rItemSet );
    2112             :         }
    2113             :         else
    2114          58 :             throw beans::UnknownPropertyException( "Unknown property: " + pProps[i].Name, static_cast < cppu::OWeakObject * > ( 0 ) );
    2115             :     }
    2116         910 : }
    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          58 : 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          58 :     SolarMutexGuard aGuard;
    2132             : 
    2133          58 :     uno::Reference< text::XTextRange > xRet;
    2134          58 :     SvxEditSource *pEditSource = GetEditSource();
    2135          58 :     SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
    2136          58 :     if (pTextForwarder)
    2137             :     {
    2138          58 :         sal_Int32 nParaCount = pTextForwarder->GetParagraphCount();
    2139             :         DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
    2140          58 :         pTextForwarder->AppendParagraph();
    2141             : 
    2142             :         // set properties for the previously last paragraph
    2143          58 :         sal_Int32 nPara = nParaCount - 1;
    2144          58 :         ESelection aSel( nPara, 0, nPara, 0 );
    2145          58 :         SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
    2146             :         SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
    2147          58 :                 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          58 :         pRange->SetSelection( aSel );
    2153             :     }
    2154          58 :     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         910 : 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         910 :     SolarMutexGuard aGuard;
    2174             : 
    2175         910 :     SvxEditSource *pEditSource = GetEditSource();
    2176         910 :     SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
    2177         910 :     uno::Reference< text::XTextRange > xRet;
    2178         910 :     if (pTextForwarder)
    2179             :     {
    2180         910 :         sal_Int32 nParaCount = pTextForwarder->GetParagraphCount();
    2181             :         DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
    2182         910 :         sal_Int32 nPara = nParaCount - 1;
    2183         910 :         SfxItemSet aSet( pTextForwarder->GetParaAttribs( nPara ) );
    2184         910 :         sal_Int32 nStart = pTextForwarder->AppendTextPortion( nPara, rText, aSet );
    2185         910 :         pEditSource->UpdateData();
    2186         910 :         sal_Int32 nEnd   = pTextForwarder->GetTextLen( nPara );
    2187             : 
    2188             :         // set properties for the new text portion
    2189         910 :         ESelection aSel( nPara, nStart, nPara, nEnd );
    2190         910 :         pTextForwarder->RemoveAttribs( aSel, false, 0 );
    2191         910 :         pEditSource->UpdateData();
    2192             : 
    2193        1820 :         SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
    2194             :         SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
    2195         910 :                 ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, nPara );
    2196         910 :         pTextForwarder->QuickSetAttribs( aItemSet, aSel );
    2197         910 :         SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
    2198         910 :         xRet = pRange;
    2199         910 :         pRange->SetSelection( aSel );
    2200         910 :         const beans::PropertyValue* pProps = rCharAndParaProps.getConstArray();
    2201        2264 :         for( sal_Int32 nProp = 0; nProp < rCharAndParaProps.getLength(); ++nProp )
    2202        2264 :             pRange->setPropertyValue( pProps[nProp].Name, pProps[nProp].Value );
    2203             :     }
    2204         910 :     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         104 : uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames(  )
    2246             :     throw(uno::RuntimeException, std::exception)
    2247             : {
    2248         104 :     return getSupportedServiceNames_Static();
    2249             : }
    2250             : 
    2251         104 : uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames_Static(  )
    2252             : {
    2253         104 :     uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames_Static() );
    2254         104 :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.text.Text" );
    2255         104 :     return aSeq;
    2256             : }
    2257             : 
    2258             : namespace
    2259             : {
    2260             :     class theSvxUnoTextBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextBaseUnoTunnelId > {};
    2261             : }
    2262             : 
    2263       60132 : const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() throw()
    2264             : {
    2265       60132 :     return theSvxUnoTextBaseUnoTunnelId::get().getSeq();
    2266             : }
    2267             : 
    2268       13030 : SvxUnoTextBase* SvxUnoTextBase::getImplementation( const uno::Reference< uno::XInterface >& xInt )
    2269             : {
    2270       13030 :     uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
    2271       13030 :     if( xUT.is() )
    2272       13030 :         return reinterpret_cast<SvxUnoTextBase*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxUnoTextBase::getUnoTunnelId())));
    2273             :     else
    2274           0 :         return NULL;
    2275             : }
    2276             : 
    2277       47102 : sal_Int64 SAL_CALL SvxUnoTextBase::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException, std::exception) \
    2278             : {
    2279      141306 :     if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(),
    2280       94204 :                                                          rId.getConstArray(), 16 ) )
    2281             :     {
    2282       12986 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
    2283             :     }
    2284             :     else
    2285             :     {
    2286       34116 :         return SvxUnoTextRangeBase::getSomething( rId );
    2287             :     }
    2288             : }
    2289             : 
    2290         212 : SvxUnoText::SvxUnoText( const SvxItemPropertySet* _pSet ) throw()
    2291         212 : : SvxUnoTextBase( _pSet )
    2292             : {
    2293         212 : }
    2294             : 
    2295        3494 : SvxUnoText::SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, uno::Reference < text::XText > xParent ) throw()
    2296        3494 : : SvxUnoTextBase( pSource, _pSet, xParent )
    2297             : {
    2298        3494 : }
    2299             : 
    2300           0 : SvxUnoText::SvxUnoText( const SvxUnoText& rText ) throw()
    2301             : : SvxUnoTextBase( rText )
    2302           0 : , cppu::OWeakAggObject()
    2303             : {
    2304           0 : }
    2305             : 
    2306        7042 : SvxUnoText::~SvxUnoText() throw()
    2307             : {
    2308        7042 : }
    2309             : 
    2310             : // uno::XInterface
    2311        3588 : uno::Any SAL_CALL SvxUnoText::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException, std::exception )
    2312             : {
    2313        3588 :     uno::Any aAny( SvxUnoTextBase::queryAggregation( rType ) );
    2314        3588 :     if( !aAny.hasValue() )
    2315        2162 :         aAny = OWeakAggObject::queryAggregation( rType );
    2316             : 
    2317        3588 :     return aAny;
    2318             : }
    2319             : 
    2320        1530 : uno::Any SAL_CALL SvxUnoText::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException, std::exception )
    2321             : {
    2322        1530 :     return OWeakAggObject::queryInterface( rType );
    2323             : }
    2324             : 
    2325       24884 : void SAL_CALL SvxUnoText::acquire() throw( )
    2326             : {
    2327       24884 :     OWeakAggObject::acquire();
    2328       24884 : }
    2329             : 
    2330       24820 : void SAL_CALL SvxUnoText::release() throw( )
    2331             : {
    2332       24820 :     OWeakAggObject::release();
    2333       24820 : }
    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         534 : const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() throw()
    2352             : {
    2353         534 :     return theSvxUnoTextUnoTunnelId::get().getSeq();
    2354             : }
    2355             : 
    2356         534 : sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException, std::exception) \
    2357             : {
    2358        1602 :     if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(),
    2359        1068 :                                                          rId.getConstArray(), 16 ) )
    2360             :     {
    2361           0 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
    2362             :     }
    2363             :     else
    2364             :     {
    2365         534 :         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 : void SvxDummyTextSource::SetNotifyHdl( const Link& )
    2476             : {
    2477           0 : }
    2478             : 
    2479           0 : LanguageType SvxDummyTextSource::GetLanguage( sal_Int32, sal_Int32 ) const
    2480             : {
    2481           0 :     return LANGUAGE_DONTKNOW;
    2482             : }
    2483             : 
    2484           0 : sal_Int32 SvxDummyTextSource::GetFieldCount( sal_Int32 ) const
    2485             : {
    2486           0 :     return 0;
    2487             : }
    2488             : 
    2489           0 : EFieldInfo SvxDummyTextSource::GetFieldInfo( sal_Int32, sal_uInt16 ) const
    2490             : {
    2491           0 :     return EFieldInfo();
    2492             : }
    2493             : 
    2494           0 : EBulletInfo SvxDummyTextSource::GetBulletInfo( sal_Int32 ) const
    2495             : {
    2496           0 :     return EBulletInfo();
    2497             : }
    2498             : 
    2499           0 : Rectangle SvxDummyTextSource::GetCharBounds( sal_Int32, sal_Int32 ) const
    2500             : {
    2501           0 :     return Rectangle();
    2502             : }
    2503             : 
    2504           0 : Rectangle SvxDummyTextSource::GetParaBounds( sal_Int32 ) const
    2505             : {
    2506           0 :     return Rectangle();
    2507             : }
    2508             : 
    2509           0 : MapMode SvxDummyTextSource::GetMapMode() const
    2510             : {
    2511           0 :     return MapMode();
    2512             : }
    2513             : 
    2514           0 : OutputDevice* SvxDummyTextSource::GetRefDevice() const
    2515             : {
    2516           0 :     return NULL;
    2517             : }
    2518             : 
    2519           0 : bool SvxDummyTextSource::GetIndexAtPoint( const Point&, sal_Int32&, sal_Int32& ) const
    2520             : {
    2521           0 :     return false;
    2522             : }
    2523             : 
    2524           0 : bool SvxDummyTextSource::GetWordIndices( sal_Int32, sal_Int32, sal_Int32&, sal_Int32& ) const
    2525             : {
    2526           0 :     return false;
    2527             : }
    2528             : 
    2529           0 : bool SvxDummyTextSource::GetAttributeRun( sal_Int32&, sal_Int32&, sal_Int32, sal_Int32, bool ) const
    2530             : {
    2531           0 :     return false;
    2532             : }
    2533             : 
    2534           0 : sal_Int32 SvxDummyTextSource::GetLineCount( sal_Int32 ) const
    2535             : {
    2536           0 :     return 0;
    2537             : }
    2538             : 
    2539           0 : sal_Int32 SvxDummyTextSource::GetLineLen( sal_Int32, sal_Int32 ) const
    2540             : {
    2541           0 :     return 0;
    2542             : }
    2543             : 
    2544           0 : void SvxDummyTextSource::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 /*nParagraph*/, sal_Int32 /*nLine*/ ) const
    2545             : {
    2546           0 :     rStart = rEnd = 0;
    2547           0 : }
    2548             : 
    2549           0 : sal_Int32 SvxDummyTextSource::GetLineNumberAtIndex( sal_Int32 /*nPara*/, sal_Int32 /*nIndex*/ ) const
    2550             : {
    2551           0 :     return 0;
    2552             : }
    2553             : 
    2554           0 : bool SvxDummyTextSource::QuickFormatDoc( bool )
    2555             : {
    2556           0 :     return false;
    2557             : }
    2558             : 
    2559           0 : sal_Int16 SvxDummyTextSource::GetDepth( sal_Int32 ) const
    2560             : {
    2561           0 :     return -1;
    2562             : }
    2563             : 
    2564           0 : bool SvxDummyTextSource::SetDepth( sal_Int32, sal_Int16 nNewDepth )
    2565             : {
    2566           0 :     return nNewDepth == 0;
    2567             : }
    2568             : 
    2569           0 : bool SvxDummyTextSource::Delete( const ESelection& )
    2570             : {
    2571           0 :     return false;
    2572             : }
    2573             : 
    2574           0 : bool SvxDummyTextSource::InsertText( const OUString&, const ESelection& )
    2575             : {
    2576           0 :     return false;
    2577             : }
    2578             : 
    2579           0 : const SfxItemSet * SvxDummyTextSource::GetEmptyItemSetPtr()
    2580             : {
    2581           0 :     return 0;
    2582             : }
    2583             : 
    2584           0 : void SvxDummyTextSource::AppendParagraph()
    2585             : {
    2586           0 : }
    2587             : 
    2588           0 : sal_Int32 SvxDummyTextSource::AppendTextPortion( sal_Int32, const OUString &, const SfxItemSet & )
    2589             : {
    2590           0 :     return 0;
    2591             : }
    2592             : 
    2593           0 : void  SvxDummyTextSource::CopyText(const SvxTextForwarder& )
    2594             : {
    2595         669 : }
    2596             : 
    2597             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10