LCOV - code coverage report
Current view: top level - sw/source/core/txtnode - swfont.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 488 686 71.1 %
Date: 2012-08-25 Functions: 23 28 82.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 419 965 43.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <hintids.hxx>
      30                 :            : 
      31                 :            : #include <com/sun/star/i18n/ScriptType.hpp>
      32                 :            : #include <vcl/outdev.hxx>
      33                 :            : #include <unotools/localedatawrapper.hxx>
      34                 :            : #include <editeng/unolingu.hxx>
      35                 :            : #include <editeng/brshitem.hxx>
      36                 :            : #include <editeng/wrlmitem.hxx>
      37                 :            : #include <editeng/blnkitem.hxx>
      38                 :            : #include <editeng/nhypitem.hxx>
      39                 :            : #include <editeng/kernitem.hxx>
      40                 :            : #include <editeng/cmapitem.hxx>
      41                 :            : #include <editeng/langitem.hxx>
      42                 :            : #include <editeng/escpitem.hxx>
      43                 :            : #include <editeng/akrnitem.hxx>
      44                 :            : #include <editeng/shdditem.hxx>
      45                 :            : #include <editeng/charreliefitem.hxx>
      46                 :            : #include <editeng/cntritem.hxx>
      47                 :            : #include <editeng/colritem.hxx>
      48                 :            : #include <editeng/cscoitem.hxx>
      49                 :            : #include <editeng/crsditem.hxx>
      50                 :            : #include <editeng/udlnitem.hxx>
      51                 :            : #include <editeng/wghtitem.hxx>
      52                 :            : #include <editeng/postitem.hxx>
      53                 :            : #include <editeng/fhgtitem.hxx>
      54                 :            : #include <editeng/fontitem.hxx>
      55                 :            : #include <editeng/emphitem.hxx>
      56                 :            : #include <editeng/charscaleitem.hxx>
      57                 :            : #include <editeng/charrotateitem.hxx>
      58                 :            : #include <editeng/twolinesitem.hxx>
      59                 :            : #include <editeng/charhiddenitem.hxx>
      60                 :            : #include <IDocumentSettingAccess.hxx>
      61                 :            : #include <vcl/window.hxx>
      62                 :            : #include <charatr.hxx>
      63                 :            : #include <viewsh.hxx>       // Bildschirmabgleich
      64                 :            : #include <swfont.hxx>
      65                 :            : #include <fntcache.hxx>     // FontCache
      66                 :            : #include <txtfrm.hxx>       // SwTxtFrm
      67                 :            : #include <scriptinfo.hxx>
      68                 :            : 
      69                 :            : #ifdef DBG_UTIL
      70                 :            : // global Variable
      71                 :            : SvStatistics g_SvStat;
      72                 :            : #endif
      73                 :            : 
      74                 :            : using namespace ::com::sun::star;
      75                 :            : 
      76                 :            : /************************************************************************
      77                 :            :  * Hintergrundbrush setzen, z.B. bei Zeichenvorlagen
      78                 :            :  ***********************************************************************/
      79                 :            : 
      80                 :       2870 : void SwFont::SetBackColor( Color* pNewColor )
      81                 :            : {
      82                 :       2870 :     delete pBackColor;
      83                 :       2870 :     pBackColor = pNewColor;
      84                 :       2870 :     bFntChg = sal_True;
      85                 :       2870 :     aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
      86                 :       2870 : }
      87                 :            : 
      88                 :            : // maps directions for vertical layout
      89                 :      12210 : sal_uInt16 MapDirection( sal_uInt16 nDir, const sal_Bool bVertFormat )
      90                 :            : {
      91         [ -  + ]:      12210 :     if ( bVertFormat )
      92                 :            :     {
      93   [ #  #  #  # ]:          0 :         switch ( nDir )
      94                 :            :         {
      95                 :            :         case 0 :
      96                 :          0 :             nDir = 2700;
      97                 :          0 :             break;
      98                 :            :         case 900 :
      99                 :          0 :             nDir = 0;
     100                 :          0 :             break;
     101                 :            :         case 2700 :
     102                 :          0 :             nDir = 1800;
     103                 :          0 :             break;
     104                 :            : #if OSL_DEBUG_LEVEL > 0
     105                 :            :         default :
     106                 :            :             OSL_FAIL( "Unsupported direction" );
     107                 :            :             break;
     108                 :            : #endif
     109                 :            :         }
     110                 :            :     }
     111                 :      12210 :     return nDir;
     112                 :            : }
     113                 :            : 
     114                 :            : // maps the absolute direction set at the font to its logical conterpart
     115                 :            : // in the rotated environment
     116                 :       6918 : sal_uInt16 UnMapDirection( sal_uInt16 nDir, const sal_Bool bVertFormat )
     117                 :            : {
     118         [ -  + ]:       6918 :     if ( bVertFormat )
     119                 :            :     {
     120   [ #  #  #  # ]:          0 :         switch ( nDir )
     121                 :            :         {
     122                 :            :         case 0 :
     123                 :          0 :             nDir = 900;
     124                 :          0 :             break;
     125                 :            :         case 1800 :
     126                 :          0 :             nDir = 2700;
     127                 :          0 :             break;
     128                 :            :         case 2700 :
     129                 :          0 :             nDir = 0;
     130                 :          0 :             break;
     131                 :            : #if OSL_DEBUG_LEVEL > 0
     132                 :            :         default :
     133                 :            :             OSL_FAIL( "Unsupported direction" );
     134                 :            :             break;
     135                 :            : #endif
     136                 :            :         }
     137                 :            :     }
     138                 :       6918 :     return nDir;
     139                 :            : }
     140                 :            : 
     141                 :       3086 : sal_uInt16 SwFont::GetOrientation( const sal_Bool bVertFormat ) const
     142                 :            : {
     143                 :       3086 :     return UnMapDirection( aSub[nActual].GetOrientation(), bVertFormat );
     144                 :            : }
     145                 :            : 
     146                 :      12210 : void SwFont::SetVertical( sal_uInt16 nDir, const sal_Bool bVertFormat )
     147                 :            : {
     148                 :            :     // map direction if frame has vertical layout
     149                 :      12210 :     nDir = MapDirection( nDir, bVertFormat );
     150                 :            : 
     151         [ +  + ]:      12210 :     if( nDir != aSub[0].GetOrientation() )
     152                 :            :     {
     153                 :       1454 :         bFntChg = sal_True;
     154                 :       1454 :         aSub[0].SetVertical( nDir, bVertFormat );
     155 [ -  + ][ +  - ]:       1454 :         aSub[1].SetVertical( nDir, bVertFormat || nDir > 1000 );
     156                 :       1454 :         aSub[2].SetVertical( nDir, bVertFormat );
     157                 :            :     }
     158                 :      12210 : }
     159                 :            : 
     160                 :            : /*************************************************************************
     161                 :            :  Escapement:
     162                 :            :     frEsc:  Fraction, Grad des Escapements
     163                 :            :     Esc = resultierendes Escapement
     164                 :            :     A1 = Original-Ascent            (nOrgAscent)
     165                 :            :     A2 = verkleinerter Ascent       (nEscAscent)
     166                 :            :     Ax = resultierender Ascent      (GetAscent())
     167                 :            :     H1 = Original-Hoehe             (nOrgHeight)
     168                 :            :     H2 = verkleinerter Hoehe        (nEscHeight)
     169                 :            :     Hx = resultierender Hoehe       (GetHeight())
     170                 :            :     Bx = resultierende Baseline fuer die Textausgabe (CalcPos())
     171                 :            :          (Vorsicht: Y - A1!)
     172                 :            : 
     173                 :            :     Escapement:
     174                 :            :         Esc = H1 * frEsc;
     175                 :            : 
     176                 :            :     Hochstellung:
     177                 :            :         Ax = A2 + Esc;
     178                 :            :         Hx = H2 + Esc;
     179                 :            :         Bx = A1 - Esc;
     180                 :            : 
     181                 :            :     Tiefstellung:
     182                 :            :         Ax = A1;
     183                 :            :         Hx = A1 + Esc + (H2 - A2);
     184                 :            :         Bx = A1 + Esc;
     185                 :            : 
     186                 :            : *************************************************************************/
     187                 :            : 
     188                 :            : /*************************************************************************
     189                 :            :  *                  SwSubFont::CalcEscAscent( const sal_uInt16 nOldAscent )
     190                 :            :  *************************************************************************/
     191                 :            : 
     192                 :            : // nEsc ist der Prozentwert
     193                 :       6670 : sal_uInt16 SwSubFont::CalcEscAscent( const sal_uInt16 nOldAscent ) const
     194                 :            : {
     195   [ +  +  +  - ]:      13032 :     if( DFLT_ESC_AUTO_SUPER != GetEscapement() &&
                 [ +  + ]
     196                 :       6362 :         DFLT_ESC_AUTO_SUB != GetEscapement() )
     197                 :            :     {
     198                 :            :         const long nAscent = nOldAscent +
     199                 :       6362 :                              ( (long) nOrgHeight * GetEscapement() ) / 100L;
     200         [ +  - ]:       6362 :         if ( nAscent>0 )
     201                 :       6362 :             return ( Max( sal_uInt16 (nAscent), nOrgAscent ));
     202                 :            :     }
     203                 :       6670 :     return nOrgAscent;
     204                 :            : }
     205                 :            : 
     206                 :            : /*************************************************************************
     207                 :            :  *                      SwFont::SetDiffFnt()
     208                 :            :  *************************************************************************/
     209                 :            : 
     210                 :        836 : void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
     211                 :            :                          const IDocumentSettingAccess *pIDocumentSettingAccess )
     212                 :            : {
     213                 :        836 :     delete pBackColor;
     214                 :        836 :     pBackColor = NULL;
     215                 :            : 
     216         [ +  - ]:        836 :     if( pAttrSet )
     217                 :            :     {
     218                 :            :         const SfxPoolItem* pItem;
     219         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_FONT,
     220         [ +  - ]:        836 :             sal_True, &pItem ))
     221                 :            :         {
     222                 :         24 :             const SvxFontItem *pFont = (const SvxFontItem *)pItem;
     223         [ +  - ]:         24 :             aSub[SW_LATIN].SetFamily( pFont->GetFamily() );
     224 [ +  - ][ +  - ]:         24 :             aSub[SW_LATIN].Font::SetName( pFont->GetFamilyName() );
     225         [ +  - ]:         24 :             aSub[SW_LATIN].Font::SetStyleName( pFont->GetStyleName() );
     226         [ +  - ]:         24 :             aSub[SW_LATIN].Font::SetPitch( pFont->GetPitch() );
     227         [ +  - ]:         24 :             aSub[SW_LATIN].Font::SetCharSet( pFont->GetCharSet() );
     228                 :            :         }
     229         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_FONTSIZE,
     230         [ +  - ]:        836 :             sal_True, &pItem ))
     231                 :            :         {
     232                 :        294 :             const SvxFontHeightItem *pHeight = (const SvxFontHeightItem *)pItem;
     233                 :        294 :             aSub[SW_LATIN].SvxFont::SetPropr( 100 );
     234         [ +  - ]:        294 :             aSub[SW_LATIN].aSize = aSub[SW_LATIN].Font::GetSize();
     235                 :        294 :             Size aTmpSize = aSub[SW_LATIN].aSize;
     236                 :        294 :             aTmpSize.Height() = pHeight->GetHeight();
     237         [ +  - ]:        294 :             aSub[SW_LATIN].SetSize( aTmpSize );
     238                 :            :         }
     239         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_POSTURE,
     240         [ +  - ]:        836 :             sal_True, &pItem ))
     241         [ +  - ]:         60 :             aSub[SW_LATIN].Font::SetItalic( ((SvxPostureItem*)pItem)->GetPosture() );
     242         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_WEIGHT,
     243         [ +  - ]:        836 :             sal_True, &pItem ))
     244         [ +  - ]:          6 :             aSub[SW_LATIN].Font::SetWeight( ((SvxWeightItem*)pItem)->GetWeight() );
     245         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_LANGUAGE,
     246         [ +  - ]:        836 :             sal_True, &pItem ))
     247         [ #  # ]:          0 :             aSub[SW_LATIN].SetLanguage( ((SvxLanguageItem*)pItem)->GetLanguage() );
     248                 :            : 
     249         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CJK_FONT,
     250         [ +  - ]:        836 :             sal_True, &pItem ))
     251                 :            :         {
     252                 :         12 :             const SvxFontItem *pFont = (const SvxFontItem *)pItem;
     253         [ +  - ]:         12 :             aSub[SW_CJK].SetFamily( pFont->GetFamily() );
     254 [ +  - ][ +  - ]:         12 :             aSub[SW_CJK].Font::SetName( pFont->GetFamilyName() );
     255         [ +  - ]:         12 :             aSub[SW_CJK].Font::SetStyleName( pFont->GetStyleName() );
     256         [ +  - ]:         12 :             aSub[SW_CJK].Font::SetPitch( pFont->GetPitch() );
     257         [ +  - ]:         12 :             aSub[SW_CJK].Font::SetCharSet( pFont->GetCharSet() );
     258                 :            :         }
     259         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CJK_FONTSIZE,
     260         [ +  - ]:        836 :             sal_True, &pItem ))
     261                 :            :         {
     262                 :        288 :             const SvxFontHeightItem *pHeight = (const SvxFontHeightItem *)pItem;
     263                 :        288 :             aSub[SW_CJK].SvxFont::SetPropr( 100 );
     264         [ +  - ]:        288 :             aSub[SW_CJK].aSize = aSub[SW_CJK].Font::GetSize();
     265                 :        288 :             Size aTmpSize = aSub[SW_CJK].aSize;
     266                 :        288 :             aTmpSize.Height() = pHeight->GetHeight();
     267         [ +  - ]:        288 :             aSub[SW_CJK].SetSize( aTmpSize );
     268                 :            :         }
     269         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CJK_POSTURE,
     270         [ +  - ]:        836 :             sal_True, &pItem ))
     271         [ +  - ]:         60 :             aSub[SW_CJK].Font::SetItalic( ((SvxPostureItem*)pItem)->GetPosture() );
     272         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CJK_WEIGHT,
     273         [ +  - ]:        836 :             sal_True, &pItem ))
     274         [ #  # ]:          0 :             aSub[SW_CJK].Font::SetWeight( ((SvxWeightItem*)pItem)->GetWeight() );
     275         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CJK_LANGUAGE,
     276         [ +  - ]:        836 :             sal_True, &pItem ))
     277                 :            :         {
     278                 :          0 :             LanguageType eNewLang = ((SvxLanguageItem*)pItem)->GetLanguage();
     279         [ #  # ]:          0 :             aSub[SW_CJK].SetLanguage( eNewLang );
     280         [ #  # ]:          0 :             aSub[SW_LATIN].SetCJKContextLanguage( eNewLang );
     281         [ #  # ]:          0 :             aSub[SW_CJK].SetCJKContextLanguage( eNewLang );
     282         [ #  # ]:          0 :             aSub[SW_CTL].SetCJKContextLanguage( eNewLang );
     283                 :            :         }
     284                 :            : 
     285         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CTL_FONT,
     286         [ +  - ]:        836 :             sal_True, &pItem ))
     287                 :            :         {
     288                 :         18 :             const SvxFontItem *pFont = (const SvxFontItem *)pItem;
     289         [ +  - ]:         18 :             aSub[SW_CTL].SetFamily( pFont->GetFamily() );
     290 [ +  - ][ +  - ]:         18 :             aSub[SW_CTL].Font::SetName( pFont->GetFamilyName() );
     291         [ +  - ]:         18 :             aSub[SW_CTL].Font::SetStyleName( pFont->GetStyleName() );
     292         [ +  - ]:         18 :             aSub[SW_CTL].Font::SetPitch( pFont->GetPitch() );
     293         [ +  - ]:         18 :             aSub[SW_CTL].Font::SetCharSet( pFont->GetCharSet() );
     294                 :            :         }
     295         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CTL_FONTSIZE,
     296         [ +  - ]:        836 :             sal_True, &pItem ))
     297                 :            :         {
     298                 :        288 :             const SvxFontHeightItem *pHeight = (const SvxFontHeightItem *)pItem;
     299                 :        288 :             aSub[SW_CTL].SvxFont::SetPropr( 100 );
     300         [ +  - ]:        288 :             aSub[SW_CTL].aSize = aSub[SW_CTL].Font::GetSize();
     301                 :        288 :             Size aTmpSize = aSub[SW_CTL].aSize;
     302                 :        288 :             aTmpSize.Height() = pHeight->GetHeight();
     303         [ +  - ]:        288 :             aSub[SW_CTL].SetSize( aTmpSize );
     304                 :            :         }
     305         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CTL_POSTURE,
     306         [ +  - ]:        836 :             sal_True, &pItem ))
     307         [ +  - ]:         60 :             aSub[SW_CTL].Font::SetItalic( ((SvxPostureItem*)pItem)->GetPosture() );
     308         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CTL_WEIGHT,
     309         [ +  - ]:        836 :             sal_True, &pItem ))
     310         [ #  # ]:          0 :             aSub[SW_CTL].Font::SetWeight( ((SvxWeightItem*)pItem)->GetWeight() );
     311         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CTL_LANGUAGE,
     312         [ +  - ]:        836 :             sal_True, &pItem ))
     313         [ #  # ]:          0 :             aSub[SW_CTL].SetLanguage( ((SvxLanguageItem*)pItem)->GetLanguage() );
     314                 :            : 
     315         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_UNDERLINE,
     316         [ +  - ]:        836 :             sal_True, &pItem ))
     317                 :            :         {
     318         [ +  - ]:        283 :             SetUnderline( ((SvxUnderlineItem*)pItem)->GetLineStyle() );
     319                 :        283 :             SetUnderColor( ((SvxUnderlineItem*)pItem)->GetColor() );
     320                 :            :         }
     321         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_OVERLINE,
     322         [ +  - ]:        836 :             sal_True, &pItem ))
     323                 :            :         {
     324         [ #  # ]:          0 :             SetOverline( ((SvxOverlineItem*)pItem)->GetLineStyle() );
     325                 :          0 :             SetOverColor( ((SvxOverlineItem*)pItem)->GetColor() );
     326                 :            :         }
     327         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CROSSEDOUT,
     328         [ +  - ]:        836 :             sal_True, &pItem ))
     329         [ #  # ]:          0 :             SetStrikeout( ((SvxCrossedOutItem*)pItem)->GetStrikeout() );
     330         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_COLOR,
     331         [ +  - ]:        836 :             sal_True, &pItem ))
     332         [ +  - ]:          7 :             SetColor( ((SvxColorItem*)pItem)->GetValue() );
     333         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_EMPHASIS_MARK,
     334         [ +  - ]:        836 :             sal_True, &pItem ))
     335         [ +  - ]:        276 :             SetEmphasisMark( ((SvxEmphasisMarkItem*)pItem)->GetEmphasisMark() );
     336                 :            : 
     337         [ +  - ]:        836 :         SetTransparent( sal_True );
     338         [ +  - ]:        836 :         SetAlign( ALIGN_BASELINE );
     339         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CONTOUR,
     340         [ +  - ]:        836 :             sal_True, &pItem ))
     341         [ #  # ]:          0 :             SetOutline( ((SvxContourItem*)pItem)->GetValue() );
     342         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_SHADOWED,
     343         [ +  - ]:        836 :             sal_True, &pItem ))
     344         [ #  # ]:          0 :             SetShadow( ((SvxShadowedItem*)pItem)->GetValue() );
     345         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_RELIEF,
     346         [ +  - ]:        836 :             sal_True, &pItem ))
     347         [ #  # ]:          0 :             SetRelief( (FontRelief)((SvxCharReliefItem*)pItem)->GetValue() );
     348         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_SHADOWED,
     349         [ +  - ]:        836 :             sal_True, &pItem ))
     350         [ #  # ]:          0 :             SetPropWidth(((SvxShadowedItem*)pItem)->GetValue() ? 50 : 100 );
     351         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_AUTOKERN,
     352         [ +  - ]:        836 :             sal_True, &pItem ))
     353                 :            :         {
     354         [ #  # ]:          0 :             if( ((SvxAutoKernItem*)pItem)->GetValue() )
     355                 :            :             {
     356                 :            :                 SetAutoKern( ( !pIDocumentSettingAccess ||
     357         [ #  # ]:          0 :                                !pIDocumentSettingAccess->get(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION) ) ?
     358                 :            :                                 KERNING_FONTSPECIFIC :
     359 [ #  # ][ #  # ]:          0 :                                 KERNING_ASIAN );
                 [ #  # ]
     360                 :            :             }
     361                 :            :             else
     362         [ #  # ]:          0 :                 SetAutoKern( 0 );
     363                 :            :         }
     364         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_WORDLINEMODE,
     365         [ +  - ]:        836 :             sal_True, &pItem ))
     366         [ #  # ]:          0 :             SetWordLineMode( ((SvxWordLineModeItem*)pItem)->GetValue() );
     367                 :            : 
     368         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_ESCAPEMENT,
     369         [ +  - ]:        836 :             sal_True, &pItem ))
     370                 :            :         {
     371                 :        296 :             const SvxEscapementItem *pEsc = (const SvxEscapementItem *)pItem;
     372                 :        296 :             SetEscapement( pEsc->GetEsc() );
     373         [ +  - ]:        296 :             if( aSub[SW_LATIN].IsEsc() )
     374         [ +  - ]:        296 :                 SetProportion( pEsc->GetProp() );
     375                 :            :         }
     376         [ +  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CASEMAP,
     377         [ +  - ]:        836 :             sal_True, &pItem ))
     378                 :          7 :             SetCaseMap( ((SvxCaseMapItem*)pItem)->GetCaseMap() );
     379         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_KERNING,
     380         [ +  - ]:        836 :             sal_True, &pItem ))
     381                 :          0 :             SetFixKerning( ((SvxKerningItem*)pItem)->GetValue() );
     382         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_NOHYPHEN,
     383         [ +  - ]:        836 :             sal_True, &pItem ))
     384                 :          0 :             SetNoHyph( ((SvxNoHyphenItem*)pItem)->GetValue() );
     385         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BLINK,
     386         [ +  - ]:        836 :             sal_True, &pItem ))
     387                 :          0 :             SetBlink( ((SvxBlinkItem*)pItem)->GetValue() );
     388         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_ROTATE,
     389         [ +  - ]:        836 :             sal_True, &pItem ))
     390         [ #  # ]:          0 :             SetVertical( ((SvxCharRotateItem*)pItem)->GetValue() );
     391         [ -  + ]:        836 :         if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BACKGROUND,
     392         [ +  - ]:        836 :             sal_True, &pItem ))
     393         [ #  # ]:          0 :             pBackColor = new Color( ((SvxBrushItem*)pItem)->GetColor() );
     394                 :            :         else
     395                 :        836 :             pBackColor = NULL;
     396                 :        836 :         const SfxPoolItem* pTwoLinesItem = 0;
     397         [ -  + ]:        836 :         if( SFX_ITEM_SET ==
     398         [ +  - ]:        836 :                 pAttrSet->GetItemState( RES_CHRATR_TWO_LINES, sal_True, &pTwoLinesItem ))
     399         [ #  # ]:          0 :             if ( ((SvxTwoLinesItem*)pTwoLinesItem)->GetValue() )
     400         [ #  # ]:        836 :                 SetVertical( 0 );
     401                 :            :     }
     402                 :            :     else
     403                 :            :     {
     404                 :          0 :         Invalidate();
     405                 :          0 :         bNoHyph = sal_False;
     406                 :          0 :         bBlink = sal_False;
     407                 :            :     }
     408                 :        836 :     bPaintBlank = sal_False;
     409                 :        836 :     bPaintWrong = sal_False;
     410                 :            :     OSL_ENSURE( aSub[SW_LATIN].IsTransparent(), "SwFont: Transparent revolution" );
     411                 :        836 : }
     412                 :            : 
     413                 :            : /*************************************************************************
     414                 :            :  *                      class SwFont
     415                 :            :  *************************************************************************/
     416                 :            : 
     417 [ +  - ][ +  + ]:     786392 : SwFont::SwFont( const SwFont &rFont )
           [ #  #  #  # ]
     418                 :            : {
     419         [ +  - ]:     196598 :     aSub[SW_LATIN] = rFont.aSub[SW_LATIN];
     420         [ +  - ]:     196598 :     aSub[SW_CJK] = rFont.aSub[SW_CJK];
     421         [ +  - ]:     196598 :     aSub[SW_CTL] = rFont.aSub[SW_CTL];
     422                 :     196598 :     nActual = rFont.nActual;
     423 [ +  + ][ +  - ]:     196598 :     pBackColor = rFont.pBackColor ? new Color( *rFont.pBackColor ) : NULL;
     424                 :     196598 :     aUnderColor = rFont.GetUnderColor();
     425                 :     196598 :     aOverColor  = rFont.GetOverColor();
     426                 :     196598 :     nToxCnt = 0;
     427                 :     196598 :     nRefCnt = 0;
     428                 :     196598 :     m_nMetaCount = 0;
     429                 :     196598 :     bFntChg = rFont.bFntChg;
     430                 :     196598 :     bOrgChg = rFont.bOrgChg;
     431                 :     196598 :     bPaintBlank = rFont.bPaintBlank;
     432                 :     196598 :     bPaintWrong = sal_False;
     433                 :     196598 :     bURL = rFont.bURL;
     434                 :     196598 :     bGreyWave = rFont.bGreyWave;
     435                 :     196598 :     bNoColReplace = rFont.bNoColReplace;
     436                 :     196598 :     bNoHyph = rFont.bNoHyph;
     437                 :     196598 :     bBlink = rFont.bBlink;
     438   [ #  #  #  # ]:     196598 : }
     439                 :            : 
     440                 :       6950 : SwFont::SwFont( const SwAttrSet* pAttrSet,
     441 [ +  - ][ +  + ]:      27800 :                 const IDocumentSettingAccess* pIDocumentSettingAccess )
           [ #  #  #  # ]
     442                 :            : {
     443                 :       6950 :     nActual = SW_LATIN;
     444                 :       6950 :     nToxCnt = 0;
     445                 :       6950 :     nRefCnt = 0;
     446                 :       6950 :     m_nMetaCount = 0;
     447                 :       6950 :     bPaintBlank = sal_False;
     448                 :       6950 :     bPaintWrong = sal_False;
     449                 :       6950 :     bURL = sal_False;
     450                 :       6950 :     bGreyWave = sal_False;
     451                 :       6950 :     bNoColReplace = sal_False;
     452         [ +  - ]:       6950 :     bNoHyph = pAttrSet->GetNoHyphenHere().GetValue();
     453         [ +  - ]:       6950 :     bBlink = pAttrSet->GetBlink().GetValue();
     454                 :       6950 :     bOrgChg = sal_True;
     455                 :            :     {
     456         [ +  - ]:       6950 :         const SvxFontItem& rFont = pAttrSet->GetFont();
     457         [ +  - ]:       6950 :         aSub[SW_LATIN].SetFamily( rFont.GetFamily() );
     458         [ +  - ]:       6950 :         aSub[SW_LATIN].SetName( rFont.GetFamilyName() );
     459         [ +  - ]:       6950 :         aSub[SW_LATIN].SetStyleName( rFont.GetStyleName() );
     460         [ +  - ]:       6950 :         aSub[SW_LATIN].SetPitch( rFont.GetPitch() );
     461         [ +  - ]:       6950 :         aSub[SW_LATIN].SetCharSet( rFont.GetCharSet() );
     462                 :       6950 :         aSub[SW_LATIN].SvxFont::SetPropr( 100 );   // 100% der FontSize
     463                 :       6950 :         Size aTmpSize = aSub[SW_LATIN].aSize;
     464         [ +  - ]:       6950 :         aTmpSize.Height() = pAttrSet->GetSize().GetHeight();
     465         [ +  - ]:       6950 :         aSub[SW_LATIN].SetSize( aTmpSize );
     466 [ +  - ][ +  - ]:       6950 :         aSub[SW_LATIN].SetItalic( pAttrSet->GetPosture().GetPosture() );
     467 [ +  - ][ +  - ]:       6950 :         aSub[SW_LATIN].SetWeight( pAttrSet->GetWeight().GetWeight() );
     468 [ +  - ][ +  - ]:       6950 :         aSub[SW_LATIN].SetLanguage( pAttrSet->GetLanguage().GetLanguage() );
     469                 :            :     }
     470                 :            : 
     471                 :            :     {
     472         [ +  - ]:       6950 :         const SvxFontItem& rFont = pAttrSet->GetCJKFont();
     473         [ +  - ]:       6950 :         aSub[SW_CJK].SetFamily( rFont.GetFamily() );
     474         [ +  - ]:       6950 :         aSub[SW_CJK].SetName( rFont.GetFamilyName() );
     475         [ +  - ]:       6950 :         aSub[SW_CJK].SetStyleName( rFont.GetStyleName() );
     476         [ +  - ]:       6950 :         aSub[SW_CJK].SetPitch( rFont.GetPitch() );
     477         [ +  - ]:       6950 :         aSub[SW_CJK].SetCharSet( rFont.GetCharSet() );
     478                 :       6950 :         aSub[SW_CJK].SvxFont::SetPropr( 100 );   // 100% der FontSize
     479                 :       6950 :         Size aTmpSize = aSub[SW_CJK].aSize;
     480         [ +  - ]:       6950 :         aTmpSize.Height() = pAttrSet->GetCJKSize().GetHeight();
     481         [ +  - ]:       6950 :         aSub[SW_CJK].SetSize( aTmpSize );
     482 [ +  - ][ +  - ]:       6950 :         aSub[SW_CJK].SetItalic( pAttrSet->GetCJKPosture().GetPosture() );
     483 [ +  - ][ +  - ]:       6950 :         aSub[SW_CJK].SetWeight( pAttrSet->GetCJKWeight().GetWeight() );
     484         [ +  - ]:       6950 :         LanguageType eNewLang = pAttrSet->GetCJKLanguage().GetLanguage();
     485         [ +  - ]:       6950 :         aSub[SW_CJK].SetLanguage( eNewLang );
     486         [ +  - ]:       6950 :         aSub[SW_LATIN].SetCJKContextLanguage( eNewLang );
     487         [ +  - ]:       6950 :         aSub[SW_CJK].SetCJKContextLanguage( eNewLang );
     488         [ +  - ]:       6950 :         aSub[SW_CTL].SetCJKContextLanguage( eNewLang );
     489                 :            :     }
     490                 :            : 
     491                 :            :     {
     492         [ +  - ]:       6950 :         const SvxFontItem& rFont = pAttrSet->GetCTLFont();
     493         [ +  - ]:       6950 :         aSub[SW_CTL].SetFamily( rFont.GetFamily() );
     494         [ +  - ]:       6950 :         aSub[SW_CTL].SetName( rFont.GetFamilyName() );
     495         [ +  - ]:       6950 :         aSub[SW_CTL].SetStyleName( rFont.GetStyleName() );
     496         [ +  - ]:       6950 :         aSub[SW_CTL].SetPitch( rFont.GetPitch() );
     497         [ +  - ]:       6950 :         aSub[SW_CTL].SetCharSet( rFont.GetCharSet() );
     498                 :       6950 :         aSub[SW_CTL].SvxFont::SetPropr( 100 );   // 100% der FontSize
     499                 :       6950 :         Size aTmpSize = aSub[SW_CTL].aSize;
     500         [ +  - ]:       6950 :         aTmpSize.Height() = pAttrSet->GetCTLSize().GetHeight();
     501         [ +  - ]:       6950 :         aSub[SW_CTL].SetSize( aTmpSize );
     502 [ +  - ][ +  - ]:       6950 :         aSub[SW_CTL].SetItalic( pAttrSet->GetCTLPosture().GetPosture() );
     503 [ +  - ][ +  - ]:       6950 :         aSub[SW_CTL].SetWeight( pAttrSet->GetCTLWeight().GetWeight() );
     504 [ +  - ][ +  - ]:       6950 :         aSub[SW_CTL].SetLanguage( pAttrSet->GetCTLLanguage().GetLanguage() );
     505                 :            :     }
     506                 :            : 
     507         [ +  - ]:       6950 :     const FontUnderline eUnderline = pAttrSet->GetUnderline().GetLineStyle();
     508 [ -  + ][ +  - ]:       6950 :     if ( pAttrSet->GetCharHidden().GetValue() )
     509         [ #  # ]:          0 :         SetUnderline( UNDERLINE_DOTTED );
     510                 :            :     else
     511         [ +  - ]:       6950 :         SetUnderline( eUnderline );
     512         [ +  - ]:       6950 :     SetUnderColor( pAttrSet->GetUnderline().GetColor() );
     513 [ +  - ][ +  - ]:       6950 :     SetOverline( pAttrSet->GetOverline().GetLineStyle() );
     514         [ +  - ]:       6950 :     SetOverColor( pAttrSet->GetOverline().GetColor() );
     515 [ +  - ][ +  - ]:       6950 :     SetEmphasisMark( pAttrSet->GetEmphasisMark().GetEmphasisMark() );
     516 [ +  - ][ +  - ]:       6950 :     SetStrikeout( pAttrSet->GetCrossedOut().GetStrikeout() );
     517 [ +  - ][ +  - ]:       6950 :     SetColor( pAttrSet->GetColor().GetValue() );
     518         [ +  - ]:       6950 :     SetTransparent( sal_True );
     519         [ +  - ]:       6950 :     SetAlign( ALIGN_BASELINE );
     520 [ +  - ][ +  - ]:       6950 :     SetOutline( pAttrSet->GetContour().GetValue() );
     521 [ +  - ][ +  - ]:       6950 :     SetShadow( pAttrSet->GetShadowed().GetValue() );
     522         [ +  - ]:       6950 :     SetPropWidth( pAttrSet->GetCharScaleW().GetValue() );
     523 [ +  - ][ +  - ]:       6950 :     SetRelief( (FontRelief)pAttrSet->GetCharRelief().GetValue() );
     524 [ +  - ][ +  + ]:       6950 :     if( pAttrSet->GetAutoKern().GetValue() )
     525                 :            :     {
     526                 :            :         SetAutoKern( ( !pIDocumentSettingAccess ||
     527         [ +  - ]:       5726 :                        !pIDocumentSettingAccess->get(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION) ) ?
     528                 :            :                         KERNING_FONTSPECIFIC :
     529 [ +  - ][ +  + ]:      11452 :                         KERNING_ASIAN );
                 [ +  - ]
     530                 :            :     }
     531                 :            :     else
     532         [ +  - ]:       1224 :         SetAutoKern( 0 );
     533 [ +  - ][ +  - ]:       6950 :     SetWordLineMode( pAttrSet->GetWordLineMode().GetValue() );
     534         [ +  - ]:       6950 :     const SvxEscapementItem &rEsc = pAttrSet->GetEscapement();
     535                 :       6950 :     SetEscapement( rEsc.GetEsc() );
     536         [ +  + ]:       6950 :     if( aSub[SW_LATIN].IsEsc() )
     537         [ +  - ]:       1348 :         SetProportion( rEsc.GetProp() );
     538         [ +  - ]:       6950 :     SetCaseMap( pAttrSet->GetCaseMap().GetCaseMap() );
     539         [ +  - ]:       6950 :     SetFixKerning( pAttrSet->GetKerning().GetValue() );
     540                 :            :     const SfxPoolItem* pItem;
     541         [ +  + ]:       6950 :     if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BACKGROUND,
     542         [ +  - ]:       6950 :         sal_True, &pItem ))
     543         [ +  - ]:       1024 :         pBackColor = new Color( ((SvxBrushItem*)pItem)->GetColor() );
     544                 :            :     else
     545                 :       5926 :         pBackColor = NULL;
     546         [ +  - ]:       6950 :     const SvxTwoLinesItem& rTwoLinesItem = pAttrSet->Get2Lines();
     547         [ +  + ]:       6950 :     if ( ! rTwoLinesItem.GetValue() )
     548 [ +  - ][ +  - ]:       6630 :         SetVertical( pAttrSet->GetCharRotate().GetValue() );
     549                 :            :     else
     550         [ +  - ]:        320 :         SetVertical( 0 );
     551 [ +  + ][ +  - ]:       6950 :     if( pIDocumentSettingAccess && pIDocumentSettingAccess->get( IDocumentSettingAccess::SMALL_CAPS_PERCENTAGE_66 ))
         [ +  + ][ +  + ]
     552                 :            :     {
     553                 :        155 :         aSub[ SW_LATIN ].smallCapsPercentage66 = true;
     554                 :        155 :         aSub[ SW_CJK ].smallCapsPercentage66 = true;
     555                 :        155 :         aSub[ SW_CTL ].smallCapsPercentage66 = true;
     556                 :            :     }
     557   [ #  #  #  # ]:       6950 : }
     558                 :            : 
     559                 :     615933 : SwSubFont& SwSubFont::operator=( const SwSubFont &rFont )
     560                 :            : {
     561                 :     615933 :     SvxFont::operator=( rFont );
     562                 :     615933 :     pMagic = rFont.pMagic;
     563                 :     615933 :     nFntIndex = rFont.nFntIndex;
     564                 :     615933 :     nOrgHeight = rFont.nOrgHeight;
     565                 :     615933 :     nOrgAscent = rFont.nOrgAscent;
     566                 :     615933 :     nPropWidth = rFont.nPropWidth;
     567                 :     615933 :     aSize = rFont.aSize;
     568                 :     615933 :     smallCapsPercentage66 = rFont.smallCapsPercentage66;
     569                 :     615933 :     return *this;
     570                 :            : }
     571                 :            : 
     572                 :       8713 : SwFont& SwFont::operator=( const SwFont &rFont )
     573                 :            : {
     574                 :       8713 :     aSub[SW_LATIN] = rFont.aSub[SW_LATIN];
     575                 :       8713 :     aSub[SW_CJK] = rFont.aSub[SW_CJK];
     576                 :       8713 :     aSub[SW_CTL] = rFont.aSub[SW_CTL];
     577                 :       8713 :     nActual = rFont.nActual;
     578                 :       8713 :     delete pBackColor;
     579         [ +  + ]:       8713 :     pBackColor = rFont.pBackColor ? new Color( *rFont.pBackColor ) : NULL;
     580                 :       8713 :     aUnderColor = rFont.GetUnderColor();
     581                 :       8713 :     aOverColor  = rFont.GetOverColor();
     582                 :       8713 :     nToxCnt = 0;
     583                 :       8713 :     nRefCnt = 0;
     584                 :       8713 :     m_nMetaCount = 0;
     585                 :       8713 :     bFntChg = rFont.bFntChg;
     586                 :       8713 :     bOrgChg = rFont.bOrgChg;
     587                 :       8713 :     bPaintBlank = rFont.bPaintBlank;
     588                 :       8713 :     bPaintWrong = sal_False;
     589                 :       8713 :     bURL = rFont.bURL;
     590                 :       8713 :     bGreyWave = rFont.bGreyWave;
     591                 :       8713 :     bNoColReplace = rFont.bNoColReplace;
     592                 :       8713 :     bNoHyph = rFont.bNoHyph;
     593                 :       8713 :     bBlink = rFont.bBlink;
     594                 :       8713 :     return *this;
     595                 :            : }
     596                 :            : 
     597                 :            : /*************************************************************************
     598                 :            :  *                      SwFont::GoMagic()
     599                 :            :  *************************************************************************/
     600                 :            : 
     601                 :       6527 : void SwFont::GoMagic( ViewShell *pSh, sal_uInt8 nWhich )
     602                 :            : {
     603                 :            :     SwFntAccess aFntAccess( aSub[nWhich].pMagic, aSub[nWhich].nFntIndex,
     604 [ +  - ][ +  - ]:       6527 :                             &aSub[nWhich], pSh, sal_True );
     605                 :       6527 : }
     606                 :            : 
     607                 :            : /*************************************************************************
     608                 :            :  *                      SwSubFont::IsSymbol()
     609                 :            :  *************************************************************************/
     610                 :            : 
     611                 :          0 : sal_Bool SwSubFont::IsSymbol( ViewShell *pSh )
     612                 :            : {
     613         [ #  # ]:          0 :     SwFntAccess aFntAccess( pMagic, nFntIndex, this, pSh, sal_False );
     614 [ #  # ][ #  # ]:          0 :     return aFntAccess.Get()->IsSymbol();
     615                 :            : }
     616                 :            : 
     617                 :            : /*************************************************************************
     618                 :            :  *                      SwSubFont::ChgFnt()
     619                 :            :  *************************************************************************/
     620                 :            : 
     621                 :     306506 : sal_Bool SwSubFont::ChgFnt( ViewShell *pSh, OutputDevice& rOut )
     622                 :            : {
     623         [ +  + ]:     306506 :     if ( pLastFont )
     624                 :     303847 :         pLastFont->Unlock();
     625         [ +  - ]:     306506 :     SwFntAccess aFntAccess( pMagic, nFntIndex, this, pSh, sal_True );
     626                 :            :     SV_STAT( nChangeFont );
     627                 :            : 
     628         [ +  - ]:     306506 :     pLastFont = aFntAccess.Get();
     629                 :            : 
     630         [ +  - ]:     306506 :     pLastFont->SetDevFont( pSh, rOut );
     631                 :            : 
     632                 :     306506 :     pLastFont->Lock();
     633         [ +  - ]:     306506 :     return UNDERLINE_NONE != GetUnderline() ||
     634         [ +  - ]:     297017 :            UNDERLINE_NONE != GetOverline()  ||
     635 [ +  + ][ +  - ]:     603523 :            STRIKEOUT_NONE != GetStrikeout();
         [ +  - ][ +  + ]
                 [ +  - ]
     636                 :            : }
     637                 :            : 
     638                 :            : /*************************************************************************
     639                 :            :  *                    SwFont::ChgPhysFnt()
     640                 :            :  *************************************************************************/
     641                 :            : 
     642                 :     207070 : void SwFont::ChgPhysFnt( ViewShell *pSh, OutputDevice& rOut )
     643                 :            : {
     644 [ +  + ][ +  + ]:     207070 :     if( bOrgChg && aSub[nActual].IsEsc() )
                 [ +  + ]
     645                 :            :     {
     646                 :       4463 :         const sal_uInt8 nOldProp = aSub[nActual].GetPropr();
     647         [ +  - ]:       4463 :         SetProportion( 100 );
     648         [ +  - ]:       4463 :         ChgFnt( pSh, rOut );
     649                 :            :         SwFntAccess aFntAccess( aSub[nActual].pMagic, aSub[nActual].nFntIndex,
     650         [ +  - ]:       4463 :                                 &aSub[nActual], pSh );
     651 [ +  - ][ +  - ]:       4463 :         aSub[nActual].nOrgHeight = aFntAccess.Get()->GetFontHeight( pSh, rOut );
     652 [ +  - ][ +  - ]:       4463 :         aSub[nActual].nOrgAscent = aFntAccess.Get()->GetFontAscent( pSh, rOut );
     653         [ +  - ]:       4463 :         SetProportion( nOldProp );
     654         [ +  - ]:       4463 :         bOrgChg = sal_False;
     655                 :            :     }
     656                 :            : 
     657         [ +  + ]:     207070 :     if( bFntChg )
     658                 :            :     {
     659                 :     207067 :         ChgFnt( pSh, rOut );
     660                 :     207067 :         bFntChg = bOrgChg;
     661                 :            :     }
     662         [ +  + ]:     207070 :     if( rOut.GetTextLineColor() != aUnderColor )
     663                 :         74 :         rOut.SetTextLineColor( aUnderColor );
     664         [ +  + ]:     207070 :     if( rOut.GetOverlineColor() != aOverColor )
     665                 :          8 :         rOut.SetOverlineColor( aOverColor );
     666                 :     207070 : }
     667                 :            : 
     668                 :            : /*************************************************************************
     669                 :            :  *                      SwFont::CalcEscHeight()
     670                 :            :  *         Height = MaxAscent + MaxDescent
     671                 :            :  *      MaxAscent = Max (T1_ascent, T2_ascent + (Esc * T1_height) );
     672                 :            :  *     MaxDescent = Max (T1_height-T1_ascent,
     673                 :            :  *                       T2_height-T2_ascent - (Esc * T1_height)
     674                 :            :  *************************************************************************/
     675                 :            : 
     676                 :       4479 : sal_uInt16 SwSubFont::CalcEscHeight( const sal_uInt16 nOldHeight,
     677                 :            :                               const sal_uInt16 nOldAscent  ) const
     678                 :            : {
     679   [ +  +  +  + ]:       8496 :     if( DFLT_ESC_AUTO_SUPER != GetEscapement() &&
                 [ +  + ]
     680                 :       4017 :         DFLT_ESC_AUTO_SUB != GetEscapement() )
     681                 :            :     {
     682                 :            :         long nDescent = nOldHeight - nOldAscent -
     683                 :       4013 :                              ( (long) nOrgHeight * GetEscapement() ) / 100L;
     684                 :            :         const sal_uInt16 nDesc = ( nDescent>0 ) ? Max ( sal_uInt16(nDescent),
     685         [ +  + ]:       4013 :                    sal_uInt16(nOrgHeight - nOrgAscent) ) : nOrgHeight - nOrgAscent;
     686                 :       4013 :         return ( nDesc + CalcEscAscent( nOldAscent ) );
     687                 :            :     }
     688                 :       4479 :     return nOrgHeight;
     689                 :            : }
     690                 :            : 
     691                 :          0 : short SwSubFont::_CheckKerning( )
     692                 :            : {
     693                 :          0 :     short nKernx = - short( Font::GetSize().Height() / 6 );
     694                 :            : 
     695         [ #  # ]:          0 :     if ( nKernx < GetFixKerning() )
     696                 :          0 :         return GetFixKerning();
     697                 :          0 :     return nKernx;
     698                 :            : }
     699                 :            : 
     700                 :            : /*************************************************************************
     701                 :            :  *                    SwSubFont::GetAscent()
     702                 :            :  *************************************************************************/
     703                 :            : 
     704                 :     109514 : sal_uInt16 SwSubFont::GetAscent( ViewShell *pSh, const OutputDevice& rOut )
     705                 :            : {
     706                 :            :     sal_uInt16 nAscent;
     707         [ +  - ]:     109514 :     SwFntAccess aFntAccess( pMagic, nFntIndex, this, pSh );
     708 [ +  - ][ +  - ]:     109514 :     nAscent = aFntAccess.Get()->GetFontAscent( pSh, rOut );
     709         [ +  + ]:     109514 :     if( GetEscapement() )
     710         [ +  - ]:       2657 :         nAscent = CalcEscAscent( nAscent );
     711         [ +  - ]:     109514 :     return nAscent;
     712                 :            : }
     713                 :            : 
     714                 :            : /*************************************************************************
     715                 :            :  *                    SwSubFont::GetHeight()
     716                 :            :  *************************************************************************/
     717                 :            : 
     718                 :     120153 : sal_uInt16 SwSubFont::GetHeight( ViewShell *pSh, const OutputDevice& rOut )
     719                 :            : {
     720                 :            :     SV_STAT( nGetTextSize );
     721         [ +  - ]:     120153 :     SwFntAccess aFntAccess( pMagic, nFntIndex, this, pSh );
     722 [ +  - ][ +  - ]:     120153 :     const sal_uInt16 nHeight = aFntAccess.Get()->GetFontHeight( pSh, rOut );
     723         [ +  + ]:     120153 :     if ( GetEscapement() )
     724                 :            :     {
     725 [ +  - ][ +  - ]:       3977 :         const sal_uInt16 nAscent = aFntAccess.Get()->GetFontAscent( pSh, rOut );
     726         [ +  - ]:       3977 :         return CalcEscHeight( nHeight, nAscent ); // + nLeading;
     727                 :            :     }
     728         [ +  - ]:     120153 :     return nHeight; // + nLeading;
     729                 :            : }
     730                 :            : 
     731                 :            : /*************************************************************************
     732                 :            :  *                    SwSubFont::_GetTxtSize()
     733                 :            :  *************************************************************************/
     734                 :      54574 : Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
     735                 :            : {
     736                 :            :     // Robust: Eigentlich sollte der Font bereits eingestellt sein, aber
     737                 :            :     // sicher ist sicher ...
     738 [ +  - ][ +  + ]:     109134 :     if ( !pLastFont || pLastFont->GetOwner()!=pMagic ||
         [ +  + ][ +  + ]
     739         [ +  - ]:      54560 :          !IsSameInstance( rInf.GetpOut()->GetFont() ) )
     740         [ +  - ]:      52247 :         ChgFnt( rInf.GetShell(), rInf.GetOut() );
     741                 :            : 
     742         [ +  - ]:      54574 :     SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
     743                 :            : 
     744                 :      54574 :     Size aTxtSize;
     745                 :      54574 :     xub_StrLen nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
     746         [ -  + ]:      54574 :                                                    : rInf.GetLen() );
     747                 :      54574 :     rInf.SetLen( nLn );
     748 [ +  - ][ +  + ]:      54574 :     if( IsCapital() && nLn )
                 [ +  + ]
     749         [ +  - ]:          7 :         aTxtSize = GetCapitalSize( rInf );
     750                 :            :     else
     751                 :            :     {
     752                 :            :         SV_STAT( nGetTextSize );
     753                 :      54567 :         long nOldKern = rInf.GetKern();
     754                 :      54567 :         const XubString &rOldTxt = rInf.GetText();
     755         [ +  - ]:      54567 :         rInf.SetKern( CheckKerning() );
     756         [ +  + ]:      54567 :         if ( !IsCaseMap() )
     757         [ +  - ]:      54260 :             aTxtSize = pLastFont->GetTextSize( rInf );
     758                 :            :         else
     759                 :            :         {
     760         [ +  - ]:        307 :             String aTmp = CalcCaseMap( rInf.GetText() );
     761                 :        307 :             const XubString &rOldStr = rInf.GetText();
     762                 :        307 :             sal_Bool bCaseMapLengthDiffers(aTmp.Len() != rOldStr.Len());
     763                 :            : 
     764 [ #  # ][ -  + ]:        307 :             if(bCaseMapLengthDiffers && rInf.GetLen())
                 [ -  + ]
     765                 :            :             {
     766                 :            :                 // #108203#
     767                 :            :                 // If the length of the original string and the CaseMapped one
     768                 :            :                 // are different, it is necessary to handle the given text part as
     769                 :            :                 // a single snippet since it�s size may differ, too.
     770                 :          0 :                 xub_StrLen nOldIdx(rInf.GetIdx());
     771                 :          0 :                 xub_StrLen nOldLen(rInf.GetLen());
     772         [ #  # ]:          0 :                 const XubString aSnippet(rOldStr, nOldIdx, nOldLen);
     773         [ #  # ]:          0 :                 XubString aNewText(CalcCaseMap(aSnippet));
     774                 :            : 
     775                 :          0 :                 rInf.SetText( aNewText );
     776                 :          0 :                 rInf.SetIdx( 0 );
     777                 :          0 :                 rInf.SetLen( aNewText.Len() );
     778                 :            : 
     779         [ #  # ]:          0 :                 aTxtSize = pLastFont->GetTextSize( rInf );
     780                 :            : 
     781                 :          0 :                 rInf.SetIdx( nOldIdx );
     782 [ #  # ][ #  # ]:          0 :                 rInf.SetLen( nOldLen );
     783                 :            :             }
     784                 :            :             else
     785                 :            :             {
     786                 :        307 :                 rInf.SetText( aTmp );
     787         [ +  - ]:        307 :                 aTxtSize = pLastFont->GetTextSize( rInf );
     788                 :            :             }
     789                 :            : 
     790         [ +  - ]:        307 :             rInf.SetText( rOldStr );
     791                 :            :         }
     792                 :      54567 :         rInf.SetKern( nOldKern );
     793                 :      54567 :         rInf.SetText( rOldTxt );
     794                 :            :         // 15142: Ein Wort laenger als eine Zeile, beim Zeilenumbruch
     795                 :            :         //        hochgestellt, muss seine effektive Hoehe melden.
     796         [ +  + ]:      54567 :         if( GetEscapement() )
     797                 :            :         {
     798                 :        502 :             const sal_uInt16 nAscent = pLastFont->GetFontAscent( rInf.GetShell(),
     799         [ +  - ]:       1004 :                                                              rInf.GetOut() );
     800                 :        502 :             aTxtSize.Height() =
     801         [ +  - ]:        502 :                 (long)CalcEscHeight( (sal_uInt16)aTxtSize.Height(), nAscent);
     802                 :            :         }
     803                 :            :     }
     804                 :            : 
     805 [ +  + ][ -  + ]:      54574 :     if (1==rInf.GetLen() && CH_TXT_ATR_FIELDSTART==rInf.GetText().GetChar(rInf.GetIdx()))
                 [ -  + ]
     806                 :            :     {
     807                 :          0 :         xub_StrLen nOldIdx(rInf.GetIdx());
     808                 :          0 :         xub_StrLen nOldLen(rInf.GetLen());
     809                 :          0 :         rtl::OUString aNewText(CH_TXT_ATR_SUBST_FIELDSTART);
     810 [ #  # ][ #  # ]:          0 :         rInf.SetText( aNewText );
     811                 :          0 :         rInf.SetIdx( 0 );
     812                 :          0 :         rInf.SetLen( aNewText.getLength() );
     813         [ #  # ]:          0 :         aTxtSize = pLastFont->GetTextSize( rInf );
     814                 :          0 :         rInf.SetIdx( nOldIdx );
     815                 :          0 :         rInf.SetLen( nOldLen );
     816                 :            :     }
     817 [ +  + ][ -  + ]:      54574 :     else if (1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetText().GetChar(rInf.GetIdx()))
                 [ -  + ]
     818                 :            :     {
     819                 :          0 :         xub_StrLen nOldIdx(rInf.GetIdx());
     820                 :          0 :         xub_StrLen nOldLen(rInf.GetLen());
     821                 :          0 :         rtl::OUString aNewText(CH_TXT_ATR_SUBST_FIELDEND);
     822 [ #  # ][ #  # ]:          0 :         rInf.SetText( aNewText );
     823                 :          0 :         rInf.SetIdx( 0 );
     824                 :          0 :         rInf.SetLen( aNewText.getLength() );
     825         [ #  # ]:          0 :         aTxtSize = pLastFont->GetTextSize( rInf );
     826                 :          0 :         rInf.SetIdx( nOldIdx );
     827                 :          0 :         rInf.SetLen( nOldLen );
     828                 :            :     }
     829                 :            : 
     830         [ +  - ]:      54574 :     return aTxtSize;
     831                 :            : }
     832                 :            : 
     833                 :            : /*************************************************************************
     834                 :            :  *                    SwSubFont::_DrawText()
     835                 :            :  *************************************************************************/
     836                 :            : 
     837                 :      26445 : void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
     838                 :            : {
     839                 :      26445 :     rInf.SetGreyWave( bGrey );
     840                 :      26445 :     xub_StrLen nLn = rInf.GetText().Len();
     841 [ -  + ][ +  - ]:      26445 :     if( !rInf.GetLen() || !nLn )
                 [ +  - ]
     842                 :      26445 :         return;
     843         [ +  + ]:      26445 :     if( STRING_LEN == rInf.GetLen() )
     844                 :         14 :         rInf.SetLen( nLn );
     845                 :            : 
     846                 :      26445 :     FontUnderline nOldUnder = UNDERLINE_NONE;
     847                 :      26445 :     SwUnderlineFont* pUnderFnt = 0;
     848                 :            : 
     849         [ +  + ]:      26445 :     if( rInf.GetUnderFnt() )
     850                 :            :     {
     851         [ +  - ]:        119 :         nOldUnder = GetUnderline();
     852         [ +  - ]:        119 :         SetUnderline( UNDERLINE_NONE );
     853                 :        119 :         pUnderFnt = rInf.GetUnderFnt();
     854                 :            :     }
     855                 :            : 
     856 [ +  - ][ +  + ]:      26445 :     if( !pLastFont || pLastFont->GetOwner()!=pMagic )
                 [ +  + ]
     857         [ +  - ]:        119 :         ChgFnt( rInf.GetShell(), rInf.GetOut() );
     858                 :            : 
     859         [ +  - ]:      26445 :     SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
     860                 :            : 
     861                 :      26445 :     Point aPos( rInf.GetPos() );
     862                 :      26445 :     const Point &rOld = rInf.GetPos();
     863                 :      26445 :     rInf.SetPos( aPos );
     864                 :            : 
     865         [ +  + ]:      26445 :     if( GetEscapement() )
     866         [ +  - ]:        369 :         CalcEsc( rInf, aPos );
     867                 :            : 
     868         [ +  - ]:      26445 :     rInf.SetKern( CheckKerning() + rInf.GetSperren() / SPACING_PRECISION_FACTOR );
     869                 :            : 
     870         [ -  + ]:      26445 :     if( IsCapital() )
     871         [ #  # ]:          0 :         DrawCapital( rInf );
     872                 :            :     else
     873                 :            :     {
     874                 :            :         SV_STAT( nDrawText );
     875         [ +  + ]:      26445 :         if ( !IsCaseMap() )
     876         [ +  - ]:      26253 :             pLastFont->DrawText( rInf );
     877                 :            :         else
     878                 :            :         {
     879                 :        192 :             const XubString &rOldStr = rInf.GetText();
     880         [ +  - ]:        192 :             XubString aString( CalcCaseMap( rOldStr ) );
     881                 :        192 :             sal_Bool bCaseMapLengthDiffers(aString.Len() != rOldStr.Len());
     882                 :            : 
     883 [ #  # ][ -  + ]:        192 :             if(bCaseMapLengthDiffers && rInf.GetLen())
                 [ -  + ]
     884                 :            :             {
     885                 :            :                 // #108203#
     886                 :            :                 // If the length of the original string and the CaseMapped one
     887                 :            :                 // are different, it is necessary to handle the given text part as
     888                 :            :                 // a single snippet since it�s size may differ, too.
     889                 :          0 :                 xub_StrLen nOldIdx(rInf.GetIdx());
     890                 :          0 :                 xub_StrLen nOldLen(rInf.GetLen());
     891         [ #  # ]:          0 :                 const XubString aSnippet(rOldStr, nOldIdx, nOldLen);
     892         [ #  # ]:          0 :                 XubString aNewText = CalcCaseMap(aSnippet);
     893                 :            : 
     894                 :          0 :                 rInf.SetText( aNewText );
     895                 :          0 :                 rInf.SetIdx( 0 );
     896                 :          0 :                 rInf.SetLen( aNewText.Len() );
     897                 :            : 
     898         [ #  # ]:          0 :                 pLastFont->DrawText( rInf );
     899                 :            : 
     900                 :          0 :                 rInf.SetIdx( nOldIdx );
     901 [ #  # ][ #  # ]:          0 :                 rInf.SetLen( nOldLen );
     902                 :            :             }
     903                 :            :             else
     904                 :            :             {
     905                 :        192 :                 rInf.SetText( aString );
     906         [ +  - ]:        192 :                 pLastFont->DrawText( rInf );
     907                 :            :             }
     908                 :            : 
     909         [ +  - ]:        192 :             rInf.SetText( rOldStr );
     910                 :            :         }
     911                 :            :     }
     912                 :            : 
     913 [ +  + ][ +  - ]:      26445 :     if( pUnderFnt && nOldUnder != UNDERLINE_NONE )
     914                 :            :     {
     915                 :            : static sal_Char const sDoubleSpace[] = "  ";
     916         [ +  - ]:        119 :         Size aFontSize = _GetTxtSize( rInf );
     917                 :        119 :         const XubString &rOldStr = rInf.GetText();
     918         [ +  - ]:        119 :         XubString aStr( sDoubleSpace, RTL_TEXTENCODING_MS_1252 );
     919                 :            : 
     920                 :        119 :         xub_StrLen nOldIdx = rInf.GetIdx();
     921                 :        119 :         xub_StrLen nOldLen = rInf.GetLen();
     922                 :        119 :         long nSpace = 0;
     923         [ -  + ]:        119 :         if( rInf.GetSpace() )
     924                 :            :         {
     925                 :          0 :             xub_StrLen nTmpEnd = nOldIdx + nOldLen;
     926         [ #  # ]:          0 :             if( nTmpEnd > rOldStr.Len() )
     927                 :          0 :                 nTmpEnd = rOldStr.Len();
     928                 :            : 
     929                 :          0 :             const SwScriptInfo* pSI = rInf.GetScriptInfo();
     930                 :            : 
     931                 :            :             const sal_Bool bAsianFont =
     932 [ #  # ][ #  # ]:          0 :                 ( rInf.GetFont() && SW_CJK == rInf.GetFont()->GetActual() );
     933         [ #  # ]:          0 :             for( xub_StrLen nTmp = nOldIdx; nTmp < nTmpEnd; ++nTmp )
     934                 :            :             {
     935         [ #  # ]:          0 :                 if( CH_BLANK == rOldStr.GetChar( nTmp ) || bAsianFont ||
           [ #  #  #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     936                 :          0 :                     ( nTmp + 1 < rOldStr.Len() && pSI &&
     937         [ #  # ]:          0 :                       i18n::ScriptType::ASIAN == pSI->ScriptType( nTmp + 1 ) ) )
     938                 :          0 :                     ++nSpace;
     939                 :            :             }
     940                 :            : 
     941                 :            :             // if next portion if a hole portion we do not consider any
     942                 :            :             // extra space added because the last character was ASIAN
     943 [ #  # ][ #  # ]:          0 :             if ( nSpace && rInf.IsSpaceStop() && bAsianFont )
         [ #  # ][ #  # ]
     944                 :          0 :                  --nSpace;
     945                 :            : 
     946                 :          0 :             nSpace *= rInf.GetSpace() / SPACING_PRECISION_FACTOR;
     947                 :            :         }
     948                 :            : 
     949                 :        119 :         rInf.SetWidth( sal_uInt16(aFontSize.Width() + nSpace) );
     950                 :        119 :         rInf.SetText( aStr );
     951                 :        119 :         rInf.SetIdx( 0 );
     952                 :        119 :         rInf.SetLen( 2 );
     953         [ +  - ]:        119 :         SetUnderline( nOldUnder );
     954                 :        119 :         rInf.SetUnderFnt( 0 );
     955                 :            : 
     956                 :            :         // set position for underline font
     957                 :        119 :         rInf.SetPos( pUnderFnt->GetPos() );
     958                 :            : 
     959         [ +  - ]:        119 :         pUnderFnt->GetFont()._DrawStretchText( rInf );
     960                 :            : 
     961                 :        119 :         rInf.SetUnderFnt( pUnderFnt );
     962                 :        119 :         rInf.SetText( rOldStr );
     963                 :        119 :         rInf.SetIdx( nOldIdx );
     964         [ +  - ]:        119 :         rInf.SetLen( nOldLen );
     965                 :            :     }
     966                 :            : 
     967         [ +  - ]:      26445 :     rInf.SetPos( rOld );
     968                 :            : }
     969                 :            : 
     970                 :        123 : void SwSubFont::_DrawStretchText( SwDrawTextInfo &rInf )
     971                 :            : {
     972 [ +  - ][ -  + ]:        123 :     if( !rInf.GetLen() || !rInf.GetText().Len() )
                 [ +  - ]
     973                 :        123 :         return;
     974                 :            : 
     975                 :        123 :     FontUnderline nOldUnder = UNDERLINE_NONE;
     976                 :        123 :     SwUnderlineFont* pUnderFnt = 0;
     977                 :            : 
     978         [ -  + ]:        123 :     if( rInf.GetUnderFnt() )
     979                 :            :     {
     980         [ #  # ]:          0 :         nOldUnder = GetUnderline();
     981         [ #  # ]:          0 :         SetUnderline( UNDERLINE_NONE );
     982                 :          0 :         pUnderFnt = rInf.GetUnderFnt();
     983                 :            :     }
     984                 :            : 
     985 [ +  - ][ +  + ]:        123 :     if ( !pLastFont || pLastFont->GetOwner() != pMagic )
                 [ +  + ]
     986         [ +  - ]:        119 :         ChgFnt( rInf.GetShell(), rInf.GetOut() );
     987                 :            : 
     988         [ +  - ]:        123 :     SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
     989                 :            : 
     990         [ +  - ]:        123 :     rInf.ApplyAutoColor();
     991                 :            : 
     992                 :        123 :     Point aPos( rInf.GetPos() );
     993                 :            : 
     994         [ -  + ]:        123 :     if( GetEscapement() )
     995         [ #  # ]:          0 :         CalcEsc( rInf, aPos );
     996                 :            : 
     997         [ +  - ]:        123 :     rInf.SetKern( CheckKerning() + rInf.GetSperren() / SPACING_PRECISION_FACTOR );
     998                 :        123 :     const Point &rOld = rInf.GetPos();
     999                 :        123 :     rInf.SetPos( aPos );
    1000                 :            : 
    1001         [ -  + ]:        123 :     if( IsCapital() )
    1002         [ #  # ]:          0 :         DrawStretchCapital( rInf );
    1003                 :            :     else
    1004                 :            :     {
    1005                 :            :         SV_STAT( nDrawStretchText );
    1006                 :            : 
    1007         [ +  - ]:        123 :         if ( rInf.GetFrm() )
    1008                 :            :         {
    1009 [ +  - ][ -  + ]:        123 :             if ( rInf.GetFrm()->IsRightToLeft() )
    1010         [ #  # ]:          0 :                 rInf.GetFrm()->SwitchLTRtoRTL( aPos );
    1011                 :            : 
    1012 [ +  - ][ -  + ]:        123 :             if ( rInf.GetFrm()->IsVertical() )
    1013         [ #  # ]:          0 :                 rInf.GetFrm()->SwitchHorizontalToVertical( aPos );
    1014                 :            :         }
    1015                 :            : 
    1016         [ +  - ]:        123 :         if ( !IsCaseMap() )
    1017                 :        123 :             rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(),
    1018         [ +  - ]:        246 :                             rInf.GetText(), rInf.GetIdx(), rInf.GetLen() );
    1019                 :            :         else
    1020                 :          0 :             rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(), CalcCaseMap(
    1021   [ #  #  #  # ]:          0 :                             rInf.GetText() ), rInf.GetIdx(), rInf.GetLen() );
                 [ #  # ]
    1022                 :            :     }
    1023                 :            : 
    1024 [ -  + ][ #  # ]:        123 :     if( pUnderFnt && nOldUnder != UNDERLINE_NONE )
    1025                 :            :     {
    1026                 :            : static sal_Char const sDoubleSpace[] = "  ";
    1027                 :          0 :         const XubString &rOldStr = rInf.GetText();
    1028         [ #  # ]:          0 :         XubString aStr( sDoubleSpace, RTL_TEXTENCODING_MS_1252 );
    1029                 :          0 :         xub_StrLen nOldIdx = rInf.GetIdx();
    1030                 :          0 :         xub_StrLen nOldLen = rInf.GetLen();
    1031                 :          0 :         rInf.SetText( aStr );
    1032                 :          0 :         rInf.SetIdx( 0 );
    1033                 :          0 :         rInf.SetLen( 2 );
    1034         [ #  # ]:          0 :         SetUnderline( nOldUnder );
    1035                 :          0 :         rInf.SetUnderFnt( 0 );
    1036                 :            : 
    1037                 :            :         // set position for underline font
    1038                 :          0 :         rInf.SetPos( pUnderFnt->GetPos() );
    1039                 :            : 
    1040         [ #  # ]:          0 :         pUnderFnt->GetFont()._DrawStretchText( rInf );
    1041                 :            : 
    1042                 :          0 :         rInf.SetUnderFnt( pUnderFnt );
    1043                 :          0 :         rInf.SetText( rOldStr );
    1044                 :          0 :         rInf.SetIdx( nOldIdx );
    1045         [ #  # ]:          0 :         rInf.SetLen( nOldLen );
    1046                 :            :     }
    1047                 :            : 
    1048         [ +  - ]:        123 :     rInf.SetPos( rOld );
    1049                 :            : }
    1050                 :            : 
    1051                 :            : /*************************************************************************
    1052                 :            :  *                    SwSubFont::_GetCrsrOfst()
    1053                 :            :  *************************************************************************/
    1054                 :            : 
    1055                 :          0 : xub_StrLen SwSubFont::_GetCrsrOfst( SwDrawTextInfo& rInf )
    1056                 :            : {
    1057 [ #  # ][ #  # ]:          0 :     if ( !pLastFont || pLastFont->GetOwner()!=pMagic )
                 [ #  # ]
    1058         [ #  # ]:          0 :         ChgFnt( rInf.GetShell(), rInf.GetOut() );
    1059                 :            : 
    1060         [ #  # ]:          0 :     SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
    1061                 :            : 
    1062                 :          0 :     xub_StrLen nLn = rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
    1063         [ #  # ]:          0 :                                                  : rInf.GetLen();
    1064                 :          0 :     rInf.SetLen( nLn );
    1065                 :          0 :     xub_StrLen nCrsr = 0;
    1066 [ #  # ][ #  # ]:          0 :     if( IsCapital() && nLn )
                 [ #  # ]
    1067         [ #  # ]:          0 :         nCrsr = GetCapitalCrsrOfst( rInf );
    1068                 :            :     else
    1069                 :            :     {
    1070                 :          0 :         const XubString &rOldTxt = rInf.GetText();
    1071                 :          0 :         long nOldKern = rInf.GetKern();
    1072         [ #  # ]:          0 :         rInf.SetKern( CheckKerning() );
    1073                 :            :         SV_STAT( nGetTextSize );
    1074         [ #  # ]:          0 :         if ( !IsCaseMap() )
    1075         [ #  # ]:          0 :             nCrsr = pLastFont->GetCrsrOfst( rInf );
    1076                 :            :         else
    1077                 :            :         {
    1078         [ #  # ]:          0 :             String aTmp = CalcCaseMap( rInf.GetText() );
    1079                 :          0 :             rInf.SetText( aTmp );
    1080 [ #  # ][ #  # ]:          0 :             nCrsr = pLastFont->GetCrsrOfst( rInf );
    1081                 :            :         }
    1082                 :          0 :         rInf.SetKern( nOldKern );
    1083                 :          0 :         rInf.SetText( rOldTxt );
    1084                 :            :     }
    1085         [ #  # ]:          0 :     return nCrsr;
    1086                 :            : }
    1087                 :            : 
    1088                 :            : /*************************************************************************
    1089                 :            :  *                    SwSubFont::CalcEsc()
    1090                 :            :  *************************************************************************/
    1091                 :            : 
    1092                 :        369 : void SwSubFont::CalcEsc( SwDrawTextInfo& rInf, Point& rPos )
    1093                 :            : {
    1094                 :            :     long nOfst;
    1095                 :            : 
    1096                 :            :     sal_uInt16 nDir = UnMapDirection(
    1097 [ +  - ][ -  + ]:        369 :                 GetOrientation(), rInf.GetFrm() && rInf.GetFrm()->IsVertical() );
    1098                 :            : 
    1099      [ -  +  + ]:        369 :     switch ( GetEscapement() )
    1100                 :            :     {
    1101                 :            :     case DFLT_ESC_AUTO_SUB :
    1102                 :            :         nOfst = nOrgHeight - nOrgAscent -
    1103                 :          0 :             pLastFont->GetFontHeight( rInf.GetShell(), rInf.GetOut() ) +
    1104                 :          0 :             pLastFont->GetFontAscent( rInf.GetShell(), rInf.GetOut() );
    1105                 :            : 
    1106   [ #  #  #  # ]:          0 :         switch ( nDir )
    1107                 :            :         {
    1108                 :            :         case 0 :
    1109                 :          0 :             rPos.Y() += nOfst;
    1110                 :          0 :             break;
    1111                 :            :         case 900 :
    1112                 :          0 :             rPos.X() += nOfst;
    1113                 :          0 :             break;
    1114                 :            :         case 2700 :
    1115                 :          0 :             rPos.X() -= nOfst;
    1116                 :          0 :             break;
    1117                 :            :         }
    1118                 :            : 
    1119                 :          0 :         break;
    1120                 :            :     case DFLT_ESC_AUTO_SUPER :
    1121                 :        145 :         nOfst = pLastFont->GetFontAscent( rInf.GetShell(), rInf.GetOut() ) -
    1122                 :        145 :                 nOrgAscent;
    1123                 :            : 
    1124                 :            : 
    1125   [ +  -  -  - ]:        145 :         switch ( nDir )
    1126                 :            :         {
    1127                 :            :         case 0 :
    1128                 :        145 :             rPos.Y() += nOfst;
    1129                 :        145 :             break;
    1130                 :            :         case 900 :
    1131                 :          0 :             rPos.X() += nOfst;
    1132                 :          0 :             break;
    1133                 :            :         case 2700 :
    1134                 :          0 :             rPos.X() -= nOfst;
    1135                 :          0 :             break;
    1136                 :            :         }
    1137                 :            : 
    1138                 :        145 :         break;
    1139                 :            :     default :
    1140                 :        224 :         nOfst = ((long)nOrgHeight * GetEscapement()) / 100L;
    1141                 :            : 
    1142   [ +  -  -  - ]:        224 :         switch ( nDir )
    1143                 :            :         {
    1144                 :            :         case 0 :
    1145                 :        224 :             rPos.Y() -= nOfst;
    1146                 :        224 :             break;
    1147                 :            :         case 900 :
    1148                 :          0 :             rPos.X() -= nOfst;
    1149                 :          0 :             break;
    1150                 :            :         case 2700 :
    1151                 :          0 :             rPos.X() += nOfst;
    1152                 :          0 :             break;
    1153                 :            :         }
    1154                 :            :     }
    1155                 :        369 : }
    1156                 :            : 
    1157                 :            : // used during painting of small capitals
    1158                 :          0 : void SwDrawTextInfo::Shift( sal_uInt16 nDir )
    1159                 :            : {
    1160                 :            : #ifdef DBG_UTIL
    1161                 :            :     OSL_ENSURE( m_bPos, "DrawTextInfo: Undefined Position" );
    1162                 :            :     OSL_ENSURE( m_bSize, "DrawTextInfo: Undefined Width" );
    1163                 :            : #endif
    1164                 :            : 
    1165                 :          0 :     const sal_Bool bBidiPor = ( GetFrm() && GetFrm()->IsRightToLeft() ) !=
    1166   [ #  #  #  # ]:          0 :                           ( 0 != ( TEXT_LAYOUT_BIDI_RTL & GetpOut()->GetLayoutMode() ) );
    1167                 :            : 
    1168                 :            :     nDir = bBidiPor ?
    1169                 :            :             1800 :
    1170 [ #  # ][ #  # ]:          0 :             UnMapDirection( nDir, GetFrm() && GetFrm()->IsVertical() );
                 [ #  # ]
    1171                 :            : 
    1172   [ #  #  #  #  :          0 :     switch ( nDir )
                      # ]
    1173                 :            :     {
    1174                 :            :     case 0 :
    1175                 :          0 :         ((Point*)pPos)->X() += GetSize().Width();
    1176                 :          0 :         break;
    1177                 :            :     case 900 :
    1178                 :            :         OSL_ENSURE( ((Point*)pPos)->Y() >= GetSize().Width(), "Going underground" );
    1179                 :          0 :         ((Point*)pPos)->Y() -= GetSize().Width();
    1180                 :          0 :         break;
    1181                 :            :     case 1800 :
    1182                 :          0 :         ((Point*)pPos)->X() -= GetSize().Width();
    1183                 :          0 :         break;
    1184                 :            :     case 2700 :
    1185                 :          0 :         ((Point*)pPos)->Y() += GetSize().Width();
    1186                 :          0 :         break;
    1187                 :            :     }
    1188                 :          0 : }
    1189                 :            : 
    1190                 :            : /*************************************************************************
    1191                 :            :  *                      SwUnderlineFont::~SwUnderlineFont
    1192                 :            :  *
    1193                 :            :  * Used for the "continuous underline" feature.
    1194                 :            :  *************************************************************************/
    1195                 :            : 
    1196                 :         35 : SwUnderlineFont::SwUnderlineFont( SwFont& rFnt, const Point& rPoint )
    1197                 :         35 :         : aPos( rPoint ), pFnt( &rFnt )
    1198                 :            : {
    1199                 :         35 : };
    1200                 :            : 
    1201                 :         35 : SwUnderlineFont::~SwUnderlineFont()
    1202                 :            : {
    1203         [ +  - ]:         35 :      delete pFnt;
    1204                 :         35 : }
    1205                 :            : 
    1206                 :            : //Helper for filters to find true lineheight of a font
    1207                 :          0 : long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
    1208                 :            :                           const SwAttrSet &rSet,
    1209                 :            :                           const OutputDevice &rOut, sal_Int16 nScript)
    1210                 :            : {
    1211         [ #  # ]:          0 :     SwFont aFont(&rSet, &rIDocumentSettingAccess);
    1212                 :            :     sal_uInt8 nActual;
    1213      [ #  #  # ]:          0 :     switch (nScript)
    1214                 :            :     {
    1215                 :            :         default:
    1216                 :            :         case i18n::ScriptType::LATIN:
    1217                 :          0 :             nActual = SW_LATIN;
    1218                 :          0 :             break;
    1219                 :            :         case i18n::ScriptType::ASIAN:
    1220                 :          0 :             nActual = SW_CJK;
    1221                 :          0 :             break;
    1222                 :            :         case i18n::ScriptType::COMPLEX:
    1223                 :          0 :             nActual = SW_CTL;
    1224                 :          0 :             break;
    1225                 :            :     }
    1226                 :          0 :     aFont.SetActual(nActual);
    1227                 :            : 
    1228                 :          0 :     OutputDevice &rMutableOut = const_cast<OutputDevice &>(rOut);
    1229         [ #  # ]:          0 :     const Font aOldFont(rMutableOut.GetFont());
    1230                 :            : 
    1231         [ #  # ]:          0 :     rMutableOut.SetFont(aFont.GetActualFont());
    1232         [ #  # ]:          0 :     long nHeight = rMutableOut.GetTextHeight();
    1233                 :            : 
    1234         [ #  # ]:          0 :     rMutableOut.SetFont(aOldFont);
    1235 [ #  # ][ #  # ]:          0 :     return nHeight;
    1236                 :            : }
    1237                 :            : 
    1238                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10