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

Generated by: LCOV version 1.10