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

Generated by: LCOV version 1.10