LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/text - porrst.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 102 292 34.9 %
Date: 2012-12-27 Functions: 7 25 28.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10