LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/text - txtfld.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 129 228 56.6 %
Date: 2012-12-27 Functions: 5 6 83.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "hintids.hxx"
      21             : #include <fmtfld.hxx>
      22             : #include <txtfld.hxx>
      23             : #include <charfmt.hxx>
      24             : 
      25             : #include "viewsh.hxx"   // NewFldPortion, GetDoc()
      26             : #include "doc.hxx"      // NewFldPortion, GetSysFldType()
      27             : #include "rootfrm.hxx"  // Info ueber virt. PageNumber
      28             : #include "pagefrm.hxx"  // NewFldPortion, GetVirtPageNum()
      29             : #include "ndtxt.hxx"    // NewNumberPortion, pHints->GetNum()
      30             : #include "fldbas.hxx"      // SwField
      31             : #include "viewopt.hxx"  // SwViewOptions
      32             : #include "flyfrm.hxx"   //IsInBody()
      33             : #include "viewimp.hxx"
      34             : #include "txtatr.hxx"   // SwTxtFld
      35             : #include "swfont.hxx"   // NewFldPortion, new SwFont
      36             : #include "fntcache.hxx"   // NewFldPortion, SwFntAccess
      37             : #include "porfld.hxx"
      38             : #include "porftn.hxx"   // NewExtraPortion
      39             : #include "porref.hxx"   // NewExtraPortion
      40             : #include "portox.hxx"   // NewExtraPortion
      41             : #include "porhyph.hxx"   // NewExtraPortion
      42             : #include "porfly.hxx"   // NewExtraPortion
      43             : #include "itrform2.hxx"   // SwTxtFormatter
      44             : #include "chpfld.hxx"
      45             : #include "dbfld.hxx"
      46             : #include "expfld.hxx"
      47             : #include "docufld.hxx"
      48             : #include "pagedesc.hxx"  // NewFldPortion, GetNum()
      49             : #include <pormulti.hxx>     // SwMultiPortion
      50             : #include "fmtmeta.hxx" // lcl_NewMetaPortion
      51             : 
      52             : 
      53             : /*************************************************************************
      54             :  *                      SwTxtFormatter::NewFldPortion()
      55             :  *************************************************************************/
      56             : 
      57             : 
      58           1 : static bool lcl_IsInBody( SwFrm *pFrm )
      59             : {
      60           1 :     if ( pFrm->IsInDocBody() )
      61           1 :         return true;
      62             :     else
      63             :     {
      64           0 :         const SwFrm *pTmp = pFrm;
      65             :         const SwFlyFrm *pFly;
      66           0 :         while ( 0 != (pFly = pTmp->FindFlyFrm()) )
      67           0 :             pTmp = pFly->GetAnchorFrm();
      68           0 :         return pTmp->IsInDocBody();
      69             :     }
      70             : }
      71             : 
      72             : 
      73          13 : SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
      74             :                                                 const SwTxtAttr *pHint ) const
      75             : {
      76          13 :     SwExpandPortion *pRet = 0;
      77          13 :     SwFrm *pFrame = (SwFrm*)pFrm;
      78          13 :     SwField *pFld = (SwField*)pHint->GetFld().GetFld();
      79          13 :     const sal_Bool bName = rInf.GetOpt().IsFldName();
      80             : 
      81          13 :     SwCharFmt* pChFmt = 0;
      82          13 :     bool bNewFlyPor = false,
      83          13 :          bINet = false;
      84             : 
      85             :     // set language
      86          13 :     ((SwTxtFormatter*)this)->SeekAndChg( rInf );
      87          13 :     if (pFld->GetLanguage() != GetFnt()->GetLanguage())
      88             :     {
      89          13 :         pFld->SetLanguage( GetFnt()->GetLanguage() );
      90             :         // let the visual note know about its new language
      91          13 :         if (pFld->GetTyp()->Which()==RES_POSTITFLD)
      92           6 :             const_cast<SwFmtFld*> (&pHint->GetFld())->Broadcast( SwFmtFldHint( &pHint->GetFld(), SWFMTFLD_LANGUAGE ) );
      93             :     }
      94             : 
      95          13 :     ViewShell *pSh = rInf.GetVsh();
      96          13 :     SwDoc *const pDoc( (pSh) ? pSh->GetDoc() : 0 );
      97          13 :     bool const bInClipboard( (pDoc) ? pDoc->IsClipBoard() : true );
      98          13 :     sal_Bool bPlaceHolder = false;
      99             : 
     100          13 :     switch( pFld->GetTyp()->Which() )
     101             :     {
     102             :         case RES_SCRIPTFLD:
     103             :         case RES_POSTITFLD:
     104           6 :             pRet = new SwPostItsPortion( RES_SCRIPTFLD == pFld->GetTyp()->Which() );
     105           6 :             break;
     106             : 
     107             :         case RES_COMBINED_CHARS:
     108             :             {
     109           0 :                 if( bName )
     110             :                 {
     111           0 :                     String const sName( pFld->GetFieldName() );
     112           0 :                     pRet = new SwFldPortion(sName);
     113             :                 }
     114             :                 else
     115             :                 {
     116           0 :                     String const sContent( pFld->ExpandField(bInClipboard) );
     117           0 :                     pRet = new SwCombinedPortion(sContent);
     118             :                 }
     119             :             }
     120           0 :             break;
     121             : 
     122             :         case RES_HIDDENTXTFLD:
     123             :             {
     124             :                 String const str( (bName)
     125           0 :                         ? pFld->GetFieldName()
     126           0 :                         : pFld->ExpandField(bInClipboard) );
     127           0 :                 pRet = new SwHiddenPortion(str);
     128             :             }
     129           0 :             break;
     130             : 
     131             :         case RES_CHAPTERFLD:
     132           0 :             if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
     133             :             {
     134             :                 ((SwChapterField*)pFld)->ChangeExpansion( pFrame,
     135           0 :                                         &((SwTxtFld*)pHint)->GetTxtNode() );
     136             :             }
     137             :             {
     138             :                 String const str( (bName)
     139           0 :                         ? pFld->GetFieldName()
     140           0 :                         : pFld->ExpandField(bInClipboard) );
     141           0 :                 pRet = new SwFldPortion( str );
     142             :             }
     143           0 :             break;
     144             : 
     145             :         case RES_DOCSTATFLD:
     146           0 :             if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
     147             :             {
     148           0 :                 ((SwDocStatField*)pFld)->ChangeExpansion( pFrame );
     149             :             }
     150             :             {
     151             :                 String const str( (bName)
     152           0 :                         ? pFld->GetFieldName()
     153           0 :                         : pFld->ExpandField(bInClipboard) );
     154           0 :                 pRet = new SwFldPortion( str );
     155             :             }
     156           0 :             break;
     157             : 
     158             :         case RES_PAGENUMBERFLD:
     159             :         {
     160           4 :             if( !bName && pSh && pSh->GetLayout() && !pSh->Imp()->IsUpdateExpFlds() )//swmod 080122
     161             :             {
     162           4 :                 SwPageNumberFieldType *pPageNr = (SwPageNumberFieldType *)pFld->GetTyp();
     163             : 
     164           4 :                 const SwRootFrm* pTmpRootFrm = pSh->GetLayout();
     165           4 :                 const sal_Bool bVirt = pTmpRootFrm->IsVirtPageNum();
     166             : 
     167           4 :                 MSHORT nVirtNum = pFrame->GetVirtPageNum();
     168           4 :                 MSHORT nNumPages = pTmpRootFrm->GetPageNum();
     169           4 :                 sal_Int16 nNumFmt = -1;
     170           4 :                 if(SVX_NUM_PAGEDESC == pFld->GetFormat())
     171           4 :                     nNumFmt = pFrame->FindPageFrm()->GetPageDesc()->GetNumType().GetNumberingType();
     172             : 
     173             :                 pPageNr->ChangeExpansion( pDoc, nVirtNum, nNumPages,
     174           4 :                                             bVirt, nNumFmt > -1 ? &nNumFmt : 0);
     175             :             }
     176             :             {
     177             :                 String const str( (bName)
     178           0 :                         ? pFld->GetFieldName()
     179           4 :                         : pFld->ExpandField(bInClipboard) );
     180           4 :                 pRet = new SwFldPortion( str );
     181             :             }
     182           4 :             break;
     183             :         }
     184             :         case RES_GETEXPFLD:
     185             :         {
     186           1 :             if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
     187             :             {
     188           1 :                 SwGetExpField* pExpFld = (SwGetExpField*)pFld;
     189           1 :                 if( !::lcl_IsInBody( pFrame ) )
     190             :                 {
     191           0 :                     pExpFld->ChgBodyTxtFlag( false );
     192           0 :                     pExpFld->ChangeExpansion( *pFrame, *((SwTxtFld*)pHint) );
     193             :                 }
     194           1 :                 else if( !pExpFld->IsInBodyTxt() )
     195             :                 {
     196             :                     // war vorher anders, also erst expandieren, dann umsetzen!!
     197           0 :                     pExpFld->ChangeExpansion( *pFrame, *((SwTxtFld*)pHint) );
     198           0 :                     pExpFld->ChgBodyTxtFlag( true );
     199             :                 }
     200             :             }
     201             :             {
     202             :                 String const str( (bName)
     203           0 :                         ? pFld->GetFieldName()
     204           1 :                         : pFld->ExpandField(bInClipboard) );
     205           1 :                 pRet = new SwFldPortion( str );
     206             :             }
     207           1 :             break;
     208             :         }
     209             :         case RES_DBFLD:
     210             :         {
     211           0 :             if( !bName )
     212             :             {
     213           0 :                 SwDBField* pDBFld = (SwDBField*)pFld;
     214           0 :                 pDBFld->ChgBodyTxtFlag( ::lcl_IsInBody( pFrame ) );
     215             :             }
     216             :             {
     217             :                 String const str( (bName)
     218           0 :                         ? pFld->GetFieldName()
     219           0 :                         : pFld->ExpandField(bInClipboard) );
     220           0 :                 pRet = new SwFldPortion(str);
     221             :             }
     222           0 :             break;
     223             :         }
     224             :         case RES_REFPAGEGETFLD:
     225           0 :             if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
     226             :             {
     227           0 :                 ((SwRefPageGetField*)pFld)->ChangeExpansion( pFrame, (SwTxtFld*)pHint );
     228             :             }
     229             :             {
     230             :                 String const str( (bName)
     231           0 :                         ? pFld->GetFieldName()
     232           0 :                         : pFld->ExpandField(bInClipboard) );
     233           0 :                 pRet = new SwFldPortion(str);
     234             :             }
     235           0 :             break;
     236             : 
     237             :         case RES_JUMPEDITFLD:
     238           0 :             if( !bName )
     239           0 :                 pChFmt =  ((SwJumpEditField*)pFld)->GetCharFmt();
     240           0 :             bNewFlyPor = true;
     241           0 :             bPlaceHolder = true;
     242           0 :             break;
     243             : 
     244             :         default:
     245             :             {
     246             :                 String const str( (bName)
     247           0 :                         ? pFld->GetFieldName()
     248           2 :                         : pFld->ExpandField(bInClipboard) );
     249           2 :                 pRet = new SwFldPortion(str);
     250             :             }
     251             :     }
     252             : 
     253          13 :     if( bNewFlyPor )
     254             :     {
     255           0 :         SwFont *pTmpFnt = 0;
     256           0 :         if( !bName )
     257             :         {
     258           0 :             pTmpFnt = new SwFont( *pFnt );
     259           0 :             if( bINet )
     260             :             {
     261           0 :                 SwAttrPool* pPool = pChFmt->GetAttrSet().GetPool();
     262           0 :                 SfxItemSet aSet( *pPool, RES_CHRATR_BEGIN, RES_CHRATR_END );
     263           0 :                 SfxItemSet aTmpSet( aSet );
     264           0 :                 pFrm->GetTxtNode()->GetAttr(aSet,rInf.GetIdx(),rInf.GetIdx()+1);
     265           0 :                 aTmpSet.Set( pChFmt->GetAttrSet() );
     266           0 :                 aTmpSet.Differentiate( aSet );
     267           0 :                 if( aTmpSet.Count() )
     268           0 :                     pTmpFnt->SetDiffFnt( &aTmpSet, pFrm->GetTxtNode()->getIDocumentSettingAccess() );
     269             :             }
     270             :             else
     271           0 :                 pTmpFnt->SetDiffFnt( &pChFmt->GetAttrSet(), pFrm->GetTxtNode()->getIDocumentSettingAccess() );
     272             :         }
     273             :         {
     274             :             String const str( (bName)
     275           0 :                     ? pFld->GetFieldName()
     276           0 :                     : pFld->ExpandField(bInClipboard) );
     277           0 :             pRet = new SwFldPortion(str, pTmpFnt, bPlaceHolder);
     278             :         }
     279             :     }
     280             : 
     281          13 :     return pRet;
     282             : }
     283             : 
     284             : /*************************************************************************
     285             :  *                      SwTxtFormatter::TryNewNoLengthPortion()
     286             :  *************************************************************************/
     287             : 
     288           0 : static SwFldPortion * lcl_NewMetaPortion(SwTxtAttr & rHint, const bool bPrefix)
     289             : {
     290             :     ::sw::Meta *const pMeta(
     291           0 :         static_cast<SwFmtMeta &>(rHint.GetAttr()).GetMeta() );
     292           0 :     OUString fix;
     293           0 :     ::sw::MetaField *const pField( dynamic_cast< ::sw::MetaField * >(pMeta) );
     294             :     OSL_ENSURE(pField, "lcl_NewMetaPortion: no meta field?");
     295           0 :     if (pField)
     296             :     {
     297           0 :         pField->GetPrefixAndSuffix((bPrefix) ? &fix : 0, (bPrefix) ? 0 : &fix);
     298             :     }
     299           0 :     return new SwFldPortion( fix );
     300             : }
     301             : 
     302             : /** Try to create a new portion with zero length, for an end of a hint
     303             :     (where there is no CH_TXTATR). Because there may be multiple hint ends at a
     304             :     given index, m_nHintEndIndex is used to keep track of the already created
     305             :     portions. But the portions created here may actually be deleted again,
     306             :     due to UnderFlow. In that case, m_nHintEndIndex must be decremented,
     307             :     so the portion will be created again on the next line.
     308             :  */
     309             : SwExpandPortion *
     310        1569 : SwTxtFormatter::TryNewNoLengthPortion(SwTxtFormatInfo & rInfo)
     311             : {
     312        1569 :     if (pHints)
     313             :     {
     314         851 :         const xub_StrLen nIdx(rInfo.GetIdx());
     315         851 :         while (m_nHintEndIndex < pHints->GetEndCount())
     316             :         {
     317         837 :             SwTxtAttr & rHint( *pHints->GetEnd(m_nHintEndIndex) );
     318         837 :             xub_StrLen const nEnd( *rHint.GetAnyEnd() );
     319         837 :             if (nEnd > nIdx)
     320             :             {
     321         388 :                 break;
     322             :             }
     323         449 :             ++m_nHintEndIndex;
     324         449 :             if (nEnd == nIdx)
     325             :             {
     326         449 :                 if (RES_TXTATR_METAFIELD == rHint.Which())
     327             :                 {
     328             :                     SwFldPortion *const pPortion(
     329           0 :                             lcl_NewMetaPortion(rHint, false));
     330           0 :                     pPortion->SetNoLength(); // no CH_TXTATR at hint end!
     331           0 :                     return pPortion;
     332             :                 }
     333             :             }
     334             :         }
     335             :     }
     336        1569 :     return 0;
     337             : }
     338             : 
     339             : /*************************************************************************
     340             :  *                      SwTxtFormatter::NewExtraPortion()
     341             :  *************************************************************************/
     342             : 
     343         183 : SwLinePortion *SwTxtFormatter::NewExtraPortion( SwTxtFormatInfo &rInf )
     344             : {
     345         183 :     SwTxtAttr *pHint = GetAttr( rInf.GetIdx() );
     346         183 :     SwLinePortion *pRet = 0;
     347         183 :     if( !pHint )
     348             :     {
     349           0 :         pRet = new SwTxtPortion;
     350           0 :         pRet->SetLen( 1 );
     351           0 :         rInf.SetLen( 1 );
     352           0 :         return pRet;
     353             :     }
     354             : 
     355         183 :     switch( pHint->Which() )
     356             :     {
     357             :         case RES_TXTATR_FLYCNT :
     358             :         {
     359         165 :             pRet = NewFlyCntPortion( rInf, pHint );
     360         165 :             break;
     361             :         }
     362             :         case RES_TXTATR_FTN :
     363             :         {
     364           5 :             pRet = NewFtnPortion( rInf, pHint );
     365           5 :             break;
     366             :         }
     367             :         case RES_TXTATR_FIELD :
     368             :         {
     369          13 :             pRet = NewFldPortion( rInf, pHint );
     370          13 :             break;
     371             :         }
     372             :         case RES_TXTATR_REFMARK :
     373             :         {
     374           0 :             pRet = new SwIsoRefPortion;
     375           0 :             break;
     376             :         }
     377             :         case RES_TXTATR_TOXMARK :
     378             :         {
     379           0 :             pRet = new SwIsoToxPortion;
     380           0 :             break;
     381             :         }
     382             :         case RES_TXTATR_METAFIELD:
     383             :         {
     384           0 :             pRet = lcl_NewMetaPortion( *pHint, true );
     385           0 :             break;
     386             :         }
     387             :         default: ;
     388             :     }
     389         183 :     if( !pRet )
     390             :     {
     391           0 :         const XubString aNothing;
     392           0 :         pRet = new SwFldPortion( aNothing );
     393           0 :         rInf.SetLen( 1 );
     394             :     }
     395         183 :     return pRet;
     396             : }
     397             : 
     398             : /*************************************************************************
     399             :  *                      SwTxtFormatter::NewNumberPortion()
     400             :  *************************************************************************/
     401             : 
     402             : 
     403          60 : SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const
     404             : {
     405         120 :     if( rInf.IsNumDone() || rInf.GetTxtStart() != nStart
     406          60 :                 || rInf.GetTxtStart() != rInf.GetIdx() )
     407           0 :         return 0;
     408             : 
     409          60 :     SwNumberPortion *pRet = 0;
     410          60 :     const SwTxtNode* pTxtNd = GetTxtFrm()->GetTxtNode();
     411          60 :     const SwNumRule* pNumRule = pTxtNd->GetNumRule();
     412             : 
     413             :     // hat ein "gueltige" Nummer ?
     414          60 :     if( pTxtNd->IsNumbered() && pTxtNd->IsCountedInList())
     415             :     {
     416          60 :         const SwNumFmt &rNumFmt = pNumRule->Get( static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()) );
     417          60 :         const sal_Bool bLeft = SVX_ADJUST_LEFT == rNumFmt.GetNumAdjust();
     418          60 :         const sal_Bool bCenter = SVX_ADJUST_CENTER == rNumFmt.GetNumAdjust();
     419             :         const bool bLabelAlignmentPosAndSpaceModeActive(
     420          60 :                 rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT );
     421             :         const KSHORT nMinDist = bLabelAlignmentPosAndSpaceModeActive
     422          60 :                                 ? 0 : rNumFmt.GetCharTextDistance();
     423             : 
     424          60 :         if( SVX_NUM_BITMAP == rNumFmt.GetNumberingType() )
     425             :         {
     426           0 :             pRet = new SwGrfNumPortion( (SwFrm*)GetTxtFrm(),
     427             :                                         pTxtNd->GetLabelFollowedBy(),
     428           0 :                                         rNumFmt.GetBrush(),
     429             :                                         rNumFmt.GetGraphicOrientation(),
     430           0 :                                         rNumFmt.GetGraphicSize(),
     431             :                                         bLeft, bCenter, nMinDist,
     432           0 :                                         bLabelAlignmentPosAndSpaceModeActive );
     433           0 :             long nTmpA = rInf.GetLast()->GetAscent();
     434           0 :             long nTmpD = rInf.GetLast()->Height() - nTmpA;
     435           0 :             if( !rInf.IsTest() )
     436           0 :                 ((SwGrfNumPortion*)pRet)->SetBase( nTmpA, nTmpD, nTmpA, nTmpD );
     437             :         }
     438             :         else
     439             :         {
     440             :             // Der SwFont wird dynamisch angelegt und im CTOR uebergeben,
     441             :             // weil das CharFmt nur einen SV-Font zurueckliefert.
     442             :             // Im Dtor vom SwNumberPortion wird der SwFont deletet.
     443          60 :             SwFont *pNumFnt = 0;
     444          60 :             const SwAttrSet* pFmt = rNumFmt.GetCharFmt() ?
     445           8 :                                     &rNumFmt.GetCharFmt()->GetAttrSet() :
     446          68 :                                     NULL;
     447          60 :             const IDocumentSettingAccess* pIDSA = pTxtNd->getIDocumentSettingAccess();
     448             : 
     449          60 :             if( SVX_NUM_CHAR_SPECIAL == rNumFmt.GetNumberingType() )
     450             :             {
     451           8 :                 const Font *pFmtFnt = rNumFmt.GetBulletFont();
     452             : 
     453             :                 //
     454             :                 // Build a new bullet font basing on the current paragraph font:
     455             :                 //
     456           8 :                 pNumFnt = new SwFont( &rInf.GetCharAttr(), pIDSA );
     457             : 
     458             :                 // #i53199#
     459           8 :                 if ( !pIDSA->get(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT) )
     460             :                 {
     461             :                     // i18463:
     462             :                     // Underline style of paragraph font should not be considered
     463             :                     // Overline style of paragraph font should not be considered
     464             :                     // Weight style of paragraph font should not be considered
     465             :                     // Posture style of paragraph font should not be considered
     466           8 :                     pNumFnt->SetUnderline( UNDERLINE_NONE );
     467           8 :                     pNumFnt->SetOverline( UNDERLINE_NONE );
     468           8 :                     pNumFnt->SetItalic( ITALIC_NONE, SW_LATIN );
     469           8 :                     pNumFnt->SetItalic( ITALIC_NONE, SW_CJK );
     470           8 :                     pNumFnt->SetItalic( ITALIC_NONE, SW_CTL );
     471           8 :                     pNumFnt->SetWeight( WEIGHT_NORMAL, SW_LATIN );
     472           8 :                     pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CJK );
     473           8 :                     pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CTL );
     474             :                 }
     475             : 
     476             :                 //
     477             :                 // Apply the explicit attributes from the character style
     478             :                 // associated with the numering to the new bullet font.
     479             :                 //
     480           8 :                 if( pFmt )
     481           6 :                     pNumFnt->SetDiffFnt( pFmt, pIDSA );
     482             : 
     483           8 :                 if ( pFmtFnt )
     484             :                 {
     485           8 :                     const sal_uInt8 nAct = pNumFnt->GetActual();
     486           8 :                     pNumFnt->SetFamily( pFmtFnt->GetFamily(), nAct );
     487           8 :                     pNumFnt->SetName( pFmtFnt->GetName(), nAct );
     488           8 :                     pNumFnt->SetStyleName( pFmtFnt->GetStyleName(), nAct );
     489           8 :                     pNumFnt->SetCharSet( pFmtFnt->GetCharSet(), nAct );
     490           8 :                     pNumFnt->SetPitch( pFmtFnt->GetPitch(), nAct );
     491             :                 }
     492             : 
     493             :                 // we do not allow a vertical font
     494           8 :                 pNumFnt->SetVertical( pNumFnt->GetOrientation(),
     495          16 :                                       pFrm->IsVertical() );
     496             : 
     497             :                 // --> OD 2008-01-23 #newlistelevelattrs#
     498           8 :                 pRet = new SwBulletPortion( rNumFmt.GetBulletChar(),
     499             :                                             pTxtNd->GetLabelFollowedBy(),
     500             :                                             pNumFnt,
     501             :                                             bLeft, bCenter, nMinDist,
     502           8 :                                             bLabelAlignmentPosAndSpaceModeActive );
     503             :             }
     504             :             else
     505             :             {
     506          52 :                 XubString aTxt( pTxtNd->GetNumString() );
     507          52 :                 if ( aTxt.Len() > 0 )
     508             :                 {
     509          50 :                     aTxt.Insert( pTxtNd->GetLabelFollowedBy() );
     510             :                 }
     511             : 
     512             :                 // 7974: Nicht nur eine Optimierung...
     513             :                 // Eine Numberportion ohne Text wird die Breite von 0
     514             :                 // erhalten. Die nachfolgende Textportion wird im BreakLine
     515             :                 // in das BreakCut laufen, obwohl rInf.GetLast()->GetFlyPortion()
     516             :                 // vorliegt!
     517          52 :                 if( aTxt.Len() )
     518             :                 {
     519             :                     //
     520             :                     // Build a new numbering font basing on the current paragraph font:
     521             :                     //
     522          50 :                     pNumFnt = new SwFont( &rInf.GetCharAttr(), pIDSA );
     523             : 
     524             :                     // #i53199#
     525          50 :                     if ( !pIDSA->get(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT) )
     526             :                     {
     527             :                         // i18463:
     528             :                         // Underline style of paragraph font should not be considered
     529          50 :                         pNumFnt->SetUnderline( UNDERLINE_NONE );
     530             :                         // Overline style of paragraph font should not be considered
     531          50 :                         pNumFnt->SetOverline( UNDERLINE_NONE );
     532             :                     }
     533             : 
     534             : 
     535             :                     //
     536             :                     // Apply the explicit attributes from the character style
     537             :                     // associated with the numering to the new bullet font.
     538             :                     //
     539          50 :                     if( pFmt )
     540           2 :                         pNumFnt->SetDiffFnt( pFmt, pIDSA );
     541             : 
     542             :                     // we do not allow a vertical font
     543          50 :                     pNumFnt->SetVertical( pNumFnt->GetOrientation(), pFrm->IsVertical() );
     544             : 
     545             :                     pRet = new SwNumberPortion( aTxt, pNumFnt,
     546             :                                                 bLeft, bCenter, nMinDist,
     547          50 :                                                 bLabelAlignmentPosAndSpaceModeActive );
     548          52 :                 }
     549             :             }
     550             :         }
     551             :     }
     552          60 :     return pRet;
     553             : }
     554             : 
     555             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10