LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/core/text - txtfld.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 176 230 76.5 %
Date: 2013-07-09 Functions: 8 8 100.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             : #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           6 : static bool lcl_IsInBody( SwFrm *pFrm )
      59             : {
      60           6 :     if ( pFrm->IsInDocBody() )
      61           6 :         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         109 : SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
      74             :                                                 const SwTxtAttr *pHint ) const
      75             : {
      76         109 :     SwExpandPortion *pRet = 0;
      77         109 :     SwFrm *pFrame = (SwFrm*)pFrm;
      78         109 :     SwField *pFld = (SwField*)pHint->GetFld().GetFld();
      79         109 :     const sal_Bool bName = rInf.GetOpt().IsFldName();
      80             : 
      81         109 :     SwCharFmt* pChFmt = 0;
      82         109 :     bool bNewFlyPor = false,
      83         109 :          bINet = false;
      84             : 
      85             :     // set language
      86         109 :     ((SwTxtFormatter*)this)->SeekAndChg( rInf );
      87         109 :     if (pFld->GetLanguage() != GetFnt()->GetLanguage())
      88             :     {
      89          65 :         pFld->SetLanguage( GetFnt()->GetLanguage() );
      90             :         // let the visual note know about its new language
      91          65 :         if (pFld->GetTyp()->Which()==RES_POSTITFLD)
      92           9 :             const_cast<SwFmtFld*> (&pHint->GetFld())->Broadcast( SwFmtFldHint( &pHint->GetFld(), SWFMTFLD_LANGUAGE ) );
      93             :     }
      94             : 
      95         109 :     ViewShell *pSh = rInf.GetVsh();
      96         109 :     SwDoc *const pDoc( (pSh) ? pSh->GetDoc() : 0 );
      97         109 :     bool const bInClipboard( (pDoc) ? pDoc->IsClipBoard() : true );
      98         109 :     sal_Bool bPlaceHolder = false;
      99             : 
     100         109 :     switch( pFld->GetTyp()->Which() )
     101             :     {
     102             :         case RES_SCRIPTFLD:
     103             :         case RES_POSTITFLD:
     104           9 :             pRet = new SwPostItsPortion( RES_SCRIPTFLD == pFld->GetTyp()->Which() );
     105           9 :             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           5 :             if( !bName && pSh && pSh->GetLayout() && !pSh->Imp()->IsUpdateExpFlds() )//swmod 080122
     161             :             {
     162           5 :                 SwPageNumberFieldType *pPageNr = (SwPageNumberFieldType *)pFld->GetTyp();
     163             : 
     164           5 :                 const SwRootFrm* pTmpRootFrm = pSh->GetLayout();
     165           5 :                 const sal_Bool bVirt = pTmpRootFrm->IsVirtPageNum();
     166             : 
     167           5 :                 MSHORT nVirtNum = pFrame->GetVirtPageNum();
     168           5 :                 MSHORT nNumPages = pTmpRootFrm->GetPageNum();
     169           5 :                 sal_Int16 nNumFmt = -1;
     170           5 :                 if(SVX_NUM_PAGEDESC == pFld->GetFormat())
     171           5 :                     nNumFmt = pFrame->FindPageFrm()->GetPageDesc()->GetNumType().GetNumberingType();
     172             :                 static_cast<SwPageNumberField*>(pFld)
     173           5 :                     ->ChangeExpansion(nVirtNum, nNumPages);
     174             :                 pPageNr->ChangeExpansion(pDoc,
     175           5 :                                             bVirt, nNumFmt > -1 ? &nNumFmt : 0);
     176             :             }
     177             :             {
     178             :                 String const str( (bName)
     179           0 :                         ? pFld->GetFieldName()
     180           5 :                         : pFld->ExpandField(bInClipboard) );
     181           5 :                 pRet = new SwFldPortion( str );
     182             :             }
     183           5 :             break;
     184             :         }
     185             :         case RES_GETEXPFLD:
     186             :         {
     187           1 :             if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
     188             :             {
     189           1 :                 SwGetExpField* pExpFld = (SwGetExpField*)pFld;
     190           1 :                 if( !::lcl_IsInBody( pFrame ) )
     191             :                 {
     192           0 :                     pExpFld->ChgBodyTxtFlag( false );
     193           0 :                     pExpFld->ChangeExpansion( *pFrame, *((SwTxtFld*)pHint) );
     194             :                 }
     195           1 :                 else if( !pExpFld->IsInBodyTxt() )
     196             :                 {
     197             :                     // war vorher anders, also erst expandieren, dann umsetzen!!
     198           0 :                     pExpFld->ChangeExpansion( *pFrame, *((SwTxtFld*)pHint) );
     199           0 :                     pExpFld->ChgBodyTxtFlag( true );
     200             :                 }
     201             :             }
     202             :             {
     203             :                 String const str( (bName)
     204           0 :                         ? pFld->GetFieldName()
     205           1 :                         : pFld->ExpandField(bInClipboard) );
     206           1 :                 pRet = new SwFldPortion( str );
     207             :             }
     208           1 :             break;
     209             :         }
     210             :         case RES_DBFLD:
     211             :         {
     212           5 :             if( !bName )
     213             :             {
     214           5 :                 SwDBField* pDBFld = (SwDBField*)pFld;
     215           5 :                 pDBFld->ChgBodyTxtFlag( ::lcl_IsInBody( pFrame ) );
     216             :             }
     217             :             {
     218             :                 String const str( (bName)
     219           0 :                         ? pFld->GetFieldName()
     220           5 :                         : pFld->ExpandField(bInClipboard) );
     221           5 :                 pRet = new SwFldPortion(str);
     222             :             }
     223           5 :             break;
     224             :         }
     225             :         case RES_REFPAGEGETFLD:
     226           0 :             if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
     227             :             {
     228           0 :                 ((SwRefPageGetField*)pFld)->ChangeExpansion( pFrame, (SwTxtFld*)pHint );
     229             :             }
     230             :             {
     231             :                 String const str( (bName)
     232           0 :                         ? pFld->GetFieldName()
     233           0 :                         : pFld->ExpandField(bInClipboard) );
     234           0 :                 pRet = new SwFldPortion(str);
     235             :             }
     236           0 :             break;
     237             : 
     238             :         case RES_JUMPEDITFLD:
     239           8 :             if( !bName )
     240           8 :                 pChFmt =  ((SwJumpEditField*)pFld)->GetCharFmt();
     241           8 :             bNewFlyPor = true;
     242           8 :             bPlaceHolder = true;
     243           8 :             break;
     244             : 
     245             :         default:
     246             :             {
     247             :                 String const str( (bName)
     248           0 :                         ? pFld->GetFieldName()
     249          81 :                         : pFld->ExpandField(bInClipboard) );
     250          81 :                 pRet = new SwFldPortion(str);
     251             :             }
     252             :     }
     253             : 
     254         109 :     if( bNewFlyPor )
     255             :     {
     256           8 :         SwFont *pTmpFnt = 0;
     257           8 :         if( !bName )
     258             :         {
     259           8 :             pTmpFnt = new SwFont( *pFnt );
     260           8 :             if( bINet )
     261             :             {
     262           0 :                 SwAttrPool* pPool = pChFmt->GetAttrSet().GetPool();
     263           0 :                 SfxItemSet aSet( *pPool, RES_CHRATR_BEGIN, RES_CHRATR_END );
     264           0 :                 SfxItemSet aTmpSet( aSet );
     265           0 :                 pFrm->GetTxtNode()->GetAttr(aSet,rInf.GetIdx(),rInf.GetIdx()+1);
     266           0 :                 aTmpSet.Set( pChFmt->GetAttrSet() );
     267           0 :                 aTmpSet.Differentiate( aSet );
     268           0 :                 if( aTmpSet.Count() )
     269           0 :                     pTmpFnt->SetDiffFnt( &aTmpSet, pFrm->GetTxtNode()->getIDocumentSettingAccess() );
     270             :             }
     271             :             else
     272           8 :                 pTmpFnt->SetDiffFnt( &pChFmt->GetAttrSet(), pFrm->GetTxtNode()->getIDocumentSettingAccess() );
     273             :         }
     274             :         {
     275             :             String const str( (bName)
     276           0 :                     ? pFld->GetFieldName()
     277           8 :                     : pFld->ExpandField(bInClipboard) );
     278           8 :             pRet = new SwFldPortion(str, pTmpFnt, bPlaceHolder);
     279             :         }
     280             :     }
     281             : 
     282         109 :     return pRet;
     283             : }
     284             : 
     285             : /*************************************************************************
     286             :  *                      SwTxtFormatter::TryNewNoLengthPortion()
     287             :  *************************************************************************/
     288             : 
     289          40 : static SwFldPortion * lcl_NewMetaPortion(SwTxtAttr & rHint, const bool bPrefix)
     290             : {
     291             :     ::sw::Meta *const pMeta(
     292          40 :         static_cast<SwFmtMeta &>(rHint.GetAttr()).GetMeta() );
     293          40 :     OUString fix;
     294          40 :     ::sw::MetaField *const pField( dynamic_cast< ::sw::MetaField * >(pMeta) );
     295             :     OSL_ENSURE(pField, "lcl_NewMetaPortion: no meta field?");
     296          40 :     if (pField)
     297             :     {
     298          40 :         pField->GetPrefixAndSuffix((bPrefix) ? &fix : 0, (bPrefix) ? 0 : &fix);
     299             :     }
     300          40 :     return new SwFldPortion( fix );
     301             : }
     302             : 
     303             : /** Try to create a new portion with zero length, for an end of a hint
     304             :     (where there is no CH_TXTATR). Because there may be multiple hint ends at a
     305             :     given index, m_nHintEndIndex is used to keep track of the already created
     306             :     portions. But the portions created here may actually be deleted again,
     307             :     due to UnderFlow. In that case, m_nHintEndIndex must be decremented,
     308             :     so the portion will be created again on the next line.
     309             :  */
     310             : SwExpandPortion *
     311       49424 : SwTxtFormatter::TryNewNoLengthPortion(SwTxtFormatInfo & rInfo)
     312             : {
     313       49424 :     if (pHints)
     314             :     {
     315        6344 :         const xub_StrLen nIdx(rInfo.GetIdx());
     316       15958 :         while (m_nHintEndIndex < pHints->GetEndCount())
     317             :         {
     318        6627 :             SwTxtAttr & rHint( *pHints->GetEnd(m_nHintEndIndex) );
     319        6627 :             xub_StrLen const nEnd( *rHint.GetAnyEnd() );
     320        6627 :             if (nEnd > nIdx)
     321             :             {
     322        3337 :                 break;
     323             :             }
     324        3290 :             ++m_nHintEndIndex;
     325        3290 :             if (nEnd == nIdx)
     326             :             {
     327        3283 :                 if (RES_TXTATR_METAFIELD == rHint.Which())
     328             :                 {
     329             :                     SwFldPortion *const pPortion(
     330          20 :                             lcl_NewMetaPortion(rHint, false));
     331          20 :                     pPortion->SetNoLength(); // no CH_TXTATR at hint end!
     332          20 :                     return pPortion;
     333             :                 }
     334             :             }
     335             :         }
     336             :     }
     337       49404 :     return 0;
     338             : }
     339             : 
     340             : /*************************************************************************
     341             :  *                      SwTxtFormatter::NewExtraPortion()
     342             :  *************************************************************************/
     343             : 
     344        1189 : SwLinePortion *SwTxtFormatter::NewExtraPortion( SwTxtFormatInfo &rInf )
     345             : {
     346        1189 :     SwTxtAttr *pHint = GetAttr( rInf.GetIdx() );
     347        1189 :     SwLinePortion *pRet = 0;
     348        1189 :     if( !pHint )
     349             :     {
     350           0 :         pRet = new SwTxtPortion;
     351           0 :         pRet->SetLen( 1 );
     352           0 :         rInf.SetLen( 1 );
     353           0 :         return pRet;
     354             :     }
     355             : 
     356        1189 :     switch( pHint->Which() )
     357             :     {
     358             :         case RES_TXTATR_FLYCNT :
     359             :         {
     360         606 :             pRet = NewFlyCntPortion( rInf, pHint );
     361         606 :             break;
     362             :         }
     363             :         case RES_TXTATR_FTN :
     364             :         {
     365          77 :             pRet = NewFtnPortion( rInf, pHint );
     366          77 :             break;
     367             :         }
     368             :         case RES_TXTATR_FIELD :
     369             :         {
     370         109 :             pRet = NewFldPortion( rInf, pHint );
     371         109 :             break;
     372             :         }
     373             :         case RES_TXTATR_REFMARK :
     374             :         {
     375          77 :             pRet = new SwIsoRefPortion;
     376          77 :             break;
     377             :         }
     378             :         case RES_TXTATR_TOXMARK :
     379             :         {
     380          56 :             pRet = new SwIsoToxPortion;
     381          56 :             break;
     382             :         }
     383             :         case RES_TXTATR_METAFIELD:
     384             :         {
     385          20 :             pRet = lcl_NewMetaPortion( *pHint, true );
     386          20 :             break;
     387             :         }
     388             :         default: ;
     389             :     }
     390        1189 :     if( !pRet )
     391             :     {
     392         244 :         const XubString aNothing;
     393         244 :         pRet = new SwFldPortion( aNothing );
     394         244 :         rInf.SetLen( 1 );
     395             :     }
     396        1189 :     return pRet;
     397             : }
     398             : 
     399             : /*************************************************************************
     400             :  *                      SwTxtFormatter::NewNumberPortion()
     401             :  *************************************************************************/
     402             : 
     403             : 
     404         184 : SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const
     405             : {
     406         552 :     if( rInf.IsNumDone() || rInf.GetTxtStart() != nStart
     407         368 :                 || rInf.GetTxtStart() != rInf.GetIdx() )
     408           0 :         return 0;
     409             : 
     410         184 :     SwNumberPortion *pRet = 0;
     411         184 :     const SwTxtNode* pTxtNd = GetTxtFrm()->GetTxtNode();
     412         184 :     const SwNumRule* pNumRule = pTxtNd->GetNumRule();
     413             : 
     414             :     // hat ein "gueltige" Nummer ?
     415         184 :     if( pTxtNd->IsNumbered() && pTxtNd->IsCountedInList())
     416             :     {
     417         184 :         const SwNumFmt &rNumFmt = pNumRule->Get( static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()) );
     418         184 :         const sal_Bool bLeft = SVX_ADJUST_LEFT == rNumFmt.GetNumAdjust();
     419         184 :         const sal_Bool bCenter = SVX_ADJUST_CENTER == rNumFmt.GetNumAdjust();
     420             :         const bool bLabelAlignmentPosAndSpaceModeActive(
     421         184 :                 rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT );
     422             :         const KSHORT nMinDist = bLabelAlignmentPosAndSpaceModeActive
     423         184 :                                 ? 0 : rNumFmt.GetCharTextDistance();
     424             : 
     425         184 :         if( SVX_NUM_BITMAP == rNumFmt.GetNumberingType() )
     426             :         {
     427           8 :             pRet = new SwGrfNumPortion( (SwFrm*)GetTxtFrm(),
     428             :                                         pTxtNd->GetLabelFollowedBy(),
     429           8 :                                         rNumFmt.GetBrush(),
     430             :                                         rNumFmt.GetGraphicOrientation(),
     431           8 :                                         rNumFmt.GetGraphicSize(),
     432             :                                         bLeft, bCenter, nMinDist,
     433          24 :                                         bLabelAlignmentPosAndSpaceModeActive );
     434           8 :             long nTmpA = rInf.GetLast()->GetAscent();
     435           8 :             long nTmpD = rInf.GetLast()->Height() - nTmpA;
     436           8 :             if( !rInf.IsTest() )
     437           4 :                 ((SwGrfNumPortion*)pRet)->SetBase( nTmpA, nTmpD, nTmpA, nTmpD );
     438             :         }
     439             :         else
     440             :         {
     441             :             // Der SwFont wird dynamisch angelegt und im CTOR uebergeben,
     442             :             // weil das CharFmt nur einen SV-Font zurueckliefert.
     443             :             // Im Dtor vom SwNumberPortion wird der SwFont deletet.
     444         176 :             SwFont *pNumFnt = 0;
     445         176 :             const SwAttrSet* pFmt = rNumFmt.GetCharFmt() ?
     446          96 :                                     &rNumFmt.GetCharFmt()->GetAttrSet() :
     447         272 :                                     NULL;
     448         176 :             const IDocumentSettingAccess* pIDSA = pTxtNd->getIDocumentSettingAccess();
     449             : 
     450         176 :             if( SVX_NUM_CHAR_SPECIAL == rNumFmt.GetNumberingType() )
     451             :             {
     452          70 :                 const Font *pFmtFnt = rNumFmt.GetBulletFont();
     453             : 
     454             :                 //
     455             :                 // Build a new bullet font basing on the current paragraph font:
     456             :                 //
     457          70 :                 pNumFnt = new SwFont( &rInf.GetCharAttr(), pIDSA );
     458             : 
     459             :                 // #i53199#
     460          70 :                 if ( !pIDSA->get(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT) )
     461             :                 {
     462             :                     // i18463:
     463             :                     // Underline style of paragraph font should not be considered
     464             :                     // Overline style of paragraph font should not be considered
     465             :                     // Weight style of paragraph font should not be considered
     466             :                     // Posture style of paragraph font should not be considered
     467          70 :                     pNumFnt->SetUnderline( UNDERLINE_NONE );
     468          70 :                     pNumFnt->SetOverline( UNDERLINE_NONE );
     469          70 :                     pNumFnt->SetItalic( ITALIC_NONE, SW_LATIN );
     470          70 :                     pNumFnt->SetItalic( ITALIC_NONE, SW_CJK );
     471          70 :                     pNumFnt->SetItalic( ITALIC_NONE, SW_CTL );
     472          70 :                     pNumFnt->SetWeight( WEIGHT_NORMAL, SW_LATIN );
     473          70 :                     pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CJK );
     474          70 :                     pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CTL );
     475             :                 }
     476             : 
     477             :                 //
     478             :                 // Apply the explicit attributes from the character style
     479             :                 // associated with the numering to the new bullet font.
     480             :                 //
     481          70 :                 if( pFmt )
     482          62 :                     pNumFnt->SetDiffFnt( pFmt, pIDSA );
     483             : 
     484          70 :                 if ( pFmtFnt )
     485             :                 {
     486          70 :                     const sal_uInt8 nAct = pNumFnt->GetActual();
     487          70 :                     pNumFnt->SetFamily( pFmtFnt->GetFamily(), nAct );
     488          70 :                     pNumFnt->SetName( pFmtFnt->GetName(), nAct );
     489          70 :                     pNumFnt->SetStyleName( pFmtFnt->GetStyleName(), nAct );
     490          70 :                     pNumFnt->SetCharSet( pFmtFnt->GetCharSet(), nAct );
     491          70 :                     pNumFnt->SetPitch( pFmtFnt->GetPitch(), nAct );
     492             :                 }
     493             : 
     494             :                 // we do not allow a vertical font
     495          70 :                 pNumFnt->SetVertical( pNumFnt->GetOrientation(),
     496         140 :                                       pFrm->IsVertical() );
     497             : 
     498             :                 // --> OD 2008-01-23 #newlistelevelattrs#
     499          70 :                 pRet = new SwBulletPortion( rNumFmt.GetBulletChar(),
     500             :                                             pTxtNd->GetLabelFollowedBy(),
     501             :                                             pNumFnt,
     502             :                                             bLeft, bCenter, nMinDist,
     503          70 :                                             bLabelAlignmentPosAndSpaceModeActive );
     504             :             }
     505             :             else
     506             :             {
     507         106 :                 XubString aTxt( pTxtNd->GetNumString() );
     508         106 :                 if ( aTxt.Len() > 0 )
     509             :                 {
     510          88 :                     aTxt.Insert( pTxtNd->GetLabelFollowedBy() );
     511             :                 }
     512             : 
     513             :                 // 7974: Nicht nur eine Optimierung...
     514             :                 // Eine Numberportion ohne Text wird die Breite von 0
     515             :                 // erhalten. Die nachfolgende Textportion wird im BreakLine
     516             :                 // in das BreakCut laufen, obwohl rInf.GetLast()->GetFlyPortion()
     517             :                 // vorliegt!
     518         106 :                 if( aTxt.Len() )
     519             :                 {
     520             :                     //
     521             :                     // Build a new numbering font basing on the current paragraph font:
     522             :                     //
     523          88 :                     pNumFnt = new SwFont( &rInf.GetCharAttr(), pIDSA );
     524             : 
     525             :                     // #i53199#
     526          88 :                     if ( !pIDSA->get(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT) )
     527             :                     {
     528             :                         // i18463:
     529             :                         // Underline style of paragraph font should not be considered
     530          88 :                         pNumFnt->SetUnderline( UNDERLINE_NONE );
     531             :                         // Overline style of paragraph font should not be considered
     532          88 :                         pNumFnt->SetOverline( UNDERLINE_NONE );
     533             :                     }
     534             : 
     535             : 
     536             :                     //
     537             :                     // Apply the explicit attributes from the character style
     538             :                     // associated with the numering to the new bullet font.
     539             :                     //
     540          88 :                     if( pFmt )
     541          34 :                         pNumFnt->SetDiffFnt( pFmt, pIDSA );
     542             : 
     543             :                     // we do not allow a vertical font
     544          88 :                     pNumFnt->SetVertical( pNumFnt->GetOrientation(), pFrm->IsVertical() );
     545             : 
     546             :                     pRet = new SwNumberPortion( aTxt, pNumFnt,
     547             :                                                 bLeft, bCenter, nMinDist,
     548          88 :                                                 bLabelAlignmentPosAndSpaceModeActive );
     549         106 :                 }
     550             :             }
     551             :         }
     552             :     }
     553         184 :     return pRet;
     554          99 : }
     555             : 
     556             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10