LCOV - code coverage report
Current view: top level - sw/source/core/text - txtfld.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 202 247 81.8 %
Date: 2014-04-11 Functions: 6 6 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"
      26             : #include "doc.hxx"
      27             : #include "rootfrm.hxx"
      28             : #include "pagefrm.hxx"
      29             : #include "ndtxt.hxx"
      30             : #include "fldbas.hxx"
      31             : #include "viewopt.hxx"
      32             : #include "flyfrm.hxx"
      33             : #include "viewimp.hxx"
      34             : #include "txtatr.hxx"
      35             : #include "swfont.hxx"
      36             : #include "fntcache.hxx"
      37             : #include "porfld.hxx"
      38             : #include "porftn.hxx"
      39             : #include "porref.hxx"
      40             : #include "portox.hxx"
      41             : #include "porhyph.hxx"
      42             : #include "porfly.hxx"
      43             : #include "itrform2.hxx"
      44             : #include "chpfld.hxx"
      45             : #include "dbfld.hxx"
      46             : #include "expfld.hxx"
      47             : #include "docufld.hxx"
      48             : #include "pagedesc.hxx"
      49             : #include <pormulti.hxx>
      50             : #include "fmtmeta.hxx"
      51             : #include "reffld.hxx"
      52             : #include "flddat.hxx"
      53             : 
      54             : /*************************************************************************
      55             :  *                      SwTxtFormatter::NewFldPortion()
      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         979 : SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
      73             :                                                 const SwTxtAttr *pHint ) const
      74             : {
      75         979 :     SwExpandPortion *pRet = 0;
      76         979 :     SwFrm *pFrame = (SwFrm*)pFrm;
      77         979 :     SwField *pFld = (SwField*)pHint->GetFmtFld().GetField();
      78         979 :     const bool bName = rInf.GetOpt().IsFldName();
      79             : 
      80         979 :     SwCharFmt* pChFmt = 0;
      81         979 :     bool bNewFlyPor = false;
      82         979 :     sal_uInt16 subType = 0;
      83             : 
      84             :     // set language
      85         979 :     ((SwTxtFormatter*)this)->SeekAndChg( rInf );
      86         979 :     if (pFld->GetLanguage() != GetFnt()->GetLanguage())
      87             :     {
      88         297 :         pFld->SetLanguage( GetFnt()->GetLanguage() );
      89             :         // let the visual note know about its new language
      90         297 :         if (pFld->GetTyp()->Which()==RES_POSTITFLD)
      91          51 :             const_cast<SwFmtFld*> (&pHint->GetFmtFld())->Broadcast( SwFmtFldHint( &pHint->GetFmtFld(), SWFMTFLD_LANGUAGE ) );
      92             :     }
      93             : 
      94         979 :     SwViewShell *pSh = rInf.GetVsh();
      95         979 :     SwDoc *const pDoc( (pSh) ? pSh->GetDoc() : 0 );
      96         979 :     bool const bInClipboard( (pDoc) ? pDoc->IsClipBoard() : true );
      97         979 :     bool bPlaceHolder = false;
      98             : 
      99         979 :     switch( pFld->GetTyp()->Which() )
     100             :     {
     101             :         case RES_SCRIPTFLD:
     102             :         case RES_POSTITFLD:
     103          54 :             pRet = new SwPostItsPortion( RES_SCRIPTFLD == pFld->GetTyp()->Which() );
     104          54 :             break;
     105             : 
     106             :         case RES_COMBINED_CHARS:
     107             :             {
     108           0 :                 if( bName )
     109           0 :                     pRet = new SwFldPortion( pFld->GetFieldName() );
     110             :                 else
     111           0 :                     pRet = new SwCombinedPortion( pFld->ExpandField(bInClipboard) );
     112             :             }
     113           0 :             break;
     114             : 
     115             :         case RES_HIDDENTXTFLD:
     116             :             {
     117             :                 OUString const aStr( (bName)
     118           0 :                         ? pFld->GetFieldName()
     119           0 :                         : pFld->ExpandField(bInClipboard) );
     120           0 :                 pRet = new SwHiddenPortion(aStr);
     121             :             }
     122           0 :             break;
     123             : 
     124             :         case RES_CHAPTERFLD:
     125           0 :             if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
     126             :             {
     127             :                 ((SwChapterField*)pFld)->ChangeExpansion( pFrame,
     128           0 :                                         &((SwTxtFld*)pHint)->GetTxtNode() );
     129             :             }
     130             :             {
     131             :                 OUString const aStr( (bName)
     132           0 :                         ? pFld->GetFieldName()
     133           0 :                         : pFld->ExpandField(bInClipboard) );
     134           0 :                 pRet = new SwFldPortion( aStr );
     135             :             }
     136           0 :             break;
     137             : 
     138             :         case RES_DOCSTATFLD:
     139         155 :             if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
     140             :             {
     141         126 :                 ((SwDocStatField*)pFld)->ChangeExpansion( pFrame );
     142             :             }
     143             :             {
     144             :                 OUString const aStr( (bName)
     145           0 :                         ? pFld->GetFieldName()
     146         155 :                         : pFld->ExpandField(bInClipboard) );
     147         155 :                 pRet = new SwFldPortion( aStr );
     148             :             }
     149         155 :             if(pRet)
     150         155 :                 ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_PAGECOOUNTFLD;
     151         155 :             break;
     152             : 
     153             :         case RES_PAGENUMBERFLD:
     154             :         {
     155         516 :             if( !bName && pSh && pSh->GetLayout() && !pSh->Imp()->IsUpdateExpFlds() )
     156             :             {
     157         423 :                 SwPageNumberFieldType *pPageNr = (SwPageNumberFieldType *)pFld->GetTyp();
     158             : 
     159         423 :                 const SwRootFrm* pTmpRootFrm = pSh->GetLayout();
     160         423 :                 const bool bVirt = pTmpRootFrm->IsVirtPageNum();
     161             : 
     162         423 :                 MSHORT nVirtNum = pFrame->GetVirtPageNum();
     163         423 :                 MSHORT nNumPages = pTmpRootFrm->GetPageNum();
     164         423 :                 sal_Int16 nNumFmt = -1;
     165         423 :                 if(SVX_NUM_PAGEDESC == pFld->GetFormat())
     166         374 :                     nNumFmt = pFrame->FindPageFrm()->GetPageDesc()->GetNumType().GetNumberingType();
     167             :                 static_cast<SwPageNumberField*>(pFld)
     168         423 :                     ->ChangeExpansion(nVirtNum, nNumPages);
     169             :                 pPageNr->ChangeExpansion(pDoc,
     170         423 :                                             bVirt, nNumFmt > -1 ? &nNumFmt : 0);
     171             :             }
     172             :             {
     173             :                 OUString const aStr( (bName)
     174           0 :                         ? pFld->GetFieldName()
     175         516 :                         : pFld->ExpandField(bInClipboard) );
     176         516 :                 pRet = new SwFldPortion( aStr );
     177             :             }
     178         516 :             if(pRet)
     179         516 :                 ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_PAGENUMBERFLD;
     180         516 :             break;
     181             :         }
     182             :         case RES_GETEXPFLD:
     183             :         {
     184           1 :             if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
     185             :             {
     186           1 :                 SwGetExpField* pExpFld = (SwGetExpField*)pFld;
     187           1 :                 if( !::lcl_IsInBody( pFrame ) )
     188             :                 {
     189           0 :                     pExpFld->ChgBodyTxtFlag( false );
     190           0 :                     pExpFld->ChangeExpansion( *pFrame, *((SwTxtFld*)pHint) );
     191             :                 }
     192           1 :                 else if( !pExpFld->IsInBodyTxt() )
     193             :                 {
     194             :                     // war vorher anders, also erst expandieren, dann umsetzen!!
     195           0 :                     pExpFld->ChangeExpansion( *pFrame, *((SwTxtFld*)pHint) );
     196           0 :                     pExpFld->ChgBodyTxtFlag( true );
     197             :                 }
     198             :             }
     199             :             {
     200             :                 OUString const aStr( (bName)
     201           0 :                         ? pFld->GetFieldName()
     202           1 :                         : pFld->ExpandField(bInClipboard) );
     203           1 :                 pRet = new SwFldPortion( aStr );
     204             :             }
     205           1 :             break;
     206             :         }
     207             :         case RES_DBFLD:
     208             :         {
     209           5 :             if( !bName )
     210             :             {
     211           5 :                 SwDBField* pDBFld = (SwDBField*)pFld;
     212           5 :                 pDBFld->ChgBodyTxtFlag( ::lcl_IsInBody( pFrame ) );
     213             :             }
     214             :             {
     215             :                 OUString const aStr( (bName)
     216           0 :                         ? pFld->GetFieldName()
     217           5 :                         : pFld->ExpandField(bInClipboard) );
     218           5 :                 pRet = new SwFldPortion(aStr);
     219             :             }
     220           5 :             break;
     221             :         }
     222             :         case RES_REFPAGEGETFLD:
     223           0 :             if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
     224             :             {
     225           0 :                 ((SwRefPageGetField*)pFld)->ChangeExpansion( pFrame, (SwTxtFld*)pHint );
     226             :             }
     227             :             {
     228             :                 OUString const aStr( (bName)
     229           0 :                         ? pFld->GetFieldName()
     230           0 :                         : pFld->ExpandField(bInClipboard) );
     231           0 :                 pRet = new SwFldPortion(aStr);
     232             :             }
     233           0 :             break;
     234             : 
     235             :         case RES_JUMPEDITFLD:
     236           1 :             if( !bName )
     237           1 :                 pChFmt =  ((SwJumpEditField*)pFld)->GetCharFmt();
     238           1 :             bNewFlyPor = true;
     239           1 :             bPlaceHolder = true;
     240           1 :             break;
     241             :         case RES_GETREFFLD:
     242          80 :             subType = ((SwGetRefField*)pFld)->GetSubType();
     243             :             {
     244             :                 OUString const str( (bName)
     245           0 :                         ? pFld->GetFieldName()
     246          80 :                         : pFld->ExpandField(bInClipboard) );
     247          80 :                 pRet = new SwFldPortion(str);
     248             :             }
     249          80 :             if(pRet)
     250             :             {
     251          80 :                 if( subType == REF_BOOKMARK  )
     252          80 :                     ((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_BOOKMARKFLD;
     253           0 :                 else if( subType == REF_SETREFATTR )
     254           0 :                     ((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_SETREFATTRFLD;
     255          80 :                 break;
     256             :             }
     257             :         case RES_DATETIMEFLD:
     258          37 :             subType = ((SwDateTimeField*)pFld)->GetSubType();
     259             :             {
     260             :                 OUString const str( (bName)
     261           0 :                         ? pFld->GetFieldName()
     262          37 :                         : pFld->ExpandField(bInClipboard) );
     263          37 :                 pRet = new SwFldPortion(str);
     264             :             }
     265          37 :             if(pRet)
     266             :             {
     267          37 :                 if( subType & DATEFLD  )
     268          34 :                     ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_DATEFLD;
     269           3 :                 else if( subType & TIMEFLD )
     270           3 :                     ((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_TIMEFLD;
     271          37 :                 break;
     272             :             }
     273             :         default:
     274             :             {
     275             :                 OUString const aStr( (bName)
     276           0 :                         ? pFld->GetFieldName()
     277         130 :                         : pFld->ExpandField(bInClipboard) );
     278         130 :                 pRet = new SwFldPortion(aStr);
     279             :             }
     280             :     }
     281             : 
     282         979 :     if( bNewFlyPor )
     283             :     {
     284           1 :         SwFont *pTmpFnt = 0;
     285           1 :         if( !bName )
     286             :         {
     287           1 :             pTmpFnt = new SwFont( *pFnt );
     288           1 :             pTmpFnt->SetDiffFnt( &pChFmt->GetAttrSet(), pFrm->GetTxtNode()->getIDocumentSettingAccess() );
     289             :         }
     290             :         {
     291             :             OUString const aStr( (bName)
     292           0 :                     ? pFld->GetFieldName()
     293           1 :                     : pFld->ExpandField(bInClipboard) );
     294           1 :             pRet = new SwFldPortion(aStr, pTmpFnt, bPlaceHolder);
     295             :         }
     296             :     }
     297             : 
     298         979 :     return pRet;
     299             : }
     300             : 
     301             : /*************************************************************************
     302             :  *                      SwTxtFormatter::TryNewNoLengthPortion()
     303             :  *************************************************************************/
     304             : 
     305          40 : static SwFldPortion * lcl_NewMetaPortion(SwTxtAttr & rHint, const bool bPrefix)
     306             : {
     307             :     ::sw::Meta *const pMeta(
     308          40 :         static_cast<SwFmtMeta &>(rHint.GetAttr()).GetMeta() );
     309          40 :     OUString fix;
     310          40 :     ::sw::MetaField *const pField( dynamic_cast< ::sw::MetaField * >(pMeta) );
     311             :     OSL_ENSURE(pField, "lcl_NewMetaPortion: no meta field?");
     312          40 :     if (pField)
     313             :     {
     314          40 :         pField->GetPrefixAndSuffix((bPrefix) ? &fix : 0, (bPrefix) ? 0 : &fix);
     315             :     }
     316          40 :     return new SwFldPortion( fix );
     317             : }
     318             : 
     319             : /** Try to create a new portion with zero length, for an end of a hint
     320             :     (where there is no CH_TXTATR). Because there may be multiple hint ends at a
     321             :     given index, m_nHintEndIndex is used to keep track of the already created
     322             :     portions. But the portions created here may actually be deleted again,
     323             :     due to Underflow. In that case, m_nHintEndIndex must be decremented,
     324             :     so the portion will be created again on the next line.
     325             :  */
     326             : SwExpandPortion *
     327      127160 : SwTxtFormatter::TryNewNoLengthPortion(SwTxtFormatInfo & rInfo)
     328             : {
     329      127160 :     if (pHints)
     330             :     {
     331       69337 :         const sal_Int32 nIdx(rInfo.GetIdx());
     332      177133 :         while (m_nHintEndIndex < pHints->GetEndCount())
     333             :         {
     334       88052 :             SwTxtAttr & rHint( *pHints->GetEnd(m_nHintEndIndex) );
     335       88052 :             sal_Int32 const nEnd( *rHint.GetAnyEnd() );
     336       88052 :             if (nEnd > nIdx)
     337             :             {
     338       49573 :                 break;
     339             :             }
     340       38479 :             ++m_nHintEndIndex;
     341       38479 :             if (nEnd == nIdx)
     342             :             {
     343       38218 :                 if (RES_TXTATR_METAFIELD == rHint.Which())
     344             :                 {
     345             :                     SwFldPortion *const pPortion(
     346          20 :                             lcl_NewMetaPortion(rHint, false));
     347          20 :                     pPortion->SetNoLength(); // no CH_TXTATR at hint end!
     348          20 :                     return pPortion;
     349             :                 }
     350             :             }
     351             :         }
     352             :     }
     353      127140 :     return 0;
     354             : }
     355             : 
     356             : /*************************************************************************
     357             :  *                      SwTxtFormatter::NewExtraPortion()
     358             :  *************************************************************************/
     359             : 
     360        3118 : SwLinePortion *SwTxtFormatter::NewExtraPortion( SwTxtFormatInfo &rInf )
     361             : {
     362        3118 :     SwTxtAttr *pHint = GetAttr( rInf.GetIdx() );
     363        3118 :     SwLinePortion *pRet = 0;
     364        3118 :     if( !pHint )
     365             :     {
     366           0 :         pRet = new SwTxtPortion;
     367           0 :         pRet->SetLen( 1 );
     368           0 :         rInf.SetLen( 1 );
     369           0 :         return pRet;
     370             :     }
     371             : 
     372        3118 :     switch( pHint->Which() )
     373             :     {
     374             :     case RES_TXTATR_FLYCNT :
     375             :         {
     376        1485 :             pRet = NewFlyCntPortion( rInf, pHint );
     377        1485 :             break;
     378             :         }
     379             :     case RES_TXTATR_FTN :
     380             :         {
     381         123 :             pRet = NewFtnPortion( rInf, pHint );
     382         123 :             break;
     383             :         }
     384             :     case RES_TXTATR_FIELD :
     385             :     case RES_TXTATR_ANNOTATION :
     386             :         {
     387         979 :             pRet = NewFldPortion( rInf, pHint );
     388         979 :             break;
     389             :         }
     390             :     case RES_TXTATR_REFMARK :
     391             :         {
     392          76 :             pRet = new SwIsoRefPortion;
     393          76 :             break;
     394             :         }
     395             :     case RES_TXTATR_TOXMARK :
     396             :         {
     397         191 :             pRet = new SwIsoToxPortion;
     398         191 :             break;
     399             :         }
     400             :     case RES_TXTATR_METAFIELD:
     401             :         {
     402          20 :             pRet = lcl_NewMetaPortion( *pHint, true );
     403          20 :             break;
     404             :         }
     405             :     default: ;
     406             :     }
     407        3118 :     if( !pRet )
     408             :     {
     409         244 :         const OUString aNothing;
     410         244 :         pRet = new SwFldPortion( aNothing );
     411         244 :         rInf.SetLen( 1 );
     412             :     }
     413        3118 :     return pRet;
     414             : }
     415             : 
     416             : /*************************************************************************
     417             :  *                      SwTxtFormatter::NewNumberPortion()
     418             :  *************************************************************************/
     419             : 
     420        3219 : SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const
     421             : {
     422        9657 :     if( rInf.IsNumDone() || rInf.GetTxtStart() != nStart
     423        6438 :                 || rInf.GetTxtStart() != rInf.GetIdx() )
     424           0 :         return 0;
     425             : 
     426        3219 :     SwNumberPortion *pRet = 0;
     427        3219 :     const SwTxtNode* pTxtNd = GetTxtFrm()->GetTxtNode();
     428        3219 :     const SwNumRule* pNumRule = pTxtNd->GetNumRule();
     429             : 
     430             :     // hat ein "gueltige" Nummer ?
     431        3219 :     if( pTxtNd->IsNumbered() && pTxtNd->IsCountedInList())
     432             :     {
     433        3216 :         int nLevel = pTxtNd->GetActualListLevel();
     434             : 
     435        3216 :         if (nLevel < 0)
     436           0 :             nLevel = 0;
     437             : 
     438        3216 :         if (nLevel >= MAXLEVEL)
     439           0 :             nLevel = MAXLEVEL - 1;
     440             : 
     441        3216 :         const SwNumFmt &rNumFmt = pNumRule->Get( nLevel );
     442        3216 :         const bool bLeft = SVX_ADJUST_LEFT == rNumFmt.GetNumAdjust();
     443        3216 :         const bool bCenter = SVX_ADJUST_CENTER == rNumFmt.GetNumAdjust();
     444             :         const bool bLabelAlignmentPosAndSpaceModeActive(
     445        3216 :                 rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT );
     446             :         const KSHORT nMinDist = bLabelAlignmentPosAndSpaceModeActive
     447        3216 :                                 ? 0 : rNumFmt.GetCharTextDistance();
     448             : 
     449        3216 :         if( SVX_NUM_BITMAP == rNumFmt.GetNumberingType() )
     450             :         {
     451          70 :             pRet = new SwGrfNumPortion( (SwFrm*)GetTxtFrm(),
     452             :                                         pTxtNd->GetLabelFollowedBy(),
     453          70 :                                         rNumFmt.GetBrush(),
     454             :                                         rNumFmt.GetGraphicOrientation(),
     455          70 :                                         rNumFmt.GetGraphicSize(),
     456             :                                         bLeft, bCenter, nMinDist,
     457         210 :                                         bLabelAlignmentPosAndSpaceModeActive );
     458          70 :             long nTmpA = rInf.GetLast()->GetAscent();
     459          70 :             long nTmpD = rInf.GetLast()->Height() - nTmpA;
     460          70 :             if( !rInf.IsTest() )
     461          35 :                 ((SwGrfNumPortion*)pRet)->SetBase( nTmpA, nTmpD, nTmpA, nTmpD );
     462             :         }
     463             :         else
     464             :         {
     465             :             // Der SwFont wird dynamisch angelegt und im CTOR uebergeben,
     466             :             // weil das CharFmt nur einen SV-Font zurueckliefert.
     467             :             // Im Dtor vom SwNumberPortion wird der SwFont deletet.
     468        3146 :             SwFont *pNumFnt = 0;
     469        3146 :             const SwAttrSet* pFmt = rNumFmt.GetCharFmt() ?
     470        1264 :                                     &rNumFmt.GetCharFmt()->GetAttrSet() :
     471        4410 :                                     NULL;
     472        3146 :             const IDocumentSettingAccess* pIDSA = pTxtNd->getIDocumentSettingAccess();
     473             : 
     474        3146 :             if( SVX_NUM_CHAR_SPECIAL == rNumFmt.GetNumberingType() )
     475             :             {
     476        2505 :                 const Font *pFmtFnt = rNumFmt.GetBulletFont();
     477             : 
     478             :                 // Build a new bullet font basing on the current paragraph font:
     479             : 
     480        2505 :                 pNumFnt = new SwFont( &rInf.GetCharAttr(), pIDSA );
     481             : 
     482             :                 // #i53199#
     483        2505 :                 if ( !pIDSA->get(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT) )
     484             :                 {
     485             :                     // i18463:
     486             :                     // Underline style of paragraph font should not be considered
     487             :                     // Overline style of paragraph font should not be considered
     488             :                     // Weight style of paragraph font should not be considered
     489             :                     // Posture style of paragraph font should not be considered
     490        2505 :                     pNumFnt->SetUnderline( UNDERLINE_NONE );
     491        2505 :                     pNumFnt->SetOverline( UNDERLINE_NONE );
     492        2505 :                     pNumFnt->SetItalic( ITALIC_NONE, SW_LATIN );
     493        2505 :                     pNumFnt->SetItalic( ITALIC_NONE, SW_CJK );
     494        2505 :                     pNumFnt->SetItalic( ITALIC_NONE, SW_CTL );
     495        2505 :                     pNumFnt->SetWeight( WEIGHT_NORMAL, SW_LATIN );
     496        2505 :                     pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CJK );
     497        2505 :                     pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CTL );
     498             :                 }
     499             : 
     500             :                 // Apply the explicit attributes from the character style
     501             :                 // associated with the numering to the new bullet font.
     502             : 
     503        2505 :                 if( pFmt )
     504        1033 :                     pNumFnt->SetDiffFnt( pFmt, pIDSA );
     505             : 
     506        2505 :                 if ( pFmtFnt )
     507             :                 {
     508        2337 :                     const sal_uInt8 nAct = pNumFnt->GetActual();
     509        2337 :                     pNumFnt->SetFamily( pFmtFnt->GetFamily(), nAct );
     510        2337 :                     pNumFnt->SetName( pFmtFnt->GetName(), nAct );
     511        2337 :                     pNumFnt->SetStyleName( pFmtFnt->GetStyleName(), nAct );
     512        2337 :                     pNumFnt->SetCharSet( pFmtFnt->GetCharSet(), nAct );
     513        2337 :                     pNumFnt->SetPitch( pFmtFnt->GetPitch(), nAct );
     514             :                 }
     515             : 
     516             :                 // we do not allow a vertical font
     517        2505 :                 pNumFnt->SetVertical( pNumFnt->GetOrientation(),
     518        5010 :                                       pFrm->IsVertical() );
     519             : 
     520             :                 // --> OD 2008-01-23 #newlistelevelattrs#
     521        2505 :                 pRet = new SwBulletPortion( rNumFmt.GetBulletChar(),
     522             :                                             pTxtNd->GetLabelFollowedBy(),
     523             :                                             pNumFnt,
     524             :                                             bLeft, bCenter, nMinDist,
     525        2505 :                                             bLabelAlignmentPosAndSpaceModeActive );
     526             :             }
     527             :             else
     528             :             {
     529         641 :                 OUString aTxt( pTxtNd->GetNumString() );
     530         641 :                 if ( !aTxt.isEmpty() )
     531             :                 {
     532         609 :                     aTxt += pTxtNd->GetLabelFollowedBy();
     533             :                 }
     534             : 
     535             :                 // 7974: Nicht nur eine Optimierung...
     536             :                 // Eine Numberportion ohne Text wird die Breite von 0
     537             :                 // erhalten. Die nachfolgende Textportion wird im BreakLine
     538             :                 // in das BreakCut laufen, obwohl rInf.GetLast()->GetFlyPortion()
     539             :                 // vorliegt!
     540         641 :                 if( !aTxt.isEmpty() )
     541             :                 {
     542             : 
     543             :                     // Build a new numbering font basing on the current paragraph font:
     544             : 
     545         609 :                     pNumFnt = new SwFont( &rInf.GetCharAttr(), pIDSA );
     546             : 
     547             :                     // #i53199#
     548         609 :                     if ( !pIDSA->get(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT) )
     549             :                     {
     550             :                         // i18463:
     551             :                         // Underline style of paragraph font should not be considered
     552         609 :                         pNumFnt->SetUnderline( UNDERLINE_NONE );
     553             :                         // Overline style of paragraph font should not be considered
     554         609 :                         pNumFnt->SetOverline( UNDERLINE_NONE );
     555             :                     }
     556             : 
     557             :                     // Apply the explicit attributes from the character style
     558             :                     // associated with the numering to the new bullet font.
     559             : 
     560         609 :                     if( pFmt )
     561         225 :                         pNumFnt->SetDiffFnt( pFmt, pIDSA );
     562             : 
     563             :                     // we do not allow a vertical font
     564         609 :                     pNumFnt->SetVertical( pNumFnt->GetOrientation(), pFrm->IsVertical() );
     565             : 
     566             :                     pRet = new SwNumberPortion( aTxt, pNumFnt,
     567             :                                                 bLeft, bCenter, nMinDist,
     568         609 :                                                 bLabelAlignmentPosAndSpaceModeActive );
     569         641 :                 }
     570             :             }
     571             :         }
     572             :     }
     573        3219 :     return pRet;
     574             : }
     575             : 
     576             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10