LCOV - code coverage report
Current view: top level - sw/source/core/text - porrst.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 124 291 42.6 %
Date: 2012-08-25 Functions: 12 25 48.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 107 383 27.9 %

           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                 :            : #include <sfx2/printer.hxx>
      31                 :            : #include <editeng/lspcitem.hxx>
      32                 :            : #include <editeng/adjitem.hxx>
      33                 :            : #include <editeng/escpitem.hxx>
      34                 :            : #include <editeng/lrspitem.hxx>
      35                 :            : #include <editeng/pgrditem.hxx>
      36                 :            : #include <vcl/window.hxx>
      37                 :            : #include <vcl/svapp.hxx>
      38                 :            : #include <viewsh.hxx>   // ViewShell
      39                 :            : #include <viewopt.hxx>
      40                 :            : #include <ndtxt.hxx>    // SwTxtNode
      41                 :            : #include <pagefrm.hxx>  // SwPageFrm
      42                 :            : #include <paratr.hxx>
      43                 :            : #include <SwPortionHandler.hxx>
      44                 :            : #include <porrst.hxx>
      45                 :            : #include <inftxt.hxx>
      46                 :            : #include <txtpaint.hxx> // ClipVout
      47                 :            : #include <swfntcch.hxx> // SwFontAccess
      48                 :            : #include <tgrditem.hxx>
      49                 :            : #include <pagedesc.hxx> // SwPageDesc
      50                 :            : #include <frmatr.hxx>
      51                 :            : #include <redlnitr.hxx> // SwRedlineItr
      52                 :            : #include <porfly.hxx>   // SwFlyPortion
      53                 :            : #include <atrhndl.hxx>
      54                 :            : #include "rootfrm.hxx"
      55                 :            : 
      56                 :            : #include <IDocumentRedlineAccess.hxx>
      57                 :            : #include <IDocumentSettingAccess.hxx>
      58                 :            : #include <IDocumentDeviceAccess.hxx>
      59                 :            : 
      60                 :            : #include <crsrsh.hxx>
      61                 :            : 
      62                 :            : /*************************************************************************
      63                 :            :  *                      class SwTmpEndPortion
      64                 :            :  *************************************************************************/
      65                 :            : 
      66                 :          0 : SwTmpEndPortion::SwTmpEndPortion( const SwLinePortion &rPortion )
      67                 :            : {
      68                 :          0 :     Height( rPortion.Height() );
      69                 :          0 :     SetAscent( rPortion.GetAscent() );
      70                 :          0 :     SetWhichPor( POR_TMPEND );
      71                 :          0 : }
      72                 :            : 
      73                 :            : /*************************************************************************
      74                 :            :  *                 virtual SwTmpEndPortion::Paint()
      75                 :            :  *************************************************************************/
      76                 :            : 
      77                 :          0 : void SwTmpEndPortion::Paint( const SwTxtPaintInfo &rInf ) const
      78                 :            : {
      79 [ #  # ][ #  # ]:          0 :     if( rInf.OnWin() && rInf.GetOpt().IsParagraph() )
                 [ #  # ]
      80                 :            :     {
      81         [ #  # ]:          0 :         SwDefFontSave aSave( rInf );
      82                 :          0 :         const rtl::OUString aTmp( CH_PAR );
      83 [ #  # ][ #  # ]:          0 :         rInf.DrawText( aTmp, *this );
         [ #  # ][ #  # ]
      84                 :            :     }
      85                 :          0 : }
      86                 :            : 
      87                 :            : /*************************************************************************
      88                 :            :  *                      class SwBreakPortion
      89                 :            :  *************************************************************************/
      90                 :        271 : SwBreakPortion::SwBreakPortion( const SwLinePortion &rPortion )
      91                 :        271 :     : SwLinePortion( rPortion )
      92                 :            : {
      93                 :        271 :     nLineLength = 1;
      94                 :        271 :     SetWhichPor( POR_BRK );
      95                 :        271 : }
      96                 :            : 
      97                 :          0 : xub_StrLen SwBreakPortion::GetCrsrOfst( const KSHORT ) const
      98                 :          0 : { return 0; }
      99                 :            : 
     100                 :       1095 : KSHORT SwBreakPortion::GetViewWidth( const SwTxtSizeInfo & ) const
     101                 :       1095 : { return 0; }
     102                 :            : 
     103                 :        112 : SwLinePortion *SwBreakPortion::Compress()
     104 [ -  + ][ #  # ]:        112 : { return (GetPortion() && GetPortion()->InTxtGrp() ? 0 : this); }
     105                 :            : 
     106                 :        813 : void SwBreakPortion::Paint( const SwTxtPaintInfo &rInf ) const
     107                 :            : {
     108 [ +  - ][ -  + ]:        813 :     if( rInf.OnWin() && rInf.GetOpt().IsLineBreak() )
                 [ -  + ]
     109                 :          0 :         rInf.DrawLineBreak( *this );
     110                 :        813 : }
     111                 :            : 
     112                 :            : /*************************************************************************
     113                 :            :  *                 virtual SwBreakPortion::Format()
     114                 :            :  *************************************************************************/
     115                 :            : 
     116                 :        271 : sal_Bool SwBreakPortion::Format( SwTxtFormatInfo &rInf )
     117                 :            : {
     118                 :        271 :     const SwLinePortion *pRoot = rInf.GetRoot();
     119                 :        271 :     Width( 0 );
     120                 :        271 :     Height( pRoot->Height() );
     121                 :        271 :     SetAscent( pRoot->GetAscent() );
     122         [ +  + ]:        271 :     if ( rInf.GetIdx()+1 == rInf.GetTxt().Len() )
     123                 :         68 :         rInf.SetNewLine( sal_True );
     124                 :        271 :     return sal_True;
     125                 :            : }
     126                 :            : 
     127                 :            : /*************************************************************************
     128                 :            :  *              virtual SwBreakPortion::HandlePortion()
     129                 :            :  *************************************************************************/
     130                 :            : 
     131                 :          0 : void SwBreakPortion::HandlePortion( SwPortionHandler& rPH ) const
     132                 :            : {
     133                 :          0 :     rPH.Text( GetLen(), GetWhichPor() );
     134                 :          0 : }
     135                 :            : 
     136                 :            : 
     137                 :        256 : SwKernPortion::SwKernPortion( SwLinePortion &rPortion, short nKrn,
     138                 :            :                               sal_Bool bBG, sal_Bool bGK ) :
     139                 :        256 :     nKern( nKrn ), bBackground( bBG ), bGridKern( bGK )
     140                 :            : {
     141                 :        256 :     Height( rPortion.Height() );
     142                 :        256 :     SetAscent( rPortion.GetAscent() );
     143                 :        256 :     nLineLength = 0;
     144                 :        256 :     SetWhichPor( POR_KERN );
     145         [ +  - ]:        256 :     if( nKern > 0 )
     146                 :        256 :         Width( nKern );
     147         [ +  - ]:        256 :      rPortion.Insert( this );
     148                 :        256 : }
     149                 :            : 
     150                 :          0 : SwKernPortion::SwKernPortion( const SwLinePortion& rPortion ) :
     151                 :          0 :     nKern( 0 ), bBackground( sal_False ), bGridKern( sal_True )
     152                 :            : {
     153                 :          0 :     Height( rPortion.Height() );
     154                 :          0 :     SetAscent( rPortion.GetAscent() );
     155                 :            : 
     156                 :          0 :     nLineLength = 0;
     157                 :          0 :     SetWhichPor( POR_KERN );
     158                 :          0 : }
     159                 :            : 
     160                 :          0 : void SwKernPortion::Paint( const SwTxtPaintInfo &rInf ) const
     161                 :            : {
     162         [ #  # ]:          0 :     if( Width() )
     163                 :            :     {
     164                 :            :         // bBackground is set for Kerning Portions between two fields
     165         [ #  # ]:          0 :         if ( bBackground )
     166                 :          0 :             rInf.DrawViewOpt( *this, POR_FLD );
     167                 :            : 
     168                 :          0 :         rInf.DrawBackBrush( *this );
     169                 :            : 
     170                 :            :         // do we have to repaint a post it portion?
     171 [ #  # ][ #  # ]:          0 :         if( rInf.OnWin() && pPortion && !pPortion->Width() )
         [ #  # ][ #  # ]
     172                 :          0 :             pPortion->PrePaint( rInf, this );
     173                 :            : 
     174         [ #  # ]:          0 :         if( rInf.GetFont()->IsPaintBlank() )
     175                 :            :         {
     176                 :            :             static sal_Char const sDoubleSpace[] = "  ";
     177         [ #  # ]:          0 :             XubString aTxtDouble( sDoubleSpace, RTL_TEXTENCODING_MS_1252 );
     178                 :            :             //
     179                 :          0 :             SwRect aClipRect;
     180         [ #  # ]:          0 :             rInf.CalcRect( *this, &aClipRect, 0 );
     181         [ #  # ]:          0 :             SwSaveClip aClip( (OutputDevice*)rInf.GetOut() );
     182         [ #  # ]:          0 :             aClip.ChgClip( aClipRect, 0 );
     183 [ #  # ][ #  # ]:          0 :             rInf.DrawText( aTxtDouble, *this, 0, 2, sal_True );
                 [ #  # ]
     184                 :            :         }
     185                 :            :     }
     186                 :          0 : }
     187                 :            : 
     188                 :        256 : void SwKernPortion::FormatEOL( SwTxtFormatInfo &rInf )
     189                 :            : {
     190         [ -  + ]:        256 :     if ( bGridKern )
     191                 :        256 :         return;
     192                 :            : 
     193         [ +  - ]:        256 :     if( rInf.GetLast() == this )
     194                 :        256 :         rInf.SetLast( FindPrevPortion( rInf.GetRoot() ) );
     195         [ -  + ]:        256 :     if( nKern < 0 )
     196                 :          0 :         Width( -nKern );
     197                 :            :     else
     198                 :        256 :         Width( 0 );
     199                 :        256 :     rInf.GetLast()->FormatEOL( rInf );
     200                 :            : }
     201                 :            : 
     202                 :         42 : SwArrowPortion::SwArrowPortion( const SwLinePortion &rPortion ) :
     203                 :         42 :     bLeft( sal_True )
     204                 :            : {
     205                 :         42 :     Height( rPortion.Height() );
     206                 :         42 :     SetAscent( rPortion.GetAscent() );
     207                 :         42 :     nLineLength = 0;
     208                 :         42 :     SetWhichPor( POR_ARROW );
     209                 :         42 : }
     210                 :            : 
     211                 :         14 : SwArrowPortion::SwArrowPortion( const SwTxtPaintInfo &rInf )
     212                 :         14 :     : bLeft( sal_False )
     213                 :            : {
     214                 :         14 :     Height( (sal_uInt16)(rInf.GetTxtFrm()->Prt().Height()) );
     215                 :         14 :     aPos.X() = rInf.GetTxtFrm()->Frm().Left() +
     216                 :         14 :                rInf.GetTxtFrm()->Prt().Right();
     217                 :         14 :     aPos.Y() = rInf.GetTxtFrm()->Frm().Top() +
     218                 :         14 :                rInf.GetTxtFrm()->Prt().Bottom();
     219                 :         14 :     SetWhichPor( POR_ARROW );
     220                 :         14 : }
     221                 :            : 
     222                 :          0 : void SwArrowPortion::Paint( const SwTxtPaintInfo &rInf ) const
     223                 :            : {
     224                 :          0 :     ((SwArrowPortion*)this)->aPos = rInf.GetPos();
     225                 :          0 : }
     226                 :            : 
     227                 :         42 : SwLinePortion *SwArrowPortion::Compress() { return this; }
     228                 :            : 
     229                 :       9406 : SwTwips SwTxtFrm::EmptyHeight() const
     230                 :            : {
     231         [ -  + ]:       9406 :     if (IsCollapse()) {
     232                 :          0 :         ViewShell *pSh = getRootFrm()->GetCurrShell();
     233         [ #  # ]:          0 :         if ( pSh->IsA( TYPE(SwCrsrShell) ) ) {
     234                 :          0 :             SwCrsrShell *pCrSh=(SwCrsrShell*)pSh;
     235                 :          0 :             SwCntntFrm *pCurrFrm=pCrSh->GetCurrFrm();
     236         [ #  # ]:          0 :             if (pCurrFrm==(SwCntntFrm*)this) {
     237                 :            :                 // do nothing
     238                 :            :             } else {
     239                 :          0 :                 return 1;
     240                 :            :             }
     241                 :            :         } else {
     242                 :          0 :             return 1;
     243                 :            :         }
     244                 :            :     }
     245                 :            :     OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::EmptyHeight with swapped frame" );
     246                 :            : 
     247                 :            :     SwFont *pFnt;
     248                 :       9406 :     const SwTxtNode& rTxtNode = *GetTxtNode();
     249                 :       9406 :     const IDocumentSettingAccess* pIDSA = rTxtNode.getIDocumentSettingAccess();
     250                 :       9406 :     ViewShell *pSh = getRootFrm()->GetCurrShell();
     251         [ +  + ]:       9406 :     if ( rTxtNode.HasSwAttrSet() )
     252                 :            :     {
     253                 :       3589 :         const SwAttrSet *pAttrSet = &( rTxtNode.GetSwAttrSet() );
     254         [ +  - ]:       3589 :         pFnt = new SwFont( pAttrSet, pIDSA );
     255                 :            :     }
     256                 :            :     else
     257                 :            :     {
     258         [ +  - ]:       5817 :         SwFontAccess aFontAccess( &rTxtNode.GetAnyFmtColl(), pSh);
     259 [ +  - ][ +  - ]:       5817 :         pFnt = new SwFont( *aFontAccess.Get()->GetFont() );
                 [ +  - ]
     260 [ +  - ][ +  - ]:       5817 :         pFnt->ChkMagic( pSh, pFnt->GetActual() );
     261                 :            :     }
     262                 :            : 
     263         [ -  + ]:       9406 :     if ( IsVertical() )
     264                 :          0 :         pFnt->SetVertical( 2700 );
     265                 :            : 
     266         [ +  - ]:       9406 :     OutputDevice* pOut = pSh ? pSh->GetOut() : 0;
     267         [ +  - ]:       9541 :     if ( !pOut || !pSh->GetViewOptions()->getBrowseMode() ||
           [ +  +  -  + ]
                 [ +  + ]
     268                 :        135 :          pSh->GetViewOptions()->IsPrtFormat() )
     269                 :            :     {
     270                 :       9271 :         pOut = rTxtNode.getIDocumentDeviceAccess()->getReferenceDevice(true);
     271                 :            :     }
     272                 :            : 
     273                 :       9406 :     const IDocumentRedlineAccess* pIDRA = rTxtNode.getIDocumentRedlineAccess();
     274         [ +  + ]:       9406 :     if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) )
     275                 :            :     {
     276                 :       9358 :         MSHORT nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
     277         [ -  + ]:       9358 :         if( MSHRT_MAX != nRedlPos )
     278                 :            :         {
     279         [ #  # ]:          0 :             SwAttrHandler aAttrHandler;
     280         [ #  # ]:          0 :             aAttrHandler.Init(  GetTxtNode()->GetSwAttrSet(),
     281 [ #  # ][ #  # ]:          0 :                                *GetTxtNode()->getIDocumentSettingAccess(), NULL );
     282                 :            :             SwRedlineItr aRedln( rTxtNode, *pFnt, aAttrHandler,
     283 [ #  # ][ #  # ]:          0 :                                  nRedlPos, sal_True );
                 [ #  # ]
     284                 :            :         }
     285                 :            :     }
     286                 :            : 
     287                 :            :     SwTwips nRet;
     288         [ -  + ]:       9406 :     if( !pOut )
     289                 :          0 :         nRet = IsVertical() ?
     290                 :          0 :                Prt().SSize().Width() + 1 :
     291         [ #  # ]:          0 :                Prt().SSize().Height() + 1;
     292                 :            :     else
     293                 :            :     {
     294                 :       9406 :         pFnt->SetFntChg( sal_True );
     295                 :       9406 :         pFnt->ChgPhysFnt( pSh, *pOut );
     296                 :       9406 :         nRet = pFnt->GetHeight( pSh, *pOut );
     297                 :            :     }
     298         [ +  - ]:       9406 :     delete pFnt;
     299                 :       9406 :     return nRet;
     300                 :            : }
     301                 :            : 
     302                 :            : /*************************************************************************
     303                 :            :  *                      SwTxtFrm::FormatEmpty()
     304                 :            :  *************************************************************************/
     305                 :            : 
     306                 :       7054 : sal_Bool SwTxtFrm::FormatEmpty()
     307                 :            : {
     308                 :            :     OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::FormatEmpty with swapped frame" );
     309                 :            : 
     310 [ +  - ][ +  +  :      31178 :     if ( HasFollow() || GetTxtNode()->GetpSwpHints() ||
          +  +  +  +  +  
             +  +  +  +  
              + ][ +  + ]
     311                 :       6126 :         0 != GetTxtNode()->GetNumRule() ||
     312                 :       6124 :         GetTxtNode()->HasHiddenCharAttribute( true ) ||
     313                 :      11874 :          IsInFtn() || ( HasPara() && GetPara()->IsPrepMustFit() ) )
     314                 :       1305 :         return sal_False;
     315                 :       5749 :     const SwAttrSet& aSet = GetTxtNode()->GetSwAttrSet();
     316                 :       5749 :     const SvxAdjust nAdjust = aSet.GetAdjust().GetAdjust();
     317   [ +  +  -  + ]:      15695 :     if( ( ( ! IsRightToLeft() && ( SVX_ADJUST_LEFT != nAdjust ) ) ||
           [ #  #  -  + ]
         [ +  + ][ +  - ]
     318                 :       4973 :           (   IsRightToLeft() && ( SVX_ADJUST_RIGHT != nAdjust ) ) ) ||
     319                 :       4973 :           aSet.GetRegister().GetValue() )
     320                 :        776 :         return sal_False;
     321                 :       4973 :     const SvxLineSpacingItem &rSpacing = aSet.GetLineSpacing();
     322 [ -  + ][ +  -  :      14919 :     if( SVX_LINE_SPACE_MIN == rSpacing.GetLineSpaceRule() ||
             +  -  -  + ]
     323                 :       4973 :         SVX_LINE_SPACE_FIX == rSpacing.GetLineSpaceRule() ||
     324                 :       4973 :         aSet.GetLRSpace().IsAutoFirst() )
     325                 :          0 :         return sal_False;
     326                 :            :     else
     327                 :            :     {
     328         [ +  - ]:       4973 :         SwTxtFly aTxtFly( this );
     329                 :       4973 :         SwRect aRect;
     330                 :       4973 :         sal_Bool bFirstFlyCheck = 0 != Prt().Height();
     331 [ +  + ][ +  + ]:       7859 :         if ( bFirstFlyCheck &&
           [ +  +  +  + ]
     332         [ +  - ]:       2886 :              aTxtFly.IsOn() && aTxtFly.IsAnyObj( aRect ) )
     333                 :        250 :             return sal_False;
     334                 :            :         else
     335                 :            :         {
     336         [ +  - ]:       4723 :             SwTwips nHeight = EmptyHeight();
     337                 :            : 
     338 [ +  - ][ +  - ]:       9446 :             if ( GetTxtNode()->GetSwAttrSet().GetParaGrid().GetValue() &&
         [ +  - ][ +  + ]
                 [ +  + ]
     339         [ +  - ]:       4723 :                  IsInDocBody() )
     340                 :            :             {
     341 [ +  - ][ +  - ]:       4374 :                 GETGRID( FindPageFrm() )
         [ +  - ][ -  + ]
         [ #  # ][ #  # ]
         [ #  # ][ -  + ]
     342         [ -  + ]:       4374 :                 if ( pGrid )
     343                 :          0 :                     nHeight = pGrid->GetBaseHeight() + pGrid->GetRubyHeight();
     344                 :            :             }
     345                 :            : 
     346 [ +  - ][ -  + ]:       4723 :             SWRECTFN( this )
         [ #  # ][ #  # ]
                 [ -  + ]
     347 [ +  - ][ +  - ]:       4723 :             const SwTwips nChg = nHeight - (Prt().*fnRect->fnGetHeight)();
     348                 :            : 
     349         [ +  + ]:       4723 :             if( !nChg )
     350                 :       2106 :                 SetUndersized( sal_False );
     351         [ +  - ]:       4723 :             AdjustFrm( nChg );
     352                 :            : 
     353         [ -  + ]:       4723 :             if( HasBlinkPor() )
     354                 :            :             {
     355         [ #  # ]:          0 :                 ClearPara();
     356                 :          0 :                 ResetBlinkPor();
     357                 :            :             }
     358                 :       4723 :             SetCacheIdx( MSHRT_MAX );
     359         [ +  + ]:       4723 :             if( !IsEmpty() )
     360                 :            :             {
     361                 :       2508 :                 SetEmpty( sal_True );
     362                 :       2508 :                 SetCompletePaint();
     363                 :            :             }
     364   [ +  +  +  + ]:       7379 :             if( !bFirstFlyCheck &&
         [ +  + ][ +  + ]
     365         [ +  - ]:       2656 :                  aTxtFly.IsOn() && aTxtFly.IsAnyObj( aRect ) )
     366                 :         46 :                  return sal_False;
     367                 :            : 
     368                 :            :             // #i35635# - call method <HideAndShowObjects()>
     369                 :            :             // to assure that objects anchored at the empty paragraph are
     370                 :            :             // correctly visible resp. invisible.
     371         [ +  - ]:       4677 :             HideAndShowObjects();
     372                 :       4677 :             return sal_True;
     373         [ +  - ]:       7054 :         }
     374                 :            :     }
     375                 :            : }
     376                 :            : 
     377                 :          0 : sal_Bool SwTxtFrm::FillRegister( SwTwips& rRegStart, KSHORT& rRegDiff )
     378                 :            : {
     379                 :          0 :     const SwFrm *pFrm = this;
     380                 :          0 :     rRegDiff = 0;
     381   [ #  #  #  # ]:          0 :     while( !( ( FRM_BODY | FRM_FLY )
                 [ #  # ]
     382                 :          0 :            & pFrm->GetType() ) && pFrm->GetUpper() )
     383                 :          0 :         pFrm = pFrm->GetUpper();
     384         [ #  # ]:          0 :     if( ( FRM_BODY| FRM_FLY ) & pFrm->GetType() )
     385                 :            :     {
     386 [ #  # ][ #  # ]:          0 :         SWRECTFN( pFrm )
         [ #  # ][ #  # ]
     387         [ #  # ]:          0 :         rRegStart = (pFrm->*fnRect->fnGetPrtTop)();
     388                 :          0 :         pFrm = pFrm->FindPageFrm();
     389         [ #  # ]:          0 :         if( pFrm->IsPageFrm() )
     390                 :            :         {
     391                 :          0 :             SwPageDesc* pDesc = ((SwPageFrm*)pFrm)->FindPageDesc();
     392         [ #  # ]:          0 :             if( pDesc )
     393                 :            :             {
     394                 :          0 :                 rRegDiff = pDesc->GetRegHeight();
     395         [ #  # ]:          0 :                 if( !rRegDiff )
     396                 :            :                 {
     397                 :          0 :                     const SwTxtFmtColl *pFmt = pDesc->GetRegisterFmtColl();
     398         [ #  # ]:          0 :                     if( pFmt )
     399                 :            :                     {
     400                 :          0 :                         const SvxLineSpacingItem &rSpace = pFmt->GetLineSpacing();
     401         [ #  # ]:          0 :                         if( SVX_LINE_SPACE_FIX == rSpace.GetLineSpaceRule() )
     402                 :            :                         {
     403                 :          0 :                             rRegDiff = rSpace.GetLineHeight();
     404                 :          0 :                             pDesc->SetRegHeight( rRegDiff );
     405                 :          0 :                             pDesc->SetRegAscent( ( 4 * rRegDiff ) / 5 );
     406                 :            :                         }
     407                 :            :                         else
     408                 :            :                         {
     409                 :          0 :                             ViewShell *pSh = getRootFrm()->GetCurrShell();
     410         [ #  # ]:          0 :                             SwFontAccess aFontAccess( pFmt, pSh );
     411 [ #  # ][ #  # ]:          0 :                             SwFont aFnt( *aFontAccess.Get()->GetFont() );
     412                 :            : 
     413                 :          0 :                             OutputDevice *pOut = 0;
     414         [ #  # ]:          0 :                             if( !pSh || !pSh->GetViewOptions()->getBrowseMode() ||
           [ #  #  #  # ]
                 [ #  # ]
     415                 :          0 :                                 pSh->GetViewOptions()->IsPrtFormat() )
     416 [ #  # ][ #  # ]:          0 :                                 pOut = GetTxtNode()->getIDocumentDeviceAccess()->getReferenceDevice( true );
     417                 :            : 
     418 [ #  # ][ #  # ]:          0 :                             if( pSh && !pOut )
     419                 :          0 :                                 pOut = pSh->GetWin();
     420                 :            : 
     421         [ #  # ]:          0 :                             if( !pOut )
     422 [ #  # ][ #  # ]:          0 :                                 pOut = GetpApp()->GetDefaultDevice();
     423                 :            : 
     424         [ #  # ]:          0 :                             MapMode aOldMap( pOut->GetMapMode() );
     425 [ #  # ][ #  # ]:          0 :                             pOut->SetMapMode( MapMode( MAP_TWIP ) );
                 [ #  # ]
     426                 :            : 
     427         [ #  # ]:          0 :                             aFnt.ChgFnt( pSh, *pOut );
     428         [ #  # ]:          0 :                             rRegDiff = aFnt.GetHeight( pSh, *pOut );
     429                 :          0 :                             KSHORT nNettoHeight = rRegDiff;
     430                 :            : 
     431      [ #  #  # ]:          0 :                             switch( rSpace.GetLineSpaceRule() )
     432                 :            :                             {
     433                 :            :                                 case SVX_LINE_SPACE_AUTO:
     434                 :          0 :                                 break;
     435                 :            :                                 case SVX_LINE_SPACE_MIN:
     436                 :            :                                 {
     437         [ #  # ]:          0 :                                     if( rRegDiff < KSHORT( rSpace.GetLineHeight() ) )
     438                 :          0 :                                         rRegDiff = rSpace.GetLineHeight();
     439                 :          0 :                                     break;
     440                 :            :                                 }
     441                 :            :                                 default:
     442                 :            :                                     OSL_FAIL( ": unknown LineSpaceRule" );
     443                 :            :                             }
     444   [ #  #  #  # ]:          0 :                             switch( rSpace.GetInterLineSpaceRule() )
     445                 :            :                             {
     446                 :            :                                 case SVX_INTER_LINE_SPACE_OFF:
     447                 :          0 :                                 break;
     448                 :            :                                 case SVX_INTER_LINE_SPACE_PROP:
     449                 :            :                                 {
     450                 :          0 :                                     long nTmp = rSpace.GetPropLineSpace();
     451         [ #  # ]:          0 :                                     if( nTmp < 50 )
     452         [ #  # ]:          0 :                                         nTmp = nTmp ? 50 : 100;
     453                 :          0 :                                     nTmp *= rRegDiff;
     454                 :          0 :                                     nTmp /= 100;
     455         [ #  # ]:          0 :                                     if( !nTmp )
     456                 :          0 :                                         ++nTmp;
     457                 :          0 :                                     rRegDiff = (KSHORT)nTmp;
     458                 :          0 :                                     nNettoHeight = rRegDiff;
     459                 :          0 :                                     break;
     460                 :            :                                 }
     461                 :            :                                 case SVX_INTER_LINE_SPACE_FIX:
     462                 :            :                                 {
     463                 :          0 :                                     rRegDiff = rRegDiff + rSpace.GetInterLineSpace();
     464                 :          0 :                                     nNettoHeight = rRegDiff;
     465                 :          0 :                                     break;
     466                 :            :                                 }
     467                 :            :                                 default: OSL_FAIL( ": unknown InterLineSpaceRule" );
     468                 :            :                             }
     469                 :          0 :                             pDesc->SetRegHeight( rRegDiff );
     470                 :            :                             pDesc->SetRegAscent( rRegDiff - nNettoHeight +
     471         [ #  # ]:          0 :                                                  aFnt.GetAscent( pSh, *pOut ) );
     472 [ #  # ][ #  # ]:          0 :                             pOut->SetMapMode( aOldMap );
         [ #  # ][ #  # ]
     473                 :            :                         }
     474                 :            :                     }
     475                 :            :                 }
     476                 :          0 :                 const long nTmpDiff = pDesc->GetRegAscent() - rRegDiff;
     477         [ #  # ]:          0 :                 if ( bVert )
     478                 :          0 :                     rRegStart -= nTmpDiff;
     479                 :            :                 else
     480                 :          0 :                     rRegStart += nTmpDiff;
     481                 :            :             }
     482                 :            :         }
     483                 :            :     }
     484                 :          0 :     return ( 0 != rRegDiff );
     485                 :            : }
     486                 :            : 
     487                 :            : /*************************************************************************
     488                 :            :  *              virtual SwHiddenTextPortion::Paint()
     489                 :            :  *************************************************************************/
     490                 :            : 
     491                 :          0 : void SwHiddenTextPortion::Paint( const SwTxtPaintInfo & rInf) const
     492                 :            : {
     493                 :            :     (void)rInf;
     494                 :            : #ifdef DBG_UTIL
     495                 :            :     OutputDevice* pOut = (OutputDevice*)rInf.GetOut();
     496                 :            :     Color aCol( SwViewOption::GetFieldShadingsColor() );
     497                 :            :     Color aOldColor( pOut->GetFillColor() );
     498                 :            :     pOut->SetFillColor( aCol );
     499                 :            :     Point aPos( rInf.GetPos() );
     500                 :            :     aPos.Y() -= 150;
     501                 :            :     aPos.X() -= 25;
     502                 :            :     SwRect aRect( aPos, Size( 100, 200 ) );
     503                 :            :     ((OutputDevice*)pOut)->DrawRect( aRect.SVRect() );
     504                 :            :     pOut->SetFillColor( aOldColor );
     505                 :            : #endif
     506                 :          0 : }
     507                 :            : 
     508                 :            : /*************************************************************************
     509                 :            :  *              virtual SwHiddenTextPortion::Format()
     510                 :            :  *************************************************************************/
     511                 :            : 
     512                 :          0 : sal_Bool SwHiddenTextPortion::Format( SwTxtFormatInfo &rInf )
     513                 :            : {
     514                 :          0 :     Width( 0 );
     515                 :          0 :     rInf.GetTxtFrm()->HideFootnotes( rInf.GetIdx(), rInf.GetIdx() + GetLen() );
     516                 :            : 
     517                 :          0 :     return sal_False;
     518                 :            : };
     519                 :            : 
     520                 :            : /*************************************************************************
     521                 :            :  *              virtual SwControlCharPortion::Paint()
     522                 :            :  *************************************************************************/
     523                 :            : 
     524                 :          0 : void SwControlCharPortion::Paint( const SwTxtPaintInfo &rInf ) const
     525                 :            : {
     526         [ #  # ]:          0 :     if ( Width() )  // is only set during prepaint mode
     527                 :            :     {
     528                 :          0 :         rInf.DrawViewOpt( *this, POR_CONTROLCHAR );
     529                 :            : 
     530 [ #  # ][ #  # ]:          0 :         if ( !rInf.GetOpt().IsPagePreview() &&
           [ #  #  #  #  
                   #  # ]
     531                 :          0 :              !rInf.GetOpt().IsReadonly() &&
     532                 :          0 :               SwViewOption::IsFieldShadings() &&
     533                 :            :               CHAR_ZWNBSP != mcChar )
     534                 :            :         {
     535         [ #  # ]:          0 :             SwFont aTmpFont( *rInf.GetFont() );
     536         [ #  # ]:          0 :             aTmpFont.SetEscapement( CHAR_ZWSP == mcChar ? DFLT_ESC_AUTO_SUB : -25 );
     537                 :          0 :             const sal_uInt16 nProp = 40;
     538         [ #  # ]:          0 :             aTmpFont.SetProportion( nProp );  // a smaller font
     539         [ #  # ]:          0 :             SwFontSave aFontSave( rInf, &aTmpFont );
     540                 :            : 
     541         [ #  # ]:          0 :             String aOutString;
     542                 :            : 
     543         [ #  # ]:          0 :             switch ( mcChar )
     544                 :            :             {
     545                 :            :                 case CHAR_ZWSP :
     546         [ #  # ]:          0 :                     aOutString = '/'; break;
     547                 :            : //                case CHAR_LRM :
     548                 :            : //                    rTxt = sal_Unicode(0x2514); break;
     549                 :            : //                case CHAR_RLM :
     550                 :            : //                    rTxt = sal_Unicode(0x2518); break;
     551                 :            :             }
     552                 :            : 
     553         [ #  # ]:          0 :             if ( !mnHalfCharWidth )
     554         [ #  # ]:          0 :                 mnHalfCharWidth = rInf.GetTxtSize( aOutString ).Width() / 2;
     555                 :            : 
     556                 :          0 :             Point aOldPos = rInf.GetPos();
     557                 :          0 :             Point aNewPos( aOldPos );
     558                 :          0 :             aNewPos.X() = aNewPos.X() + ( Width() / 2 ) - mnHalfCharWidth;
     559                 :          0 :             const_cast< SwTxtPaintInfo& >( rInf ).SetPos( aNewPos );
     560                 :            : 
     561         [ #  # ]:          0 :             rInf.DrawText( aOutString, *this );
     562                 :            : 
     563 [ #  # ][ #  # ]:          0 :             const_cast< SwTxtPaintInfo& >( rInf ).SetPos( aOldPos );
                 [ #  # ]
     564                 :            :         }
     565                 :            :     }
     566                 :          0 : }
     567                 :            : 
     568                 :            : /*************************************************************************
     569                 :            :  *              virtual SwControlCharPortion::Format()
     570                 :            :  *************************************************************************/
     571                 :            : 
     572                 :          0 : sal_Bool SwControlCharPortion::Format( SwTxtFormatInfo &rInf )
     573                 :            : {
     574                 :          0 :     const SwLinePortion* pRoot = rInf.GetRoot();
     575                 :          0 :     Width( 0 );
     576                 :          0 :     Height( pRoot->Height() );
     577                 :          0 :     SetAscent( pRoot->GetAscent() );
     578                 :            : 
     579                 :          0 :     return sal_False;
     580                 :            : }
     581                 :            : 
     582                 :            : /*************************************************************************
     583                 :            :  *              virtual SwControlCharPortion::GetViewWidth()
     584                 :            :  *************************************************************************/
     585                 :            : 
     586                 :          0 : KSHORT SwControlCharPortion::GetViewWidth( const SwTxtSizeInfo& rInf ) const
     587                 :            : {
     588         [ #  # ]:          0 :     if( !mnViewWidth )
     589 [ #  # ][ #  # ]:          0 :         mnViewWidth = rInf.GetTxtSize(rtl::OUString(' ')).Width();
                 [ #  # ]
     590                 :            : 
     591                 :          0 :     return mnViewWidth;
     592                 :            : }
     593                 :            : 
     594                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10