LCOV - code coverage report
Current view: top level - libreoffice/editeng/source/uno - unoforou.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 117 245 47.8 %
Date: 2012-12-27 Functions: 22 55 40.0 %
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             : 
      21             : #include <algorithm>
      22             : #include <svl/style.hxx>
      23             : #include <com/sun/star/i18n/WordType.hpp>
      24             : 
      25             : #include <svl/itemset.hxx>
      26             : #include <editeng/editeng.hxx>
      27             : #include <editeng/editdata.hxx>
      28             : #include <editeng/outliner.hxx>
      29             : #include <editeng/unoedhlp.hxx>
      30             : #include <svl/poolitem.hxx>
      31             : #include <vcl/wrkwin.hxx>
      32             : #include <editeng/eeitem.hxx>
      33             : 
      34             : #include <editeng/unoforou.hxx>
      35             : #include <editeng/unofored.hxx>
      36             : #include <editeng/outlobj.hxx>
      37             : 
      38             : using namespace ::com::sun::star;
      39             : 
      40             : //------------------------------------------------------------------------
      41             : 
      42        1143 : SvxOutlinerForwarder::SvxOutlinerForwarder( Outliner& rOutl, sal_Bool bOutlText /* = sal_False */ ) :
      43             :     rOutliner( rOutl ),
      44             :     bOutlinerText( bOutlText ),
      45             :     mpAttribsCache( NULL ),
      46             :     mpParaAttribsCache( NULL ),
      47        1143 :     mnParaAttribsCache( 0 )
      48             : {
      49        1143 : }
      50             : 
      51        3426 : SvxOutlinerForwarder::~SvxOutlinerForwarder()
      52             : {
      53        1142 :     flushCache();
      54        2284 : }
      55             : 
      56       13852 : sal_uInt16 SvxOutlinerForwarder::GetParagraphCount() const
      57             : {
      58       13852 :     return (sal_uInt16)rOutliner.GetParagraphCount();
      59             : }
      60             : 
      61       35109 : sal_uInt16 SvxOutlinerForwarder::GetTextLen( sal_uInt16 nParagraph ) const
      62             : {
      63       35109 :     return rOutliner.GetEditEngine().GetTextLen( nParagraph );
      64             : }
      65             : 
      66          83 : String SvxOutlinerForwarder::GetText( const ESelection& rSel ) const
      67             : {
      68             :     //! GetText (ESelection) should probably also be in the Outliner
      69             :     // in the time beeing use as the hack for the EditEngine:
      70          83 :     EditEngine* pEditEngine = (EditEngine*)&rOutliner.GetEditEngine();
      71          83 :     return pEditEngine->GetText( rSel, LINEEND_LF );
      72             : }
      73             : 
      74         385 : static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib, EditEngine& rEditEngine )
      75             : {
      76         385 :     if( rSel.nStartPara == rSel.nEndPara )
      77             :     {
      78         384 :         sal_uInt8 nFlags = 0;
      79             : 
      80         384 :         switch( bOnlyHardAttrib )
      81             :         {
      82             :         case EditEngineAttribs_All:
      83         381 :             nFlags = GETATTRIBS_ALL;
      84         381 :             break;
      85             :         case EditEngineAttribs_HardAndPara:
      86           0 :             nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS;
      87           0 :             break;
      88             :         case EditEngineAttribs_OnlyHard:
      89           3 :             nFlags = GETATTRIBS_CHARATTRIBS;
      90           3 :             break;
      91             :         default:
      92             :             OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs");
      93             :         }
      94         384 :         return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags );
      95             :     }
      96             :     else
      97             :     {
      98           1 :         return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib );
      99             :     }
     100             : }
     101             : 
     102         387 : SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const
     103             : {
     104         387 :     if( mpAttribsCache && ( 0 == bOnlyHardAttrib ) )
     105             :     {
     106             :         // have we the correct set in cache?
     107           2 :         if( ((SvxOutlinerForwarder*)this)->maAttribCacheSelection.IsEqual(rSel) )
     108             :         {
     109             :             // yes! just return the cache
     110           2 :             return *mpAttribsCache;
     111             :         }
     112             :         else
     113             :         {
     114             :             // no, we need delete the old cache
     115           0 :             delete mpAttribsCache;
     116           0 :             mpAttribsCache = NULL;
     117             :         }
     118             :     }
     119             : 
     120             :     //! Does it not exist on the Outliner?
     121             :     //! and why is the GetAttribs on the EditEngine not a const?
     122         385 :     EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine();
     123             : 
     124         385 :     SfxItemSet aSet( ImplOutlinerForwarderGetAttribs( rSel, bOnlyHardAttrib, rEditEngine ) );
     125             : 
     126         385 :     if( 0 == bOnlyHardAttrib )
     127             :     {
     128         382 :         mpAttribsCache = new SfxItemSet( aSet );
     129         382 :         maAttribCacheSelection = rSel;
     130             :     }
     131             : 
     132         385 :     SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( rSel.nStartPara );
     133         385 :     if( pStyle )
     134         339 :         aSet.SetParent( &(pStyle->GetItemSet() ) );
     135             : 
     136         385 :     return aSet;
     137             : }
     138             : 
     139         442 : SfxItemSet SvxOutlinerForwarder::GetParaAttribs( sal_uInt16 nPara ) const
     140             : {
     141         442 :     if( mpParaAttribsCache )
     142             :     {
     143             :         // have we the correct set in cache?
     144          75 :         if( nPara == mnParaAttribsCache )
     145             :         {
     146             :             // yes! just return the cache
     147          75 :             return *mpParaAttribsCache;
     148             :         }
     149             :         else
     150             :         {
     151             :             // no, we need delete the old cache
     152           0 :             delete mpParaAttribsCache;
     153           0 :             mpParaAttribsCache = NULL;
     154             :         }
     155             :     }
     156             : 
     157         367 :     mpParaAttribsCache = new SfxItemSet( rOutliner.GetParaAttribs( nPara ) );
     158         367 :     mnParaAttribsCache = nPara;
     159             : 
     160         367 :     EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine();
     161             : 
     162         367 :     SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( nPara );
     163         367 :     if( pStyle )
     164         335 :         mpParaAttribsCache->SetParent( &(pStyle->GetItemSet() ) );
     165             : 
     166         367 :     return *mpParaAttribsCache;
     167             : }
     168             : 
     169         351 : void SvxOutlinerForwarder::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
     170             : {
     171         351 :     flushCache();
     172             : 
     173         351 :     const SfxItemSet* pOldParent = rSet.GetParent();
     174         351 :     if( pOldParent )
     175         335 :         ((SfxItemSet*)&rSet)->SetParent( NULL );
     176             : 
     177         351 :     rOutliner.SetParaAttribs( nPara, rSet );
     178             : 
     179         351 :     if( pOldParent )
     180         335 :         ((SfxItemSet*)&rSet)->SetParent( pOldParent );
     181         351 : }
     182             : 
     183          14 : void SvxOutlinerForwarder::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
     184             : {
     185          14 :     rOutliner.RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich );
     186          14 : }
     187             : 
     188           0 : SfxItemPool* SvxOutlinerForwarder::GetPool() const
     189             : {
     190           0 :     return rOutliner.GetEmptyItemSet().GetPool();
     191             : }
     192             : 
     193           3 : void SvxOutlinerForwarder::GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const
     194             : {
     195           3 :     ((EditEngine&)rOutliner.GetEditEngine()).GetPortions( nPara, rList );
     196           3 : }
     197             : 
     198        1361 : void SvxOutlinerForwarder::QuickInsertText( const String& rText, const ESelection& rSel )
     199             : {
     200        1361 :     flushCache();
     201        1361 :     if( rText.Len() == 0 )
     202             :     {
     203         154 :         rOutliner.QuickDelete( rSel );
     204             :     }
     205             :     else
     206             :     {
     207        1207 :         rOutliner.QuickInsertText( rText, rSel );
     208             :     }
     209        1361 : }
     210             : 
     211           2 : void SvxOutlinerForwarder::QuickInsertLineBreak( const ESelection& rSel )
     212             : {
     213           2 :     flushCache();
     214           2 :     rOutliner.QuickInsertLineBreak( rSel );
     215           2 : }
     216             : 
     217          16 : void SvxOutlinerForwarder::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
     218             : {
     219          16 :     flushCache();
     220          16 :     rOutliner.QuickInsertField( rFld, rSel );
     221          16 : }
     222             : 
     223         196 : void SvxOutlinerForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
     224             : {
     225         196 :     flushCache();
     226         196 :     rOutliner.QuickSetAttribs( rSet, rSel );
     227         196 : }
     228             : 
     229           0 : XubString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor )
     230             : {
     231           0 :     return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
     232             : }
     233             : 
     234           0 : void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos )
     235             : {
     236           0 :     rOutliner.FieldClicked( rField, nPara, nPos );
     237           0 : }
     238             : 
     239           0 : sal_Bool SvxOutlinerForwarder::IsValid() const
     240             : {
     241             :     // cannot reliably query outliner state
     242             :     // while in the middle of an update
     243           0 :     return rOutliner.GetUpdateMode();
     244             : }
     245             : 
     246             : extern sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich );
     247             : 
     248           0 : sal_uInt16 SvxOutlinerForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
     249             : {
     250           0 :     return GetSvxEditEngineItemState( (EditEngine&)rOutliner.GetEditEngine(), rSel, nWhich );
     251             : }
     252             : 
     253           0 : sal_uInt16 SvxOutlinerForwarder::GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const
     254             : {
     255           0 :     const SfxItemSet& rSet = rOutliner.GetParaAttribs( nPara );
     256           0 :     return rSet.GetItemState( nWhich );
     257             : }
     258             : 
     259             : 
     260        4202 : void SvxOutlinerForwarder::flushCache()
     261             : {
     262        4202 :     if( mpAttribsCache )
     263             :     {
     264         382 :         delete mpAttribsCache;
     265         382 :         mpAttribsCache = NULL;
     266             :     }
     267             : 
     268        4202 :     if( mpParaAttribsCache )
     269             :     {
     270         367 :         delete mpParaAttribsCache;
     271         367 :         mpParaAttribsCache = NULL;
     272             :     }
     273        4202 : }
     274             : 
     275           0 : LanguageType SvxOutlinerForwarder::GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const
     276             : {
     277           0 :     return rOutliner.GetLanguage(nPara, nIndex);
     278             : }
     279             : 
     280           0 : sal_uInt16 SvxOutlinerForwarder::GetFieldCount( sal_uInt16 nPara ) const
     281             : {
     282           0 :     return rOutliner.GetEditEngine().GetFieldCount(nPara);
     283             : }
     284             : 
     285           0 : EFieldInfo SvxOutlinerForwarder::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const
     286             : {
     287           0 :     return rOutliner.GetEditEngine().GetFieldInfo( nPara, nField );
     288             : }
     289             : 
     290           0 : EBulletInfo SvxOutlinerForwarder::GetBulletInfo( sal_uInt16 nPara ) const
     291             : {
     292           0 :     return rOutliner.GetBulletInfo( nPara );
     293             : }
     294             : 
     295           0 : Rectangle SvxOutlinerForwarder::GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const
     296             : {
     297             :     // EditEngine's 'internal' methods like GetCharacterBounds()
     298             :     // don't rotate for vertical text.
     299           0 :     Size aSize( rOutliner.CalcTextSize() );
     300           0 :     ::std::swap( aSize.Width(), aSize.Height() );
     301           0 :     bool bIsVertical( rOutliner.IsVertical() == sal_True );
     302             : 
     303             :     // #108900# Handle virtual position one-past-the end of the string
     304           0 :     if( nIndex >= GetTextLen(nPara) )
     305             :     {
     306           0 :         Rectangle aLast;
     307             : 
     308           0 :         if( nIndex )
     309             :         {
     310             :             // use last character, if possible
     311           0 :             aLast = rOutliner.GetEditEngine().GetCharacterBounds( EPosition(nPara, nIndex-1) );
     312             : 
     313             :             // move at end of this last character, make one pixel wide
     314           0 :             aLast.Move( aLast.Right() - aLast.Left(), 0 );
     315           0 :             aLast.SetSize( Size(1, aLast.GetHeight()) );
     316             : 
     317             :             // take care for CTL
     318           0 :             aLast = SvxEditSourceHelper::EEToUserSpace( aLast, aSize, bIsVertical );
     319             :         }
     320             :         else
     321             :         {
     322             :             // #109864# Bounds must lie within the paragraph
     323           0 :             aLast = GetParaBounds( nPara );
     324             : 
     325             :             // #109151# Don't use paragraph height, but line height
     326             :             // instead. aLast is already CTL-correct
     327           0 :             if( bIsVertical)
     328           0 :                 aLast.SetSize( Size( rOutliner.GetLineHeight(nPara,0), 1 ) );
     329             :             else
     330           0 :                 aLast.SetSize( Size( 1, rOutliner.GetLineHeight(nPara,0) ) );
     331             :         }
     332             : 
     333           0 :         return aLast;
     334             :     }
     335             :     else
     336             :     {
     337           0 :         return SvxEditSourceHelper::EEToUserSpace( rOutliner.GetEditEngine().GetCharacterBounds( EPosition(nPara, nIndex) ),
     338           0 :                                                    aSize, bIsVertical );
     339             :     }
     340             : }
     341             : 
     342           0 : Rectangle SvxOutlinerForwarder::GetParaBounds( sal_uInt16 nPara ) const
     343             : {
     344           0 :     Point aPnt = rOutliner.GetDocPosTopLeft( nPara );
     345           0 :     Size aSize = rOutliner.CalcTextSize();
     346             : 
     347           0 :     if( rOutliner.IsVertical() )
     348             :     {
     349             :         // Hargl. Outliner's 'external' methods return the rotated
     350             :         // dimensions, 'internal' methods like GetTextHeight( n )
     351             :         // don't rotate.
     352           0 :         sal_uLong nWidth = rOutliner.GetTextHeight( nPara );
     353             : 
     354           0 :         return Rectangle( aSize.Width() - aPnt.Y() - nWidth, 0, aSize.Width() - aPnt.Y(), aSize.Height() );
     355             :     }
     356             :     else
     357             :     {
     358           0 :         sal_uLong nHeight = rOutliner.GetTextHeight( nPara );
     359             : 
     360           0 :         return Rectangle( 0, aPnt.Y(), aSize.Width(), aPnt.Y() + nHeight );
     361             :     }
     362             : }
     363             : 
     364           0 : MapMode SvxOutlinerForwarder::GetMapMode() const
     365             : {
     366           0 :     return rOutliner.GetRefMapMode();
     367             : }
     368             : 
     369           0 : OutputDevice* SvxOutlinerForwarder::GetRefDevice() const
     370             : {
     371           0 :     return rOutliner.GetRefDevice();
     372             : }
     373             : 
     374           0 : sal_Bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, sal_uInt16& nPara, sal_uInt16& nIndex ) const
     375             : {
     376           0 :     Size aSize( rOutliner.CalcTextSize() );
     377           0 :     ::std::swap( aSize.Width(), aSize.Height() );
     378             :     Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos,
     379             :                                                       aSize,
     380           0 :                                                       rOutliner.IsVertical() == sal_True ));
     381             : 
     382           0 :     EPosition aDocPos = rOutliner.GetEditEngine().FindDocPosition( aEEPos );
     383             : 
     384           0 :     nPara = aDocPos.nPara;
     385           0 :     nIndex = aDocPos.nIndex;
     386             : 
     387           0 :     return sal_True;
     388             : }
     389             : 
     390           0 : sal_Bool SvxOutlinerForwarder::GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const
     391             : {
     392           0 :     ESelection aRes = rOutliner.GetEditEngine().GetWord( ESelection(nPara, nIndex, nPara, nIndex), com::sun::star::i18n::WordType::DICTIONARY_WORD );
     393             : 
     394           0 :     if( aRes.nStartPara == nPara &&
     395             :         aRes.nStartPara == aRes.nEndPara )
     396             :     {
     397           0 :         nStart = aRes.nStartPos;
     398           0 :         nEnd = aRes.nEndPos;
     399             : 
     400           0 :         return sal_True;
     401             :     }
     402             : 
     403           0 :     return sal_False;
     404             : }
     405             : 
     406           0 : sal_Bool SvxOutlinerForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const
     407             : {
     408           0 :     return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rOutliner.GetEditEngine(), nPara, nIndex );
     409             : }
     410             : 
     411           0 : sal_uInt16 SvxOutlinerForwarder::GetLineCount( sal_uInt16 nPara ) const
     412             : {
     413           0 :     return static_cast < sal_uInt16 >( rOutliner.GetLineCount(nPara) );
     414             : }
     415             : 
     416           0 : sal_uInt16 SvxOutlinerForwarder::GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const
     417             : {
     418           0 :     return rOutliner.GetLineLen(nPara, nLine);
     419             : }
     420             : 
     421           0 : void SvxOutlinerForwarder::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const
     422             : {
     423           0 :     return rOutliner.GetEditEngine().GetLineBoundaries( rStart, rEnd, nPara, nLine );
     424             : }
     425             : 
     426           0 : sal_uInt16 SvxOutlinerForwarder::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const
     427             : {
     428           0 :     return rOutliner.GetEditEngine().GetLineNumberAtIndex( nPara, nIndex );
     429             : }
     430             : 
     431           0 : sal_Bool SvxOutlinerForwarder::QuickFormatDoc( sal_Bool )
     432             : {
     433           0 :     rOutliner.QuickFormatDoc();
     434             : 
     435           0 :     return sal_True;
     436             : }
     437             : 
     438           0 : sal_Bool SvxOutlinerForwarder::Delete( const ESelection& rSelection )
     439             : {
     440           0 :     flushCache();
     441           0 :     rOutliner.QuickDelete( rSelection );
     442           0 :     rOutliner.QuickFormatDoc();
     443             : 
     444           0 :     return sal_True;
     445             : }
     446             : 
     447           0 : sal_Bool SvxOutlinerForwarder::InsertText( const String& rStr, const ESelection& rSelection )
     448             : {
     449           0 :     flushCache();
     450           0 :     rOutliner.QuickInsertText( rStr, rSelection );
     451           0 :     rOutliner.QuickFormatDoc();
     452             : 
     453           0 :     return sal_True;
     454             : }
     455             : 
     456           1 : sal_Int16 SvxOutlinerForwarder::GetDepth( sal_uInt16 nPara ) const
     457             : {
     458             :     DBG_ASSERT( nPara < GetParagraphCount(), "SvxOutlinerForwarder::GetDepth: Invalid paragraph index");
     459             : 
     460           1 :     Paragraph* pPara = rOutliner.GetParagraph( nPara );
     461             : 
     462           1 :     sal_Int16 nLevel = -1;
     463             : 
     464           1 :     if( pPara )
     465           1 :         nLevel = rOutliner.GetDepth( nPara );
     466             : 
     467           1 :     return nLevel;
     468             : }
     469             : 
     470          74 : sal_Bool SvxOutlinerForwarder::SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth )
     471             : {
     472             :     DBG_ASSERT( nPara < GetParagraphCount(), "SvxOutlinerForwarder::SetDepth: Invalid paragraph index");
     473             : 
     474          74 :     if( (nNewDepth >= -1) && (nNewDepth <= 9) && (nPara < GetParagraphCount()) )
     475             :     {
     476          74 :         Paragraph* pPara = rOutliner.GetParagraph( nPara );
     477          74 :         if( pPara )
     478             :         {
     479          74 :             rOutliner.SetDepth( pPara, nNewDepth );
     480             : 
     481             : //          const bool bOutlinerText = pSdrObject && (pSdrObject->GetObjInventor() == SdrInventor) && (pSdrObject->GetObjIdentifier() == OBJ_OUTLINETEXT);
     482          74 :             if( bOutlinerText )
     483          34 :                 rOutliner.SetLevelDependendStyleSheet( nPara );
     484             : 
     485          74 :             return sal_True;
     486             :         }
     487             :     }
     488             : 
     489           0 :     return sal_False;
     490             : }
     491             : 
     492           0 : sal_Int16 SvxOutlinerForwarder::GetNumberingStartValue( sal_uInt16 nPara )
     493             : {
     494           0 :     if( nPara < GetParagraphCount() )
     495             :     {
     496           0 :         return rOutliner.GetNumberingStartValue( nPara );
     497             :     }
     498             :     else
     499             :     {
     500             :         OSL_FAIL( "SvxOutlinerForwarder::GetNumberingStartValue)(), Invalid paragraph index");
     501           0 :         return -1;
     502             :     }
     503             : }
     504             : 
     505           0 : void SvxOutlinerForwarder::SetNumberingStartValue(  sal_uInt16 nPara, sal_Int16 nNumberingStartValue )
     506             : {
     507           0 :     if( nPara < GetParagraphCount() )
     508             :     {
     509           0 :         rOutliner.SetNumberingStartValue( nPara, nNumberingStartValue );
     510             :     }
     511             :     else
     512             :     {
     513             :         OSL_FAIL( "SvxOutlinerForwarder::SetNumberingStartValue)(), Invalid paragraph index");
     514             :     }
     515           0 : }
     516             : 
     517           0 : sal_Bool SvxOutlinerForwarder::IsParaIsNumberingRestart( sal_uInt16 nPara )
     518             : {
     519           0 :     if( nPara < GetParagraphCount() )
     520             :     {
     521           0 :         return rOutliner.IsParaIsNumberingRestart( nPara );
     522             :     }
     523             :     else
     524             :     {
     525             :         OSL_FAIL( "SvxOutlinerForwarder::IsParaIsNumberingRestart)(), Invalid paragraph index");
     526           0 :         return sal_False;
     527             :     }
     528             : }
     529             : 
     530           0 : void SvxOutlinerForwarder::SetParaIsNumberingRestart(  sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart )
     531             : {
     532           0 :     if( nPara < GetParagraphCount() )
     533             :     {
     534           0 :         rOutliner.SetParaIsNumberingRestart( nPara, bParaIsNumberingRestart );
     535             :     }
     536             :     else
     537             :     {
     538             :         OSL_FAIL( "SvxOutlinerForwarder::SetParaIsNumberingRestart)(), Invalid paragraph index");
     539             :     }
     540           0 : }
     541             : 
     542          19 : const SfxItemSet * SvxOutlinerForwarder::GetEmptyItemSetPtr()
     543             : {
     544          19 :     EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() );
     545          19 :     return &rEditEngine.GetEmptyItemSet();
     546             : }
     547             : 
     548           5 : void SvxOutlinerForwarder::AppendParagraph()
     549             : {
     550           5 :     EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() );
     551           5 :     rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), String::EmptyString() );
     552           5 : }
     553             : 
     554          14 : xub_StrLen SvxOutlinerForwarder::AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet & /*rSet*/ )
     555             : {
     556          14 :     xub_StrLen nLen = 0;
     557             : 
     558          14 :     EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() );
     559          14 :     sal_uInt16 nParaCount = rEditEngine.GetParagraphCount();
     560             :     DBG_ASSERT( nPara < nParaCount, "paragraph index out of bounds" );
     561          14 :     if (/*0 <= nPara && */nPara < nParaCount)
     562             :     {
     563          14 :         nLen = rEditEngine.GetTextLen( nPara );
     564          14 :         rEditEngine.QuickInsertText( rText, ESelection( nPara, nLen, nPara, nLen ) );
     565             :     }
     566             : 
     567          14 :     return nLen;
     568             : }
     569             : 
     570           0 : void  SvxOutlinerForwarder::CopyText(const SvxTextForwarder& rSource)
     571             : {
     572           0 :     const SvxOutlinerForwarder* pSourceForwarder = dynamic_cast< const SvxOutlinerForwarder* >( &rSource );
     573           0 :     if( !pSourceForwarder )
     574           0 :         return;
     575           0 :     OutlinerParaObject* pNewOutlinerParaObject = pSourceForwarder->rOutliner.CreateParaObject();
     576           0 :     rOutliner.SetText( *pNewOutlinerParaObject );
     577           0 :     delete pNewOutlinerParaObject;
     578             : }
     579             : 
     580             : //------------------------------------------------------------------------
     581             : 
     582             : 
     583           0 : sal_Int16 SvxTextForwarder::GetNumberingStartValue( sal_uInt16 )
     584             : {
     585           0 :     return -1;
     586             : }
     587             : 
     588           0 : void SvxTextForwarder::SetNumberingStartValue( sal_uInt16, sal_Int16 )
     589             : {
     590           0 : }
     591             : 
     592           0 : sal_Bool SvxTextForwarder::IsParaIsNumberingRestart( sal_uInt16  )
     593             : {
     594           0 :     return sal_False;
     595             : }
     596             : 
     597           0 : void SvxTextForwarder::SetParaIsNumberingRestart( sal_uInt16, sal_Bool )
     598             : {
     599           0 : }
     600             : 
     601             : //------------------------------------------------------------------------
     602             : 
     603             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10