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