LCOV - code coverage report
Current view: top level - sw/source/core/doc - notxtfrm.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 268 456 58.8 %
Date: 2012-08-25 Functions: 18 23 78.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 302 852 35.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                 :            : #include <tools/urlobj.hxx>
      31                 :            : #include <vcl/print.hxx>
      32                 :            : #include <vcl/virdev.hxx>
      33                 :            : #include <vcl/svapp.hxx>
      34                 :            : #include <svtools/imapobj.hxx>
      35                 :            : #include <svtools/imap.hxx>
      36                 :            : #include <svl/urihelper.hxx>
      37                 :            : #include <svtools/soerr.hxx>
      38                 :            : #include <sfx2/progress.hxx>
      39                 :            : #include <sfx2/docfile.hxx>
      40                 :            : #include <sfx2/printer.hxx>
      41                 :            : #include <editeng/udlnitem.hxx>
      42                 :            : #include <editeng/colritem.hxx>
      43                 :            : #include <svx/xoutbmp.hxx>
      44                 :            : #include <vcl/window.hxx>
      45                 :            : #include <fmturl.hxx>
      46                 :            : #include <fmtsrnd.hxx>
      47                 :            : #include <frmfmt.hxx>
      48                 :            : #include <swrect.hxx>
      49                 :            : #include <fesh.hxx>
      50                 :            : #include <doc.hxx>
      51                 :            : #include <flyfrm.hxx>
      52                 :            : #include <frmtool.hxx>
      53                 :            : #include <viewopt.hxx>
      54                 :            : #include <viewimp.hxx>
      55                 :            : #include <pam.hxx>
      56                 :            : #include <hints.hxx>
      57                 :            : #include <rootfrm.hxx>
      58                 :            : #include <dflyobj.hxx>
      59                 :            : #include <pagefrm.hxx>
      60                 :            : #include <notxtfrm.hxx>
      61                 :            : #include <grfatr.hxx>
      62                 :            : #include <charatr.hxx>
      63                 :            : #include <fmtornt.hxx>
      64                 :            : #include <ndnotxt.hxx>
      65                 :            : #include <ndgrf.hxx>
      66                 :            : #include <ndole.hxx>
      67                 :            : #include <swregion.hxx>
      68                 :            : #include <poolfmt.hxx>
      69                 :            : #include <mdiexp.hxx>
      70                 :            : #include <swwait.hxx>
      71                 :            : #include <comcore.hrc>
      72                 :            : #include <accessibilityoptions.hxx>
      73                 :            : #include <com/sun/star/embed/EmbedMisc.hpp>
      74                 :            : #include <com/sun/star/embed/EmbedStates.hpp>
      75                 :            : 
      76                 :            : #include <svtools/embedhlp.hxx>
      77                 :            : #include <svtools/chartprettypainter.hxx>
      78                 :            : #include <dview.hxx> // #i99665#
      79                 :            : 
      80                 :            : using namespace com::sun::star;
      81                 :            : 
      82                 :            : extern void ClrContourCache( const SdrObject *pObj ); // TxtFly.Cxx
      83                 :            : 
      84                 :            : 
      85                 :         34 : inline sal_Bool GetRealURL( const SwGrfNode& rNd, String& rTxt )
      86                 :            : {
      87                 :         34 :     sal_Bool bRet = rNd.GetFileFilterNms( &rTxt, 0 );
      88         [ +  - ]:         34 :     if( bRet )
      89                 :            :         rTxt = URIHelper::removePassword( rTxt, INetURLObject::WAS_ENCODED,
      90 [ +  - ][ +  - ]:         34 :                                            INetURLObject::DECODE_UNAMBIGUOUS);
      91                 :         34 :     return bRet;
      92                 :            : }
      93                 :            : 
      94                 :         57 : void lcl_PaintReplacement( const SwRect &rRect, const String &rText,
      95                 :            :                            const ViewShell &rSh, const SwNoTxtFrm *pFrm,
      96                 :            :                            sal_Bool bDefect )
      97                 :            : {
      98                 :            :     static Font *pFont = 0;
      99         [ +  + ]:         57 :     if ( !pFont )
     100                 :            :     {
     101 [ +  - ][ +  - ]:          2 :         pFont = new Font();
     102         [ +  - ]:          2 :         pFont->SetWeight( WEIGHT_BOLD );
     103         [ +  - ]:          2 :         pFont->SetStyleName( aEmptyStr );
     104         [ +  - ]:          2 :         pFont->SetName(rtl::OUString("Arial Unicode"));
     105         [ +  - ]:          2 :         pFont->SetFamily( FAMILY_SWISS );
     106         [ +  - ]:          2 :         pFont->SetTransparent( sal_True );
     107                 :            :     }
     108                 :            : 
     109                 :         57 :     Color aCol( COL_RED );
     110                 :         57 :     FontUnderline eUnderline = UNDERLINE_NONE;
     111 [ +  - ][ +  - ]:         57 :     const SwFmtURL &rURL = pFrm->FindFlyFrm()->GetFmt()->GetURL();
                 [ +  - ]
     112 [ +  - ][ +  + ]:         57 :     if( rURL.GetURL().Len() || rURL.GetMap() )
                 [ +  + ]
     113                 :            :     {
     114                 :          8 :         sal_Bool bVisited = sal_False;
     115         [ +  - ]:          8 :         if ( rURL.GetMap() )
     116                 :            :         {
     117                 :          8 :             ImageMap *pMap = (ImageMap*)rURL.GetMap();
     118         [ +  + ]:         16 :             for( sal_uInt16 i = 0; i < pMap->GetIMapObjectCount(); i++ )
     119                 :            :             {
     120         [ +  - ]:          8 :                 IMapObject *pObj = pMap->GetIMapObject( i );
     121 [ +  - ][ -  + ]:          8 :                 if( rSh.GetDoc()->IsVisitedURL( pObj->GetURL() ) )
     122                 :            :                 {
     123                 :          0 :                     bVisited = sal_True;
     124                 :          0 :                     break;
     125                 :            :                 }
     126                 :            :             }
     127                 :            :         }
     128         [ #  # ]:          0 :         else if ( rURL.GetURL().Len() )
     129         [ #  # ]:          0 :             bVisited = rSh.GetDoc()->IsVisitedURL( rURL.GetURL() );
     130                 :            : 
     131                 :          8 :         SwFmt *pFmt = rSh.GetDoc()->GetFmtFromPool( static_cast<sal_uInt16>
     132 [ +  - ][ -  + ]:          8 :             (bVisited ? RES_POOLCHR_INET_VISIT : RES_POOLCHR_INET_NORMAL ) );
     133         [ +  - ]:          8 :         aCol = pFmt->GetColor().GetValue();
     134         [ +  - ]:          8 :         eUnderline = pFmt->GetUnderline().GetLineStyle();
     135                 :            :     }
     136                 :            : 
     137         [ +  - ]:         57 :     pFont->SetUnderline( eUnderline );
     138         [ +  - ]:         57 :     pFont->SetColor( aCol );
     139                 :            : 
     140         [ +  - ]:         57 :     const BitmapEx& rBmp = ViewShell::GetReplacementBitmap( bDefect != sal_False );
     141         [ +  - ]:         57 :     Graphic::DrawEx( rSh.GetOut(), rText, *pFont, rBmp, rRect.Pos(), rRect.SSize() );
     142                 :         57 : }
     143                 :            : 
     144                 :            : /*************************************************************************
     145                 :            : |*
     146                 :            : |*    SwGrfFrm::SwGrfFrm(ViewShell * const,SwGrfNode *)
     147                 :            : |*
     148                 :            : *************************************************************************/
     149                 :            : 
     150                 :            : 
     151                 :        487 : SwNoTxtFrm::SwNoTxtFrm(SwNoTxtNode * const pNode, SwFrm* pSib )
     152                 :        487 :     : SwCntntFrm( pNode, pSib )
     153                 :            : {
     154                 :        487 :     InitCtor();
     155                 :        487 : }
     156                 :            : 
     157                 :            : // Initialization: Currently add the Frame to the Cache
     158                 :            : 
     159                 :            : 
     160                 :        487 : void SwNoTxtFrm::InitCtor()
     161                 :            : {
     162                 :        487 :     nType = FRMC_NOTXT;
     163                 :            :     // The graphic's weight is 0 if it has not been read,
     164                 :            :     // < 0 if we had a read error and we needed to use the replacement and
     165                 :            :     // > 0 if it is available
     166                 :        487 :     nWeight = 0;
     167                 :        487 : }
     168                 :            : 
     169                 :            : /*************************************************************************
     170                 :            : |*
     171                 :            : |*    SwNoTxtNode::MakeFrm()
     172                 :            : |*
     173                 :            : *************************************************************************/
     174                 :            : 
     175                 :            : 
     176                 :        487 : SwCntntFrm *SwNoTxtNode::MakeFrm( SwFrm* pSib )
     177                 :            : {
     178         [ +  - ]:        487 :     return new SwNoTxtFrm(this, pSib);
     179                 :            : }
     180                 :            : 
     181                 :            : /*************************************************************************
     182                 :            : |*
     183                 :            : |*    SwNoTxtFrm::~SwNoTxtFrm()
     184                 :            : |*
     185                 :            : *************************************************************************/
     186                 :            : 
     187                 :        397 : SwNoTxtFrm::~SwNoTxtFrm()
     188                 :            : {
     189         [ +  - ]:        397 :     StopAnimation();
     190         [ -  + ]:        794 : }
     191                 :            : 
     192                 :            : /*************************************************************************
     193                 :            : |*
     194                 :            : |*    void SwNoTxtFrm::Modify( SwHint * pOld, SwHint * pNew )
     195                 :            : |*
     196                 :            : *************************************************************************/
     197                 :            : 
     198                 :          0 : void SetOutDev( ViewShell *pSh, OutputDevice *pOut )
     199                 :            : {
     200                 :          0 :     pSh->pOut = pOut;
     201                 :          0 : }
     202                 :            : 
     203                 :            : 
     204                 :            : 
     205                 :            : 
     206                 :        263 : void lcl_ClearArea( const SwFrm &rFrm,
     207                 :            :                     OutputDevice &rOut, const SwRect& rPtArea,
     208                 :            :                     const SwRect &rGrfArea )
     209                 :            : {
     210         [ +  - ]:        263 :     SwRegionRects aRegion( rPtArea, 4 );
     211         [ +  - ]:        263 :     aRegion -= rGrfArea;
     212                 :            : 
     213         [ -  + ]:        263 :     if ( !aRegion.empty() )
     214                 :            :     {
     215                 :          0 :         const SvxBrushItem *pItem; const Color *pCol; SwRect aOrigRect;
     216 [ #  # ][ #  # ]:          0 :         if ( rFrm.GetBackgroundBrush( pItem, pCol, aOrigRect, sal_False ) )
     217         [ #  # ]:          0 :             for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
     218         [ #  # ]:          0 :                 ::DrawGraphic( pItem, &rOut, aOrigRect, aRegion[i] );
     219                 :            :         else
     220                 :            :         {
     221         [ #  # ]:          0 :             rOut.Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
     222 [ #  # ][ #  # ]:          0 :             rOut.SetFillColor( rFrm.getRootFrm()->GetCurrShell()->Imp()->GetRetoucheColor());
     223         [ #  # ]:          0 :             rOut.SetLineColor();
     224         [ #  # ]:          0 :             for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
     225 [ #  # ][ #  # ]:          0 :                 rOut.DrawRect( aRegion[i].SVRect() );
     226         [ #  # ]:          0 :             rOut.Pop();
     227                 :            :         }
     228                 :        263 :     }
     229                 :        263 : }
     230                 :            : 
     231                 :            : /*************************************************************************
     232                 :            : |*
     233                 :            : |*    void SwNoTxtFrm::Paint()
     234                 :            : |*
     235                 :            : *************************************************************************/
     236                 :            : 
     237                 :        263 : void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
     238                 :            : {
     239         [ +  - ]:        263 :     if ( Frm().IsEmpty() )
     240                 :            :         return;
     241                 :            : 
     242                 :        263 :     const ViewShell* pSh = getRootFrm()->GetCurrShell();
     243         [ -  + ]:        263 :     if( !pSh->GetViewOptions()->IsGraphic() )
     244                 :            :     {
     245         [ #  # ]:          0 :         StopAnimation();
     246                 :            :         // #i6467# - no paint of placeholder for page preview
     247 [ #  # ][ #  # ]:          0 :         if ( pSh->GetWin() && !pSh->IsPreView() )
                 [ #  # ]
     248                 :            :         {
     249                 :          0 :             const SwNoTxtNode* pNd = GetNode()->GetNoTxtNode();
     250         [ #  # ]:          0 :             String aTxt( pNd->GetTitle() );
     251 [ #  # ][ #  # ]:          0 :             if ( !aTxt.Len() && pNd->IsGrfNode() )
                 [ #  # ]
     252         [ #  # ]:          0 :                 GetRealURL( *(SwGrfNode*)pNd, aTxt );
     253         [ #  # ]:          0 :             if( !aTxt.Len() )
     254 [ #  # ][ #  # ]:          0 :                 aTxt = FindFlyFrm()->GetFmt()->GetName();
                 [ #  # ]
     255 [ #  # ][ #  # ]:          0 :             lcl_PaintReplacement( Frm(), aTxt, *pSh, this, sal_False );
     256                 :            :         }
     257                 :            :         return;
     258                 :            :     }
     259                 :            : 
     260   [ +  -  -  + ]:        526 :     if( pSh->GetAccessibilityOptions()->IsStopAnimatedGraphics() ||
                 [ -  + ]
     261                 :            :     // #i9684# Stop animation during printing/pdf export
     262                 :        263 :        !pSh->GetWin() )
     263         [ #  # ]:          0 :         StopAnimation();
     264                 :            : 
     265         [ +  - ]:        263 :     SfxProgress::EnterLock(); // No progress reschedules in paint (SwapIn)
     266                 :            : 
     267                 :        263 :     OutputDevice *pOut = pSh->GetOut();
     268         [ +  - ]:        263 :     pOut->Push();
     269                 :        263 :     sal_Bool bClip = sal_True;
     270         [ +  - ]:        263 :     PolyPolygon aPoly;
     271                 :            : 
     272                 :        263 :     SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode();
     273                 :        263 :     SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
     274         [ +  + ]:        263 :     if( pGrfNd )
     275                 :         60 :         pGrfNd->SetFrameInPaint( sal_True );
     276                 :            : 
     277                 :            :     // #i13147# - add 2nd parameter with value <sal_True> to
     278                 :            :     // method call <FindFlyFrm().GetContour(..)> to indicate that it is called
     279                 :            :     // for paint in order to avoid load of the intrinsic graphic.
     280   [ -  +  #  # ]:        526 :     if ( ( !pOut->GetConnectMetaFile() ||
         [ -  + ][ -  + ]
     281                 :          0 :            !pSh->GetWin() ) &&
     282 [ +  - ][ +  - ]:        263 :          FindFlyFrm()->GetContour( aPoly, sal_True )
     283                 :            :        )
     284                 :            :     {
     285 [ #  # ][ #  # ]:          0 :         pOut->SetClipRegion( aPoly );
                 [ #  # ]
     286                 :          0 :         bClip = sal_False;
     287                 :            :     }
     288                 :            : 
     289                 :        263 :     SwRect aOrigPaint( rRect );
     290 [ #  # ][ -  + ]:        263 :     if ( HasAnimation() && pSh->GetWin() )
                 [ -  + ]
     291                 :            :     {
     292                 :          0 :         aOrigPaint = Frm(); aOrigPaint += Prt().Pos();
     293                 :            :     }
     294                 :            : 
     295                 :        263 :     SwRect aGrfArea( Frm() );
     296                 :        263 :     SwRect aPaintArea( aGrfArea );
     297         [ +  - ]:        263 :     aPaintArea._Intersection( aOrigPaint );
     298                 :            : 
     299                 :        263 :     SwRect aNormal( Frm().Pos() + Prt().Pos(), Prt().SSize() );
     300         [ +  - ]:        263 :     aNormal.Justify(); // Normalized rectangle for the comparisons
     301                 :            : 
     302 [ +  - ][ +  - ]:        263 :     if( aPaintArea.IsOver( aNormal ) )
     303                 :            :     {
     304                 :            :         // Calculate the four to-be-deleted rectangles
     305         [ +  - ]:        263 :         if( pSh->GetWin() )
     306         [ +  - ]:        263 :             ::lcl_ClearArea( *this, *pSh->GetOut(), aPaintArea, aNormal );
     307                 :            : 
     308                 :            :         // The intersection of the PaintArea and the Bitmap contains the absolutely visible area of the Frame
     309         [ +  - ]:        263 :         aPaintArea._Intersection( aNormal );
     310                 :            : 
     311         [ +  - ]:        263 :         if ( bClip )
     312 [ +  - ][ +  - ]:        263 :             pOut->IntersectClipRegion( aPaintArea.SVRect() );
     313                 :            :         /// delete unused 3rd parameter
     314         [ +  - ]:        263 :         PaintPicture( pOut, aGrfArea );
     315                 :            :     }
     316                 :            :     else
     317                 :            :         // If it's not visible, simply delete the given Area
     318         [ #  # ]:          0 :         lcl_ClearArea( *this, *pSh->GetOut(), aPaintArea, SwRect() );
     319         [ +  + ]:        263 :     if( pGrfNd )
     320                 :         60 :         pGrfNd->SetFrameInPaint( sal_False );
     321                 :            : 
     322         [ +  - ]:        263 :     pOut->Pop();
     323 [ +  - ][ +  - ]:        263 :     SfxProgress::LeaveLock();
     324                 :            : }
     325                 :            : 
     326                 :            : /*************************************************************************
     327                 :            : |*
     328                 :            : |*    void lcl_CalcRect( Point & aPt, Size & aDim,
     329                 :            : |*                   sal_uInt16 nMirror )
     330                 :            : |*
     331                 :            : |*    Calculate the position and the size of the graphic in the Frame,
     332                 :            : |*    corresponding to the current graphic attributes
     333                 :            : |*
     334                 :            : |*    Point&  the position in the Frame (also returned)
     335                 :            : |*    Size&   the graphic's size (also returned)
     336                 :            : |*    nMirror the current mirror attribute
     337                 :            : |*
     338                 :            : *************************************************************************/
     339                 :            : 
     340                 :            : 
     341                 :          0 : void lcl_CalcRect( Point& rPt, Size& rDim, sal_uInt16 nMirror )
     342                 :            : {
     343 [ #  # ][ #  # ]:          0 :     if( nMirror == RES_MIRROR_GRAPH_VERT || nMirror == RES_MIRROR_GRAPH_BOTH )
     344                 :            :     {
     345                 :          0 :         rPt.X() += rDim.Width() -1;
     346                 :          0 :         rDim.Width() = -rDim.Width();
     347                 :            :     }
     348                 :            : 
     349 [ #  # ][ #  # ]:          0 :     if( nMirror == RES_MIRROR_GRAPH_HOR || nMirror == RES_MIRROR_GRAPH_BOTH )
     350                 :            :     {
     351                 :          0 :         rPt.Y() += rDim.Height() -1;
     352                 :          0 :         rDim.Height() = -rDim.Height();
     353                 :            :     }
     354                 :          0 : }
     355                 :            : 
     356                 :            : /*************************************************************************
     357                 :            : |*
     358                 :            : |*    void SwNoTxtFrm::GetGrfArea()
     359                 :            : |*
     360                 :            : |*    Calculate the Bitmap's position and the size within the passed rectangle
     361                 :            : |*
     362                 :            : *************************************************************************/
     363                 :            : 
     364                 :          0 : void SwNoTxtFrm::GetGrfArea( SwRect &rRect, SwRect* pOrigRect,
     365                 :            :                              sal_Bool ) const
     366                 :            : {
     367                 :            :     // Currently only used for scaling, cropping and mirroring the contour of graphics!
     368                 :            :     // Everything else is handled by GraphicObject
     369                 :            : 
     370                 :            :     // We put the graphic's visible rectangle into rRect.
     371                 :            :     // pOrigRect contains position and size of the whole graphic.
     372                 :            : 
     373         [ #  # ]:          0 :     const SwAttrSet& rAttrSet = GetNode()->GetSwAttrSet();
     374         [ #  # ]:          0 :     const SwCropGrf& rCrop = rAttrSet.GetCropGrf();
     375         [ #  # ]:          0 :     sal_uInt16 nMirror = rAttrSet.GetMirrorGrf().GetValue();
     376                 :            : 
     377 [ #  # ][ #  # ]:          0 :     if( rAttrSet.GetMirrorGrf().IsGrfToggle() )
     378                 :            :     {
     379 [ #  # ][ #  # ]:          0 :         if( !(FindPageFrm()->GetVirtPageNum() % 2) )
                 [ #  # ]
     380                 :            :         {
     381   [ #  #  #  # ]:          0 :             switch ( nMirror )
     382                 :            :             {
     383                 :          0 :                 case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT; break;
     384                 :          0 :                 case RES_MIRROR_GRAPH_VERT: nMirror = RES_MIRROR_GRAPH_DONT; break;
     385                 :          0 :                 case RES_MIRROR_GRAPH_HOR: nMirror = RES_MIRROR_GRAPH_BOTH; break;
     386                 :          0 :                 default: nMirror = RES_MIRROR_GRAPH_HOR; break;
     387                 :            :             }
     388                 :            :         }
     389                 :            :     }
     390                 :            : 
     391                 :            :     // We read graphic from the Node, if needed.
     392                 :            :     // It may fail, however.
     393                 :            :     long nLeftCrop, nRightCrop, nTopCrop, nBottomCrop;
     394         [ #  # ]:          0 :     Size aOrigSz( ((SwNoTxtNode*)GetNode())->GetTwipSize() );
     395         [ #  # ]:          0 :     if ( !aOrigSz.Width() )
     396                 :            :     {
     397                 :          0 :         aOrigSz.Width() = Prt().Width();
     398                 :          0 :         nLeftCrop  = -rCrop.GetLeft();
     399                 :          0 :         nRightCrop = -rCrop.GetRight();
     400                 :            :     }
     401                 :            :     else
     402                 :            :     {
     403                 :          0 :         nLeftCrop = Max( aOrigSz.Width() -
     404                 :          0 :                             (rCrop.GetRight() + rCrop.GetLeft()), long(1) );
     405                 :          0 :         const double nScale = double(Prt().Width())  / double(nLeftCrop);
     406                 :          0 :         nLeftCrop  = long(nScale * -rCrop.GetLeft() );
     407                 :          0 :         nRightCrop = long(nScale * -rCrop.GetRight() );
     408                 :            :     }
     409                 :            : 
     410                 :            :     // crop values have to be mirrored too
     411 [ #  # ][ #  # ]:          0 :     if( nMirror == RES_MIRROR_GRAPH_VERT || nMirror == RES_MIRROR_GRAPH_BOTH )
     412                 :            :     {
     413                 :          0 :         long nTmpCrop = nLeftCrop;
     414                 :          0 :         nLeftCrop = nRightCrop;
     415                 :          0 :         nRightCrop= nTmpCrop;
     416                 :            :     }
     417                 :            : 
     418         [ #  # ]:          0 :     if( !aOrigSz.Height() )
     419                 :            :     {
     420                 :          0 :         aOrigSz.Height() = Prt().Height();
     421                 :          0 :         nTopCrop   = -rCrop.GetTop();
     422                 :          0 :         nBottomCrop= -rCrop.GetBottom();
     423                 :            :     }
     424                 :            :     else
     425                 :            :     {
     426                 :          0 :         nTopCrop = Max( aOrigSz.Height() - (rCrop.GetTop() + rCrop.GetBottom()), long(1) );
     427                 :          0 :         const double nScale = double(Prt().Height()) / double(nTopCrop);
     428                 :          0 :         nTopCrop   = long(nScale * -rCrop.GetTop() );
     429                 :          0 :         nBottomCrop= long(nScale * -rCrop.GetBottom() );
     430                 :            :     }
     431                 :            : 
     432                 :            :     // crop values have to be mirrored too
     433 [ #  # ][ #  # ]:          0 :     if( nMirror == RES_MIRROR_GRAPH_HOR || nMirror == RES_MIRROR_GRAPH_BOTH )
     434                 :            :     {
     435                 :          0 :         long nTmpCrop = nTopCrop;
     436                 :          0 :         nTopCrop   = nBottomCrop;
     437                 :          0 :         nBottomCrop= nTmpCrop;
     438                 :            :     }
     439                 :            : 
     440                 :          0 :     Size  aVisSz( Prt().SSize() );
     441                 :          0 :     Size  aGrfSz( aVisSz );
     442                 :          0 :     Point aVisPt( Frm().Pos() + Prt().Pos() );
     443                 :          0 :     Point aGrfPt( aVisPt );
     444                 :            : 
     445                 :            :     // Set the "visible" rectangle first
     446         [ #  # ]:          0 :     if ( nLeftCrop > 0 )
     447                 :            :     {
     448                 :          0 :         aVisPt.X()  += nLeftCrop;
     449                 :          0 :         aVisSz.Width() -= nLeftCrop;
     450                 :            :     }
     451         [ #  # ]:          0 :     if ( nTopCrop > 0 )
     452                 :            :     {
     453                 :          0 :         aVisPt.Y()   += nTopCrop;
     454                 :          0 :         aVisSz.Height() -= nTopCrop;
     455                 :            :     }
     456         [ #  # ]:          0 :     if ( nRightCrop > 0 )
     457                 :          0 :         aVisSz.Width() -= nRightCrop;
     458         [ #  # ]:          0 :     if ( nBottomCrop > 0 )
     459                 :          0 :         aVisSz.Height() -= nBottomCrop;
     460                 :            : 
     461                 :          0 :     rRect.Pos  ( aVisPt );
     462                 :          0 :     rRect.SSize( aVisSz );
     463                 :            : 
     464                 :            :     // Calculate the whole graphic if needed
     465         [ #  # ]:          0 :     if ( pOrigRect )
     466                 :            :     {
     467                 :          0 :         Size aTmpSz( aGrfSz );
     468                 :          0 :         aGrfPt.X()    += nLeftCrop;
     469                 :          0 :         aTmpSz.Width() -= nLeftCrop + nRightCrop;
     470                 :          0 :         aGrfPt.Y()      += nTopCrop;
     471                 :          0 :         aTmpSz.Height()-= nTopCrop + nBottomCrop;
     472                 :            : 
     473         [ #  # ]:          0 :         if( RES_MIRROR_GRAPH_DONT != nMirror )
     474                 :          0 :             lcl_CalcRect( aGrfPt, aTmpSz, nMirror );
     475                 :            : 
     476                 :          0 :         pOrigRect->Pos  ( aGrfPt );
     477                 :          0 :         pOrigRect->SSize( aTmpSz );
     478                 :            :     }
     479                 :          0 : }
     480                 :            : 
     481                 :            : /*************************************************************************
     482                 :            : |*
     483                 :            : |*    Size SwNoTxtFrm::GetSize()
     484                 :            : |*
     485                 :            : |*    By returning the surrounding Fly's size which equals the graphic's size
     486                 :            : |*
     487                 :            : *************************************************************************/
     488                 :            : 
     489                 :            : 
     490                 :        497 : const Size& SwNoTxtFrm::GetSize() const
     491                 :            : {
     492                 :            :     // Return the Frame's size
     493                 :        497 :     const SwFrm *pFly = FindFlyFrm();
     494         [ -  + ]:        497 :     if( !pFly )
     495                 :          0 :         pFly = this;
     496                 :        497 :     return pFly->Prt().SSize();
     497                 :            : }
     498                 :            : 
     499                 :            : /*************************************************************************
     500                 :            : |*
     501                 :            : |*    SwNoTxtFrm::MakeAll()
     502                 :            : |*
     503                 :            : *************************************************************************/
     504                 :            : 
     505                 :            : 
     506                 :        963 : void SwNoTxtFrm::MakeAll()
     507                 :            : {
     508         [ +  - ]:        963 :     SwCntntNotify aNotify( this );
     509         [ +  - ]:        963 :     SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
     510         [ +  - ]:        963 :     const SwBorderAttrs &rAttrs = *aAccess.Get();
     511                 :            : 
     512 [ +  + ][ +  - ]:       1926 :     while ( !bValidPos || !bValidSize || !bValidPrtArea )
         [ +  + ][ +  + ]
     513                 :            :     {
     514         [ +  - ]:        963 :         MakePos();
     515                 :            : 
     516         [ +  + ]:        963 :         if ( !bValidSize )
     517                 :        497 :             Frm().Width( GetUpper()->Prt().Width() );
     518                 :            : 
     519         [ +  - ]:        963 :         MakePrtArea( rAttrs );
     520                 :            : 
     521         [ +  + ]:        963 :         if ( !bValidSize )
     522                 :        497 :         {   bValidSize = sal_True;
     523         [ +  - ]:        497 :             Format();
     524                 :            :         }
     525 [ +  - ][ +  - ]:        963 :     }
     526                 :        963 : }
     527                 :            : 
     528                 :            : /*************************************************************************
     529                 :            : |*
     530                 :            : |*    SwNoTxtFrm::Format()
     531                 :            : |*
     532                 :            : |*    Calculate the Bitmap's site, if needed
     533                 :            : |*
     534                 :            : *************************************************************************/
     535                 :            : 
     536                 :            : 
     537                 :        497 : void SwNoTxtFrm::Format( const SwBorderAttrs * )
     538                 :            : {
     539         [ +  - ]:        497 :     const Size aNewSize( GetSize() );
     540                 :            : 
     541                 :            :     // Did the height change?
     542         [ +  - ]:        497 :     SwTwips nChgHght = IsVertical() ?
     543                 :          0 :         (SwTwips)(aNewSize.Width() - Prt().Width()) :
     544         [ -  + ]:        497 :         (SwTwips)(aNewSize.Height() - Prt().Height());
     545         [ +  + ]:        497 :     if( nChgHght > 0)
     546         [ +  - ]:        495 :         Grow( nChgHght );
     547         [ -  + ]:          2 :     else if( nChgHght < 0)
     548         [ #  # ]:          0 :         Shrink( Min(Prt().Height(), -nChgHght) );
     549                 :        497 : }
     550                 :            : 
     551                 :            : /*************************************************************************
     552                 :            : |*
     553                 :            : |*    SwNoTxtFrm::GetCharRect()
     554                 :            : |*
     555                 :            : |*************************************************************************/
     556                 :            : 
     557                 :            : 
     558                 :          0 : sal_Bool SwNoTxtFrm::GetCharRect( SwRect &rRect, const SwPosition& rPos,
     559                 :            :                               SwCrsrMoveState *pCMS ) const
     560                 :            : {
     561 [ #  # ][ #  # ]:          0 :     if ( &rPos.nNode.GetNode() != (SwNode*)GetNode() )
     562                 :          0 :         return sal_False;
     563                 :            : 
     564         [ #  # ]:          0 :     Calc();
     565                 :          0 :     SwRect aFrameRect( Frm() );
     566                 :          0 :     rRect = aFrameRect;
     567                 :          0 :     rRect.Pos( Frm().Pos() + Prt().Pos() );
     568                 :          0 :     rRect.SSize( Prt().SSize() );
     569                 :            : 
     570         [ #  # ]:          0 :     rRect.Justify();
     571                 :            : 
     572                 :            :     // Is the Bitmap in the visible area at all?
     573 [ #  # ][ #  # ]:          0 :     if( !aFrameRect.IsOver( rRect ) )
     574                 :            :     {
     575                 :            :         // If not, then the Cursor is on the Frame
     576                 :          0 :         rRect = aFrameRect;
     577                 :          0 :         rRect.Width( 1 );
     578                 :            :     }
     579                 :            :     else
     580         [ #  # ]:          0 :         rRect._Intersection( aFrameRect );
     581                 :            : 
     582         [ #  # ]:          0 :     if ( pCMS )
     583                 :            :     {
     584         [ #  # ]:          0 :         if ( pCMS->bRealHeight )
     585                 :            :         {
     586                 :          0 :             pCMS->aRealHeight.Y() = rRect.Height();
     587                 :          0 :             pCMS->aRealHeight.X() = 0;
     588                 :            :         }
     589                 :            :     }
     590                 :            : 
     591                 :          0 :     return sal_True;
     592                 :            : }
     593                 :            : 
     594                 :            : 
     595                 :          0 : sal_Bool SwNoTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& ,
     596                 :            :                              SwCrsrMoveState* ) const
     597                 :            : {
     598                 :          0 :     SwCntntNode* pCNd = (SwCntntNode*)GetNode();
     599                 :          0 :     pPos->nNode = *pCNd;
     600         [ #  # ]:          0 :     pPos->nContent.Assign( pCNd, 0 );
     601                 :          0 :     return sal_True;
     602                 :            : }
     603                 :            : 
     604                 :            : #define CLEARCACHE( pNd ) {\
     605                 :            :     (pNd)->GetGrfObj().ReleaseFromCache();\
     606                 :            :     SwFlyFrm* pFly = FindFlyFrm();\
     607                 :            :     if( pFly && pFly->GetFmt()->GetSurround().IsContour() )\
     608                 :            :     {\
     609                 :            :         ClrContourCache( pFly->GetVirtDrawObj() );\
     610                 :            :         pFly->NotifyBackground( FindPageFrm(), Prt(), PREP_FLY_ATTR_CHG );\
     611                 :            :     }\
     612                 :            : }
     613                 :            : 
     614                 :         52 : void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
     615                 :            : {
     616 [ +  - ][ #  # ]:         52 :     sal_uInt16 nWhich = pNew ? pNew->Which() : pOld ? pOld->Which() : 0;
     617                 :            : 
     618                 :            :     // #i73788#
     619                 :            :     // no <SwCntntFrm::Modify(..)> for RES_LINKED_GRAPHIC_STREAM_ARRIVED
     620 [ +  - ][ +  + ]:         52 :     if ( RES_GRAPHIC_PIECE_ARRIVED != nWhich &&
         [ +  + ][ +  - ]
     621                 :            :          RES_GRAPHIC_ARRIVED != nWhich &&
     622                 :            :          RES_GRF_REREAD_AND_INCACHE != nWhich &&
     623                 :            :          RES_LINKED_GRAPHIC_STREAM_ARRIVED != nWhich )
     624                 :            :     {
     625                 :         36 :         SwCntntFrm::Modify( pOld, pNew );
     626                 :            :     }
     627                 :            : 
     628                 :         52 :     sal_Bool bComplete = sal_True;
     629                 :            : 
     630   [ -  +  +  +  :         52 :     switch( nWhich )
                   +  - ]
     631                 :            :     {
     632                 :            :     case RES_OBJECTDYING:
     633                 :          0 :         break;
     634                 :            : 
     635                 :            :     case RES_GRF_REREAD_AND_INCACHE:
     636         [ +  - ]:          4 :         if( ND_GRFNODE == GetNode()->GetNodeType() )
     637                 :            :         {
     638                 :          4 :             bComplete = sal_False;
     639                 :          4 :             SwGrfNode* pNd = (SwGrfNode*) GetNode();
     640                 :            : 
     641                 :          4 :             ViewShell *pVSh = 0;
     642         [ +  - ]:          4 :             pNd->GetDoc()->GetEditShell( &pVSh );
     643         [ +  - ]:          4 :             if( pVSh )
     644                 :            :             {
     645         [ +  - ]:          4 :                 GraphicAttr aAttr;
     646         [ -  + ]:          8 :                 if( pNd->GetGrfObj().IsCached( pVSh->GetOut(), Point(),
     647 [ +  - ][ +  - ]:          8 :                             Prt().SSize(), &pNd->GetGraphicAttr( aAttr, this ) ))
     648                 :            :                 {
     649                 :          0 :                     ViewShell *pSh = pVSh;
     650         [ #  # ]:          0 :                     do {
     651         [ #  # ]:          0 :                         SET_CURR_SHELL( pSh );
     652         [ #  # ]:          0 :                         if( pSh->GetWin() )
     653                 :            :                         {
     654         [ #  # ]:          0 :                             if( pSh->IsPreView() )
     655 [ #  # ][ #  # ]:          0 :                                 ::RepaintPagePreview( pSh, Frm().SVRect() );
                 [ #  # ]
     656                 :            :                             else
     657 [ #  # ][ #  # ]:          0 :                                 pSh->GetWin()->Invalidate( Frm().SVRect() );
     658         [ #  # ]:          0 :                         }
     659                 :          0 :                     } while( pVSh != (pSh = (ViewShell*)pSh->GetNext() ));
     660                 :            :                 }
     661                 :            :                 else
     662 [ +  - ][ +  - ]:          4 :                     pNd->SwapIn();
     663                 :            :             }
     664                 :            :         }
     665                 :          4 :         break;
     666                 :            : 
     667                 :            :     case RES_UPDATE_ATTR:
     668                 :            :     case RES_FMT_CHG:
     669 [ +  - ][ -  + ]:          8 :         CLEARCACHE( (SwGrfNode*) GetNode() )
                 [ -  + ]
     670                 :          8 :         break;
     671                 :            : 
     672                 :            :     case RES_ATTRSET_CHG:
     673                 :            :         {
     674                 :            :             sal_uInt16 n;
     675         [ +  - ]:        156 :             for( n = RES_GRFATR_BEGIN; n < RES_GRFATR_END; ++n )
     676         [ +  + ]:        312 :                 if( SFX_ITEM_SET == ((SwAttrSetChg*)pOld)->GetChgSet()->
     677                 :        156 :                                 GetItemState( n, sal_False ))
     678                 :            :                 {
     679 [ +  - ][ +  - ]:         28 :                     CLEARCACHE( (SwGrfNode*) GetNode() )
                 [ +  - ]
     680                 :         28 :                     break;
     681                 :            :                 }
     682         [ -  + ]:         28 :             if( RES_GRFATR_END == n )           // not found
     683                 :          0 :                 return ;
     684                 :            :         }
     685                 :         28 :         break;
     686                 :            : 
     687                 :            :     case RES_GRAPHIC_PIECE_ARRIVED:
     688                 :            :     case RES_GRAPHIC_ARRIVED:
     689                 :            :     // i73788# - handle RES_LINKED_GRAPHIC_STREAM_ARRIVED as RES_GRAPHIC_ARRIVED
     690                 :            :     case RES_LINKED_GRAPHIC_STREAM_ARRIVED:
     691         [ +  - ]:         12 :         if ( GetNode()->GetNodeType() == ND_GRFNODE )
     692                 :            :         {
     693                 :         12 :             bComplete = sal_False;
     694                 :         12 :             SwGrfNode* pNd = (SwGrfNode*) GetNode();
     695                 :            : 
     696 [ +  - ][ +  - ]:         12 :             CLEARCACHE( pNd )
         [ +  - ][ +  - ]
         [ +  + ][ +  + ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     697                 :            : 
     698                 :         12 :             SwRect aRect( Frm() );
     699                 :            : 
     700                 :         12 :             ViewShell *pVSh = 0;
     701         [ +  - ]:         12 :             pNd->GetDoc()->GetEditShell( &pVSh );
     702         [ +  - ]:         12 :             if( !pVSh )
     703                 :            :                 break;
     704                 :            : 
     705                 :         12 :             ViewShell *pSh = pVSh;
     706         [ -  + ]:         12 :             do {
     707         [ +  - ]:         12 :                 SET_CURR_SHELL( pSh );
     708         [ -  + ]:         12 :                 if( pSh->IsPreView() )
     709                 :            :                 {
     710         [ #  # ]:          0 :                     if( pSh->GetWin() )
     711         [ #  # ]:          0 :                         ::RepaintPagePreview( pSh, aRect );
     712                 :            :                 }
     713         [ +  - ]:         20 :                 else if ( pSh->VisArea().IsOver( aRect ) &&
           [ +  +  +  - ]
                 [ +  + ]
     714                 :          8 :                    OUTDEV_WINDOW == pSh->GetOut()->GetOutDevType() )
     715                 :            :                 {
     716                 :            :                     // invalidate instead of painting
     717 [ +  - ][ +  - ]:          8 :                     pSh->GetWin()->Invalidate( aRect.SVRect() );
     718                 :            :                 }
     719                 :            : 
     720         [ +  - ]:         12 :                 pSh = (ViewShell *)pSh->GetNext();
     721                 :            :             } while( pSh != pVSh );
     722                 :            :         }
     723                 :         12 :         break;
     724                 :            : 
     725                 :            :     default:
     726 [ #  # ][ #  # ]:          0 :         if ( !pNew || !isGRFATR(nWhich) )
                 [ #  # ]
     727                 :          0 :             return;
     728                 :            :     }
     729                 :            : 
     730         [ +  + ]:         52 :     if( bComplete )
     731                 :            :     {
     732                 :         36 :         InvalidatePrt();
     733                 :         52 :         SetCompletePaint();
     734                 :            :     }
     735                 :            : }
     736                 :            : 
     737                 :         29 : void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, OutputDevice* pOut )
     738                 :            : {
     739                 :            : 
     740         [ +  - ]:         29 :     if(!pOut)
     741                 :         29 :         return;
     742 [ +  - ][ +  - ]:         29 :     Rectangle aPxRect = pOut->LogicToPixel( rInArea.SVRect() );
     743                 :         29 :     Rectangle aNewPxRect( aPxRect );
     744         [ -  + ]:         29 :     while( aNewPxRect.Left() < aPxRect.Left() )
     745                 :            :     {
     746                 :          0 :         rAlignedGrfArea.Left( rAlignedGrfArea.Left()+1 );
     747 [ #  # ][ #  # ]:          0 :         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
     748                 :            :     }
     749         [ -  + ]:         29 :     while( aNewPxRect.Top() < aPxRect.Top() )
     750                 :            :     {
     751                 :          0 :         rAlignedGrfArea.Top( rAlignedGrfArea.Top()+1 );
     752 [ #  # ][ #  # ]:          0 :         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
     753                 :            :     }
     754         [ -  + ]:         29 :     while( aNewPxRect.Bottom() > aPxRect.Bottom() )
     755                 :            :     {
     756                 :          0 :         rAlignedGrfArea.Bottom( rAlignedGrfArea.Bottom()-1 );
     757 [ #  # ][ #  # ]:          0 :         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
     758                 :            :     }
     759         [ -  + ]:         29 :     while( aNewPxRect.Right() > aPxRect.Right() )
     760                 :            :     {
     761                 :          0 :         rAlignedGrfArea.Right( rAlignedGrfArea.Right()-1 );
     762 [ #  # ][ #  # ]:          0 :         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
     763                 :            :     }
     764                 :            : }
     765                 :            : 
     766                 :            : // Paint the graphic.
     767                 :            : // We require either a QuickDraw-Bitmap or a graphic here. If we do not have
     768                 :            : // either, we return a replacement.
     769                 :            : // delete unused 3rd parameter.
     770                 :            : // use aligned rectangle for drawing graphic.
     771                 :            : // pixel-align coordinations for drawing graphic.
     772                 :        263 : void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) const
     773                 :            : {
     774                 :        263 :     ViewShell* pShell = getRootFrm()->GetCurrShell();
     775                 :            : 
     776                 :        263 :     SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode();
     777                 :        263 :     SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
     778                 :        263 :     SwOLENode* pOLENd = rNoTNd.GetOLENode();
     779                 :            : 
     780 [ +  - ][ +  - ]:        263 :     const sal_Bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) ||
     781 [ +  - ][ -  + ]:        263 :                           pOut->GetConnectMetaFile();
     782                 :            : 
     783 [ +  + ][ +  - ]:        263 :     const bool bIsChart = pOLENd && ChartPrettyPainter::IsChart( pOLENd->GetOLEObj().GetObject() );
         [ +  - ][ +  + ]
     784                 :            : 
     785                 :            :     // calculate aligned rectangle from parameter <rGrfArea>.
     786                 :            :     //     Use aligned rectangle <aAlignedGrfArea> instead of <rGrfArea> in
     787                 :            :     //     the following code.
     788                 :        263 :     SwRect aAlignedGrfArea = rGrfArea;
     789         [ +  - ]:        263 :     ::SwAlignRect( aAlignedGrfArea,  pShell );
     790                 :            : 
     791         [ +  + ]:        263 :     if( !bIsChart )
     792                 :            :     {
     793                 :            :         // Because for drawing a graphic left-top-corner and size coordinations are
     794                 :            :         // used, these coordinations have to be determined on pixel level.
     795         [ +  - ]:        234 :         ::SwAlignGrfRect( &aAlignedGrfArea, *pOut );
     796                 :            :     }
     797                 :            :     else //if( bIsChart )
     798                 :            :     {
     799                 :            :         // #i78025# charts own borders are not completely visible
     800                 :            :         // the above pixel correction is not correct - at least not for charts
     801                 :            :         // so a different pixel correction is chosen here
     802                 :            :         // this might be a good idea for all other OLE objects also,
     803                 :            :         // but as I cannot oversee the consequences I fix it only for charts for now
     804         [ +  - ]:         29 :         lcl_correctlyAlignRect( aAlignedGrfArea, rGrfArea, pOut );
     805                 :            :     }
     806                 :            : 
     807         [ +  + ]:        263 :     if( pGrfNd )
     808                 :            :     {
     809                 :            :         // Fix for bug fdo#33781
     810                 :         60 :         const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
     811 [ -  + ][ +  - ]:         60 :         if (pShell->Imp()->GetDrawView()->IsAntiAliasing())
     812                 :            :         {
     813         [ #  # ]:          0 :             pOut->SetAntialiasing( nFormerAntialiasingAtOutput | ANTIALIASING_ENABLE_B2DDRAW );
     814                 :            :         }
     815                 :            : 
     816                 :         60 :         sal_Bool bForceSwap = sal_False, bContinue = sal_True;
     817                 :         60 :         GraphicObject& rGrfObj = pGrfNd->GetGrfObj();
     818                 :            : 
     819         [ +  - ]:         60 :         GraphicAttr aGrfAttr;
     820         [ +  - ]:         60 :         pGrfNd->GetGraphicAttr( aGrfAttr, this );
     821                 :            : 
     822         [ +  - ]:         60 :         if( !bPrn )
     823                 :            :         {
     824                 :            :             // #i73788#
     825 [ +  - ][ -  + ]:         60 :             if ( pGrfNd->IsLinkedInputStreamReady() )
     826                 :            :             {
     827         [ #  # ]:          0 :                 pGrfNd->UpdateLinkWithInputStream();
     828                 :            :             }
     829                 :            :             // #i85717#, #i90395# - check, if asynchronous retrieval
     830                 :            :             // if input stream for the graphic is possible
     831   [ +  -  +  +  :        211 :             else if ( ( rGrfObj.GetType() == GRAPHIC_DEFAULT ||
           +  + ][ +  - ]
                 [ +  + ]
     832                 :         60 :                         rGrfObj.GetType() == GRAPHIC_NONE ) &&
     833                 :         57 :                       pGrfNd->IsLinkedFile() &&
     834         [ +  - ]:         34 :                       pGrfNd->IsAsyncRetrieveInputStreamPossible() )
     835                 :            :             {
     836                 :         34 :                 Size aTmpSz;
     837 [ +  - ][ +  - ]:         34 :                 ::sfx2::SvLinkSource* pGrfObj = pGrfNd->GetLink()->GetObj();
     838 [ +  - ][ -  +  :         68 :                 if( !pGrfObj ||
          #  #  #  #  #  
              # ][ +  - ]
     839         [ +  - ]:         34 :                     !pGrfObj->IsDataComplete() ||
     840         [ #  # ]:          0 :                     !(aTmpSz = pGrfNd->GetTwipSize()).Width() ||
     841                 :          0 :                     !aTmpSz.Height() || !pGrfNd->GetAutoFmtLvl() )
     842                 :            :                 {
     843         [ +  - ]:         34 :                     pGrfNd->TriggerAsyncRetrieveInputStream(); // #i73788#
     844                 :            :                 }
     845         [ +  - ]:         34 :                 String aTxt( pGrfNd->GetTitle() );
     846         [ +  - ]:         34 :                 if ( !aTxt.Len() )
     847         [ +  - ]:         34 :                     GetRealURL( *pGrfNd, aTxt );
     848         [ +  - ]:         34 :                 ::lcl_PaintReplacement( aAlignedGrfArea, aTxt, *pShell, this, sal_False );
     849         [ +  - ]:         34 :                 bContinue = sal_False;
     850                 :            :             }
     851         [ -  + ]:         52 :             else if( rGrfObj.IsCached( pOut, aAlignedGrfArea.Pos(),
     852         [ +  - ]:         52 :                                     aAlignedGrfArea.SSize(), &aGrfAttr ))
     853                 :            :             {
     854                 :            :                 rGrfObj.DrawWithPDFHandling( *pOut,
     855                 :          0 :                                              aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(),
     856         [ #  # ]:          0 :                                              &aGrfAttr );
     857                 :          0 :                 bContinue = sal_False;
     858                 :            :             }
     859                 :            :         }
     860                 :            : 
     861         [ +  + ]:         60 :         if( bContinue )
     862                 :            :         {
     863         [ +  - ]:         26 :             const sal_Bool bSwapped = rGrfObj.IsSwappedOut();
     864         [ +  - ]:         26 :             const sal_Bool bSwappedIn = 0 != pGrfNd->SwapIn( bPrn );
     865 [ +  - ][ +  - ]:         26 :             if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic())
         [ +  - ][ +  + ]
                 [ +  + ]
     866                 :            :             {
     867                 :          3 :                 const sal_Bool bAnimate = rGrfObj.IsAnimated() &&
     868                 :          0 :                                          !pShell->IsPreView() &&
     869                 :          0 :                                          !pShell->GetAccessibilityOptions()->IsStopAnimatedGraphics() &&
     870                 :            :                 // #i9684# Stop animation during printing/pdf export
     871 [ #  # ][ -  +  :          3 :                                           pShell->GetWin();
             #  #  #  # ]
     872                 :            : 
     873 [ -  + ][ #  # ]:          3 :                 if( bAnimate &&
                 [ -  + ]
     874 [ #  # ][ #  # ]:          0 :                     FindFlyFrm() != ::GetFlyFromMarked( 0, pShell ))
     875                 :            :                 {
     876                 :            :                     OutputDevice* pVout;
     877 [ #  # ][ #  # ]:          0 :                     if( pOut == pShell->GetOut() && SwRootFrm::FlushVout() )
         [ #  # ][ #  # ]
     878                 :          0 :                         pVout = pOut, pOut = pShell->GetOut();
     879   [ #  #  #  # ]:          0 :                     else if( pShell->GetWin() &&
                 [ #  # ]
     880                 :          0 :                              OUTDEV_VIRDEV == pOut->GetOutDevType() )
     881                 :          0 :                         pVout = pOut, pOut = pShell->GetWin();
     882                 :            :                     else
     883                 :          0 :                         pVout = 0;
     884                 :            : 
     885                 :            :                     OSL_ENSURE( OUTDEV_VIRDEV != pOut->GetOutDevType() ||
     886                 :            :                             pShell->GetViewOptions()->IsPDFExport(),
     887                 :            :                             "pOut should not be a virtual device" );
     888                 :            : 
     889                 :          0 :                     rGrfObj.StartAnimation( pOut, aAlignedGrfArea.Pos(),
     890                 :          0 :                                         aAlignedGrfArea.SSize(), long(this),
     891         [ #  # ]:          0 :                                         0, GRFMGR_DRAW_STANDARD, pVout );
     892                 :            :                 }
     893                 :            :                 else
     894                 :            :                     rGrfObj.DrawWithPDFHandling( *pOut,
     895                 :          3 :                                                  aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(),
     896         [ +  - ]:          3 :                                                  &aGrfAttr );
     897                 :            :             }
     898                 :            :             else
     899                 :            :             {
     900                 :         23 :                 sal_uInt16 nResId = 0;
     901         [ +  - ]:         23 :                 if( bSwappedIn )
     902                 :            :                 {
     903         [ +  - ]:         23 :                     if( GRAPHIC_NONE == rGrfObj.GetType() )
     904                 :         23 :                         nResId = STR_COMCORE_READERROR;
     905 [ #  # ][ #  # ]:          0 :                     else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
                 [ #  # ]
     906                 :          0 :                         nResId = STR_COMCORE_CANT_SHOW;
     907                 :            :                 }
     908                 :         23 :                 ((SwNoTxtFrm*)this)->nWeight = -1;
     909         [ +  - ]:         23 :                 String aText;
     910   [ -  +  #  # ]:         46 :                 if ( !nResId &&
           [ #  #  #  # ]
                 [ -  + ]
     911 [ #  # ][ #  # ]:         23 :                      !(aText = pGrfNd->GetTitle()).Len() &&
         [ -  + ][ #  # ]
                 [ #  # ]
     912         [ #  # ]:          0 :                      (!GetRealURL( *pGrfNd, aText ) || !aText.Len()))
     913                 :            :                 {
     914                 :          0 :                     nResId = STR_COMCORE_READERROR;
     915                 :            :                 }
     916         [ +  - ]:         23 :                 if ( nResId )
     917 [ +  - ][ +  - ]:         23 :                     aText = SW_RESSTR( nResId );
     918                 :            : 
     919 [ +  - ][ +  - ]:         23 :                 ::lcl_PaintReplacement( aAlignedGrfArea, aText, *pShell, this, sal_True );
     920                 :            :             }
     921                 :            : 
     922                 :            :             // When printing, we must not collect the graphics
     923 [ -  + ][ #  # ]:         26 :             if( bSwapped && bPrn )
     924                 :          0 :                 bForceSwap = sal_True;
     925                 :            :         }
     926                 :            : 
     927         [ -  + ]:         60 :         if( bForceSwap )
     928         [ #  # ]:          0 :             pGrfNd->SwapOut();
     929                 :            : 
     930 [ +  - ][ -  + ]:         60 :         if ( pShell->Imp()->GetDrawView()->IsAntiAliasing() )
     931 [ #  # ][ +  - ]:         60 :             pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
     932                 :            :     }
     933 [ +  + ][ -  + ]:        435 :     else if( bIsChart
         [ #  # ][ #  # ]
                 [ +  - ]
     934                 :            :         // Charts must be painted resolution dependent!! #i82893#, #i75867#
     935         [ +  - ]:         29 :         && ChartPrettyPainter::ShouldPrettyPaintChartOnThisDevice( pOut )
     936 [ #  # ][ #  # ]:        203 :         && svt::EmbeddedObjectRef::TryRunningState( pOLENd->GetOLEObj().GetOleRef() )
         [ -  + ][ #  # ]
     937                 :            :         && ChartPrettyPainter::DoPrettyPaintChart( uno::Reference< frame::XModel >(
     938 [ #  # ][ #  # ]:        203 :             pOLENd->GetOLEObj().GetOleRef()->getComponent(), uno::UNO_QUERY), pOut, aAlignedGrfArea.SVRect() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ -  + ][ -  + ]
         [ -  + ][ -  + ]
           [ #  #  #  #  
             #  #  #  # ]
     939                 :            :     {
     940                 :            :         (void)(0);// all was done in if statement
     941                 :            :     }
     942         [ +  - ]:        203 :     else if( pOLENd )
     943                 :            :     {
     944                 :            :         // Fix for bug fdo#33781
     945                 :        203 :         const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
     946 [ -  + ][ +  - ]:        203 :         if (pShell->Imp()->GetDrawView()->IsAntiAliasing())
     947                 :            :         {
     948                 :          0 :             sal_uInt16 nNewAntialiasingAtOutput = nFormerAntialiasingAtOutput | ANTIALIASING_ENABLE_B2DDRAW;
     949                 :            : 
     950                 :            :             // #i99665#
     951                 :            :             // Adjust AntiAliasing mode at output device for chart OLE
     952 [ #  # ][ #  # ]:          0 :             if ( pOLENd->IsChart() )
     953                 :          0 :                 nNewAntialiasingAtOutput |= ANTIALIASING_PIXELSNAPHAIRLINE;
     954                 :            : 
     955         [ #  # ]:          0 :             pOut->SetAntialiasing( nNewAntialiasingAtOutput );
     956                 :            :         }
     957                 :            : 
     958                 :        203 :         Point aPosition(aAlignedGrfArea.Pos());
     959                 :        203 :         Size aSize(aAlignedGrfArea.SSize());
     960                 :            : 
     961                 :            :         // We do not have a printer in the BrowseMode and thus no JobSetup, so we create one ...
     962 [ +  - ][ +  - ]:        203 :         const JobSetup* pJobSetup = pOLENd->getIDocumentDeviceAccess()->getJobsetup();
     963                 :        203 :         sal_Bool bDummyJobSetup = 0 == pJobSetup;
     964         [ +  - ]:        203 :         if( bDummyJobSetup )
     965 [ +  - ][ +  - ]:        203 :             pJobSetup = new JobSetup();
     966                 :            : 
     967                 :            :         // #i42323#
     968                 :            :         //TODO/LATER: is it a problem that the JopSetup isn't used?
     969                 :            :         //xRef->DoDraw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), *pJobSetup );
     970                 :            : 
     971         [ +  - ]:        203 :         Graphic* pGraphic = pOLENd->GetGraphic();
     972                 :            : 
     973 [ +  - ][ +  - ]:        203 :         if ( pGraphic && pGraphic->GetType() != GRAPHIC_NONE )
         [ +  - ][ +  - ]
     974                 :            :         {
     975         [ +  - ]:        203 :             pGraphic->Draw( pOut, aPosition, aSize );
     976                 :            : 
     977                 :            :             // shade the representation if the object is activated outplace
     978         [ +  - ]:        203 :             uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef();
     979 [ +  - ][ +  - ]:        203 :             if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::ACTIVE )
         [ +  - ][ -  + ]
                 [ -  + ]
     980                 :            :             {
     981 [ #  # ][ #  # ]:          0 :                 ::svt::EmbeddedObjectRef::DrawShading( Rectangle( aPosition, aSize ), pOut );
     982                 :        203 :             }
     983                 :            :         }
     984                 :            :         else
     985 [ #  # ][ #  # ]:          0 :             ::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut );
     986                 :            : 
     987         [ +  - ]:        203 :         if( bDummyJobSetup )
     988 [ +  - ][ +  - ]:        203 :             delete pJobSetup;  // ... and clean it up again
     989                 :            : 
     990 [ +  - ][ +  - ]:        203 :         sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
         [ +  - ][ +  - ]
     991 [ +  - ][ +  - ]:        203 :         if ( !bPrn && pShell->ISA( SwCrsrShell ) &&
         [ +  - ][ -  + ]
         [ -  + ][ +  - ]
     992                 :            :                 nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
     993                 :            :         {
     994         [ #  # ]:          0 :             const SwFlyFrm *pFly = FindFlyFrm();
     995                 :            :             OSL_ENSURE( pFly, "OLE not in FlyFrm" );
     996 [ #  # ][ #  # ]:          0 :             ((SwFEShell*)pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm());
     997                 :            :         }
     998                 :            : 
     999 [ +  - ][ -  + ]:        203 :         if ( pShell->Imp()->GetDrawView()->IsAntiAliasing() )
    1000         [ #  # ]:        203 :             pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
    1001                 :            :     }
    1002                 :        263 : }
    1003                 :            : 
    1004                 :            : 
    1005                 :        692 : sal_Bool SwNoTxtFrm::IsTransparent() const
    1006                 :            : {
    1007                 :        692 :     const ViewShell* pSh = getRootFrm()->GetCurrShell();
    1008 [ -  + ][ -  + ]:        692 :     if ( !pSh || !pSh->GetViewOptions()->IsGraphic() )
                 [ +  - ]
    1009                 :          0 :         return sal_True;
    1010                 :            : 
    1011                 :            :     const SwGrfNode *pNd;
    1012         [ +  + ]:        692 :     if( 0 != (pNd = GetNode()->GetGrfNode()) )
    1013                 :        423 :         return pNd->IsTransparent();
    1014                 :            : 
    1015                 :            :     //#29381# OLE are always transparent
    1016                 :        692 :     return sal_True;
    1017                 :            : }
    1018                 :            : 
    1019                 :            : 
    1020                 :        397 : void SwNoTxtFrm::StopAnimation( OutputDevice* pOut ) const
    1021                 :            : {
    1022                 :            :     // Stop animated graphics
    1023                 :        397 :     SwGrfNode* pGrfNd = (SwGrfNode*)GetNode()->GetGrfNode();
    1024 [ -  + ][ -  + ]:        397 :     if( pGrfNd && pGrfNd->IsAnimated() )
                 [ +  + ]
    1025                 :          0 :         pGrfNd->GetGrfObj().StopAnimation( pOut, long(this) );
    1026                 :        397 : }
    1027                 :            : 
    1028                 :            : 
    1029                 :        916 : sal_Bool SwNoTxtFrm::HasAnimation() const
    1030                 :            : {
    1031                 :        916 :     const SwGrfNode* pGrfNd = GetNode()->GetGrfNode();
    1032 [ -  + ][ +  + ]:        916 :     return pGrfNd && pGrfNd->IsAnimated();
    1033                 :            : }
    1034                 :            : 
    1035                 :            : 
    1036                 :            : 
    1037                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10