LCOV - code coverage report
Current view: top level - vcl/source/gdi - graph.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 241 305 79.0 %
Date: 2012-08-25 Functions: 53 72 73.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 143 296 48.3 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <vcl/outdev.hxx>
      31                 :            : #include <vcl/svapp.hxx>
      32                 :            : #include <vcl/graph.hxx>
      33                 :            : 
      34                 :            : #include <impgraph.hxx>
      35                 :            : 
      36                 :            : #include <comphelper/processfactory.hxx>
      37                 :            : 
      38                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      39                 :            : #include <com/sun/star/graphic/GraphicProvider.hpp>
      40                 :            : #include <com/sun/star/graphic/XGraphicProvider.hpp>
      41                 :            : #include <com/sun/star/lang/XUnoTunnel.hpp>
      42                 :            : #include <com/sun/star/lang/XTypeProvider.hpp>
      43                 :            : #include <com/sun/star/graphic/XGraphic.hpp>
      44                 :            : #include <cppuhelper/typeprovider.hxx>
      45                 :            : #include <rtl/instance.hxx>
      46                 :            : 
      47                 :            : using namespace ::com::sun::star;
      48                 :            : 
      49                 :            : // -----------------------
      50                 :            : // - Default-Drawmethode -
      51                 :            : // -----------------------
      52                 :            : 
      53                 :         57 : static void ImplDrawDefault( OutputDevice* pOutDev, const UniString* pText,
      54                 :            :                              Font* pFont, const Bitmap* pBitmap, const BitmapEx* pBitmapEx,
      55                 :            :                              const Point& rDestPt, const Size& rDestSize )
      56                 :            : {
      57         [ +  - ]:         57 :     sal_uInt16      nPixel = (sal_uInt16) pOutDev->PixelToLogic( Size( 1, 1 ) ).Width();
      58                 :         57 :     sal_uInt16      nPixelWidth = nPixel;
      59                 :         57 :     Point       aPoint( rDestPt.X() + nPixelWidth, rDestPt.Y() + nPixelWidth );
      60                 :         57 :     Size        aSize( rDestSize.Width() - ( nPixelWidth << 1 ), rDestSize.Height() - ( nPixelWidth << 1 ) );
      61 [ -  + ][ #  # ]:         57 :     sal_Bool        bFilled = ( pBitmap != NULL || pBitmapEx != NULL || pFont != NULL );
                 [ +  - ]
      62         [ +  - ]:         57 :     Rectangle   aBorderRect( aPoint, aSize );
      63                 :            : 
      64         [ +  - ]:         57 :     pOutDev->Push();
      65                 :            : 
      66         [ +  - ]:         57 :     pOutDev->SetFillColor();
      67                 :            : 
      68                 :            :     // Auf dem Drucker ein schwarzes Rechteck und auf dem Bildschirm eins mit 3D-Effekt
      69         [ -  + ]:         57 :     if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
      70         [ #  # ]:          0 :         pOutDev->SetLineColor( COL_BLACK );
      71                 :            :     else
      72                 :            :     {
      73                 :         57 :         aBorderRect.Left() += nPixel;
      74                 :         57 :         aBorderRect.Top() += nPixel;
      75                 :            : 
      76         [ +  - ]:         57 :         pOutDev->SetLineColor( COL_LIGHTGRAY );
      77         [ +  - ]:         57 :         pOutDev->DrawRect( aBorderRect );
      78                 :            : 
      79                 :         57 :         aBorderRect.Left() -= nPixel;
      80                 :         57 :         aBorderRect.Top() -= nPixel;
      81                 :         57 :         aBorderRect.Right() -= nPixel;
      82                 :         57 :         aBorderRect.Bottom() -= nPixel;
      83         [ +  - ]:         57 :         pOutDev->SetLineColor( COL_GRAY );
      84                 :            :     }
      85                 :            : 
      86         [ +  - ]:         57 :     pOutDev->DrawRect( aBorderRect );
      87                 :            : 
      88                 :         57 :     aPoint.X() += nPixelWidth + 2*nPixel;
      89                 :         57 :     aPoint.Y() += nPixelWidth + 2*nPixel;
      90                 :         57 :     aSize.Width() -= 2*nPixelWidth + 4*nPixel;
      91                 :         57 :     aSize.Height() -= 2*nPixelWidth + 4*nPixel;
      92                 :            : 
      93         [ +  - ]:        110 :     if( aSize.Width() > 0 && aSize.Height() > 0
           [ -  +  #  # ]
           [ +  -  +  - ]
         [ +  + ][ +  + ]
      94                 :         53 :         && (  ( pBitmap && !!*pBitmap ) || ( pBitmapEx && !!*pBitmapEx ) ) )
      95                 :            :     {
      96 [ -  + ][ #  # ]:         53 :         Size aBitmapSize( pOutDev->PixelToLogic( pBitmap ? pBitmap->GetSizePixel() : pBitmapEx->GetSizePixel() ) );
                 [ +  - ]
      97                 :            : 
      98 [ +  + ][ +  - ]:         53 :         if( aSize.Height() > aBitmapSize.Height() && aSize.Width() > aBitmapSize.Width() )
                 [ +  + ]
      99                 :            :         {
     100         [ -  + ]:         31 :             if ( pBitmap )
     101         [ #  # ]:          0 :                 pOutDev->DrawBitmap( aPoint, *pBitmap );
     102                 :            :             else
     103         [ +  - ]:         31 :                 pOutDev->DrawBitmapEx( aPoint, *pBitmapEx );
     104                 :         31 :             aPoint.X() += aBitmapSize.Width() + 2*nPixel;
     105                 :         53 :             aSize.Width() -= aBitmapSize.Width() + 2*nPixel;
     106                 :            :         }
     107                 :            :     }
     108                 :            : 
     109 [ +  + ][ +  - ]:        110 :     if ( aSize.Width() > 0 && aSize.Height() > 0 && pFont && pText && pText->Len()
         [ +  - ][ +  - ]
           [ +  -  +  - ]
                 [ +  + ]
     110                 :         53 :          && !(!pOutDev->IsOutputEnabled() /*&& pOutDev->GetConnectMetaFile() */) )
     111                 :            :     {
     112         [ +  - ]:         53 :         MapMode aMapMode( MAP_POINT );
     113         [ +  - ]:         53 :         Size    aSz = pOutDev->LogicToLogic( Size( 0, 12 ), &aMapMode, NULL );
     114                 :         53 :         long    nThreshold = aSz.Height() / 2;
     115                 :         53 :         long    nStep = nThreshold / 3;
     116                 :            : 
     117         [ -  + ]:         53 :         if ( !nStep )
     118                 :          0 :             nStep = aSz.Height() - nThreshold;
     119                 :            : 
     120                 :         66 :         for(;; aSz.Height() -= nStep )
     121                 :            :         {
     122         [ +  - ]:        119 :             pFont->SetSize( aSz );
     123         [ +  - ]:        119 :             pOutDev->SetFont( *pFont );
     124                 :            : 
     125         [ +  - ]:        119 :             long nTextHeight = pOutDev->GetTextHeight();
     126         [ +  - ]:        119 :             long nTextWidth = pOutDev->GetTextWidth( *pText );
     127         [ +  - ]:        119 :             if ( nTextHeight )
     128                 :            :             {
     129                 :            :                 // Die N"aherung ber"ucksichtigt keine Ungenauigkeiten durch
     130                 :            :                 // Wortumbr"uche
     131                 :        119 :                 long nLines = aSize.Height() / nTextHeight;
     132                 :        119 :                 long nWidth = aSize.Width() * nLines; // N"aherung!!!
     133                 :            : 
     134 [ +  + ][ +  + ]:        119 :                 if ( nTextWidth <= nWidth || aSz.Height() <= nThreshold )
                 [ +  + ]
     135                 :            :                 {
     136                 :         53 :                     sal_uInt16 nStart = 0;
     137                 :         53 :                     sal_uInt16 nLen = 0;
     138                 :            : 
     139 [ +  - ][ -  + ]:         53 :                     while( nStart < pText->Len() && pText->GetChar( nStart ) == ' ' )
                 [ -  + ]
     140                 :          0 :                         nStart++;
     141 [ +  + ][ +  - ]:       2857 :                     while( nStart+nLen < pText->Len() && pText->GetChar( nStart+nLen ) != ' ' )
                 [ +  + ]
     142                 :       2804 :                         nLen++;
     143 [ +  + ][ +  - ]:        106 :                     while( nStart < pText->Len() && nLines-- )
                 [ +  + ]
     144                 :            :                     {
     145                 :         53 :                         sal_uInt16 nNext = nLen;
     146         [ #  # ]:          0 :                         do
     147                 :            :                         {
     148 [ -  + ][ #  # ]:         53 :                             while ( nStart+nNext < pText->Len() && pText->GetChar( nStart+nNext ) == ' ' )
                 [ -  + ]
     149                 :          0 :                                 nNext++;
     150 [ -  + ][ #  # ]:         53 :                             while ( nStart+nNext < pText->Len() && pText->GetChar( nStart+nNext ) != ' ' )
                 [ -  + ]
     151                 :          0 :                                 nNext++;
     152         [ +  - ]:         53 :                             nTextWidth = pOutDev->GetTextWidth( *pText, nStart, nNext );
     153         [ +  - ]:         53 :                             if ( nTextWidth > aSize.Width() )
     154                 :         53 :                                 break;
     155                 :          0 :                             nLen = nNext;
     156                 :            :                         }
     157                 :          0 :                         while ( nStart+nNext < pText->Len() );
     158                 :            : 
     159                 :         53 :                         sal_uInt16 n = nLen;
     160         [ +  - ]:         53 :                         nTextWidth = pOutDev->GetTextWidth( *pText, nStart, n );
     161         [ +  + ]:       2252 :                         while( nTextWidth > aSize.Width() )
     162         [ +  - ]:       2199 :                             nTextWidth = pOutDev->GetTextWidth( *pText, nStart, --n );
     163         [ +  - ]:         53 :                         pOutDev->DrawText( aPoint, *pText, nStart, n );
     164                 :            : 
     165                 :         53 :                         aPoint.Y() += nTextHeight;
     166                 :         53 :                         nStart      = sal::static_int_cast<sal_uInt16>(nStart + nLen);
     167                 :         53 :                         nLen        = nNext-nLen;
     168 [ -  + ][ #  # ]:         53 :                         while( nStart < pText->Len() && pText->GetChar( nStart ) == ' ' )
                 [ -  + ]
     169                 :            :                         {
     170                 :          0 :                             nStart++;
     171                 :          0 :                             nLen--;
     172                 :            :                         }
     173                 :            :                     }
     174                 :         53 :                     break;
     175                 :            :                 }
     176                 :            :             }
     177                 :            :             else
     178                 :          0 :                 break;
     179         [ +  - ]:         53 :         }
     180                 :            :     }
     181                 :            : 
     182                 :            :     // Falls die Default-Graphik keinen Inhalt hat,
     183                 :            :     // malen wir ein rotes Kreuz
     184         [ -  + ]:         57 :     if( !bFilled )
     185                 :            :     {
     186                 :          0 :         aBorderRect.Left()++;
     187                 :          0 :         aBorderRect.Top()++;
     188                 :          0 :         aBorderRect.Right()--;
     189                 :          0 :         aBorderRect.Bottom()--;
     190                 :            : 
     191         [ #  # ]:          0 :         pOutDev->SetLineColor( COL_LIGHTRED );
     192 [ #  # ][ #  # ]:          0 :         pOutDev->DrawLine( aBorderRect.TopLeft(), aBorderRect.BottomRight() );
     193 [ #  # ][ #  # ]:          0 :         pOutDev->DrawLine( aBorderRect.TopRight(), aBorderRect.BottomLeft() );
                 [ #  # ]
     194                 :            :     }
     195                 :            : 
     196         [ +  - ]:         57 :     pOutDev->Pop();
     197                 :         57 : }
     198                 :            : 
     199                 :            : // -----------
     200                 :            : // - Graphic -
     201                 :            : // -----------
     202                 :            : 
     203                 :            : namespace {
     204                 :            : 
     205                 :            : struct Id: public rtl::Static< cppu::OImplementationId, Id > {};
     206                 :            : 
     207                 :            : }
     208                 :            : 
     209                 :     148932 : uno::Sequence< sal_Int8 > Graphic::getUnoTunnelId() {
     210                 :     148932 :     return Id::get().getImplementationId();
     211                 :            : }
     212                 :            : 
     213 [ #  # ][ #  # ]:          0 : TYPEINIT1_AUTOFACTORY( Graphic, SvDataCopyStream );
                 [ #  # ]
     214                 :            : 
     215                 :            : // ------------------------------------------------------------------------
     216                 :            : 
     217                 :      18732 : Graphic::Graphic()
     218                 :            : {
     219 [ +  - ][ +  - ]:      18732 :     mpImpGraphic = new ImpGraphic;
     220                 :      18732 : }
     221                 :            : 
     222                 :            : // ------------------------------------------------------------------------
     223                 :            : 
     224                 :      99874 : Graphic::Graphic( const Graphic& rGraphic ) :
     225                 :      99874 : SvDataCopyStream()
     226                 :            : {
     227 [ -  + ][ +  - ]:      99874 :     if( rGraphic.IsAnimated() )
     228 [ #  # ][ #  # ]:          0 :         mpImpGraphic = new ImpGraphic( *rGraphic.mpImpGraphic );
     229                 :            :     else
     230                 :            :     {
     231                 :      99874 :         mpImpGraphic = rGraphic.mpImpGraphic;
     232                 :      99874 :         mpImpGraphic->mnRefCount++;
     233                 :            :     }
     234                 :      99874 : }
     235                 :            : 
     236                 :            : // ------------------------------------------------------------------------
     237                 :            : 
     238                 :       4052 : Graphic::Graphic( const Bitmap& rBmp )
     239                 :            : {
     240 [ +  - ][ +  - ]:       4052 :     mpImpGraphic = new ImpGraphic( rBmp );
     241                 :       4052 : }
     242                 :            : 
     243                 :            : // ------------------------------------------------------------------------
     244                 :            : 
     245                 :     199895 : Graphic::Graphic( const BitmapEx& rBmpEx )
     246                 :            : {
     247 [ +  - ][ +  - ]:     199895 :     mpImpGraphic = new ImpGraphic( rBmpEx );
     248                 :     199895 : }
     249                 :            : 
     250                 :            : // ------------------------------------------------------------------------
     251                 :            : 
     252                 :         18 : Graphic::Graphic( const Animation& rAnimation )
     253                 :            : {
     254 [ +  - ][ +  - ]:         18 :     mpImpGraphic = new ImpGraphic( rAnimation );
     255                 :         18 : }
     256                 :            : 
     257                 :            : // ------------------------------------------------------------------------
     258                 :            : 
     259                 :        260 : Graphic::Graphic( const GDIMetaFile& rMtf )
     260                 :            : {
     261 [ +  - ][ +  - ]:        260 :     mpImpGraphic = new ImpGraphic( rMtf );
     262                 :        260 : }
     263                 :            : 
     264                 :            : // ------------------------------------------------------------------------
     265                 :            : 
     266                 :     175091 : Graphic::Graphic( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic )
     267                 :            : {
     268         [ +  - ]:     175091 :     uno::Reference< lang::XUnoTunnel >      xTunnel( rxGraphic, uno::UNO_QUERY );
     269                 :     175091 :         const ::Graphic*                                                pGraphic = ( xTunnel.is() ?
     270 [ +  - ][ +  - ]:     249557 :                                                                                                                  reinterpret_cast< ::Graphic* >( xTunnel->getSomething( getUnoTunnelId() ) ) :
         [ +  - ][ +  + ]
         [ +  - ][ #  # ]
     271         [ +  + ]:     249557 :                                                           NULL );
     272                 :            : 
     273         [ +  + ]:     175091 :     if( pGraphic )
     274                 :            :     {
     275 [ +  - ][ -  + ]:      74466 :         if( pGraphic->IsAnimated() )
     276 [ #  # ][ #  # ]:          0 :             mpImpGraphic = new ImpGraphic( *pGraphic->mpImpGraphic );
     277                 :            :         else
     278                 :            :         {
     279                 :      74466 :             mpImpGraphic = pGraphic->mpImpGraphic;
     280                 :      74466 :             mpImpGraphic->mnRefCount++;
     281                 :            :         }
     282                 :            :     }
     283                 :            :     else
     284 [ +  - ][ +  - ]:     175091 :         mpImpGraphic = new ImpGraphic;
     285                 :     175091 : }
     286                 :            : 
     287                 :            : // ------------------------------------------------------------------------
     288                 :            : 
     289                 :     497574 : Graphic::~Graphic()
     290                 :            : {
     291         [ +  + ]:     497574 :     if( mpImpGraphic->mnRefCount == 1UL )
     292 [ +  - ][ +  - ]:     314355 :         delete mpImpGraphic;
     293                 :            :     else
     294                 :     183219 :         mpImpGraphic->mnRefCount--;
     295         [ -  + ]:     579640 : }
     296                 :            : 
     297                 :            : // ------------------------------------------------------------------------
     298                 :            : 
     299                 :      17110 : void Graphic::ImplTestRefCount()
     300                 :            : {
     301         [ +  + ]:      17110 :     if( mpImpGraphic->mnRefCount > 1UL )
     302                 :            :     {
     303                 :         66 :         mpImpGraphic->mnRefCount--;
     304         [ +  - ]:         66 :         mpImpGraphic = new ImpGraphic( *mpImpGraphic );
     305                 :            :     }
     306                 :      17110 : }
     307                 :            : 
     308                 :            : // ------------------------------------------------------------------------
     309                 :            : 
     310                 :      12534 : Graphic& Graphic::operator=( const Graphic& rGraphic )
     311                 :            : {
     312         [ +  - ]:      12534 :     if( &rGraphic != this )
     313                 :            :     {
     314         [ +  + ]:      12534 :         if( rGraphic.IsAnimated() )
     315                 :            :         {
     316         [ +  - ]:         18 :             if( mpImpGraphic->mnRefCount == 1UL )
     317         [ +  - ]:         18 :                 delete mpImpGraphic;
     318                 :            :             else
     319                 :          0 :                 mpImpGraphic->mnRefCount--;
     320                 :            : 
     321         [ +  - ]:         18 :             mpImpGraphic = new ImpGraphic( *rGraphic.mpImpGraphic );
     322                 :            :         }
     323                 :            :         else
     324                 :            :         {
     325                 :      12516 :             rGraphic.mpImpGraphic->mnRefCount++;
     326                 :            : 
     327         [ +  + ]:      12516 :             if( mpImpGraphic->mnRefCount == 1UL )
     328         [ +  - ]:       8955 :                 delete mpImpGraphic;
     329                 :            :             else
     330                 :       3561 :                 mpImpGraphic->mnRefCount--;
     331                 :            : 
     332                 :      12516 :             mpImpGraphic = rGraphic.mpImpGraphic;
     333                 :            :         }
     334                 :            :     }
     335                 :            : 
     336                 :      12534 :     return *this;
     337                 :            : }
     338                 :            : 
     339                 :            : // ------------------------------------------------------------------------
     340                 :            : 
     341                 :         37 : sal_Bool Graphic::operator==( const Graphic& rGraphic ) const
     342                 :            : {
     343                 :         37 :     return( *mpImpGraphic == *rGraphic.mpImpGraphic );
     344                 :            : }
     345                 :            : 
     346                 :            : // ------------------------------------------------------------------------
     347                 :            : 
     348                 :          0 : sal_Bool Graphic::operator!=( const Graphic& rGraphic ) const
     349                 :            : {
     350                 :          0 :     return( *mpImpGraphic != *rGraphic.mpImpGraphic );
     351                 :            : }
     352                 :            : 
     353                 :            : // ------------------------------------------------------------------------
     354                 :            : 
     355                 :          0 : sal_Bool Graphic::operator!() const
     356                 :            : {
     357                 :          0 :     return( GRAPHIC_NONE == mpImpGraphic->ImplGetType() );
     358                 :            : }
     359                 :            : 
     360                 :            : // ------------------------------------------------------------------------
     361                 :            : 
     362                 :          0 : void Graphic::Load( SvStream& rIStm )
     363                 :            : {
     364                 :          0 :     rIStm >> *this;
     365                 :          0 : }
     366                 :            : 
     367                 :            : // ------------------------------------------------------------------------
     368                 :            : 
     369                 :          0 : void Graphic::Save( SvStream& rOStm )
     370                 :            : {
     371                 :          0 :     rOStm << *this;
     372                 :          0 : }
     373                 :            : 
     374                 :            : // ------------------------------------------------------------------------
     375                 :            : 
     376                 :          0 : void Graphic::Assign( const SvDataCopyStream& rCopyStream )
     377                 :            : {
     378                 :          0 :     *this = (const Graphic& ) rCopyStream;
     379                 :          0 : }
     380                 :            : 
     381                 :            : // ------------------------------------------------------------------------
     382                 :            : 
     383                 :        131 : void Graphic::Clear()
     384                 :            : {
     385                 :        131 :     ImplTestRefCount();
     386                 :        131 :     mpImpGraphic->ImplClear();
     387                 :        131 : }
     388                 :            : 
     389                 :            : // ------------------------------------------------------------------------
     390                 :            : 
     391                 :     421606 : GraphicType Graphic::GetType() const
     392                 :            : {
     393                 :     421606 :     return mpImpGraphic->ImplGetType();
     394                 :            : }
     395                 :            : 
     396                 :            : // ------------------------------------------------------------------------
     397                 :            : 
     398                 :        132 : void Graphic::SetDefaultType()
     399                 :            : {
     400                 :        132 :     ImplTestRefCount();
     401                 :        132 :     mpImpGraphic->ImplSetDefaultType();
     402                 :        132 : }
     403                 :            : 
     404                 :            : // ------------------------------------------------------------------------
     405                 :            : 
     406                 :      17708 : sal_Bool Graphic::IsSupportedGraphic() const
     407                 :            : {
     408                 :      17708 :     return mpImpGraphic->ImplIsSupportedGraphic();
     409                 :            : }
     410                 :            : 
     411                 :            : // ------------------------------------------------------------------------
     412                 :            : 
     413                 :      35206 : sal_Bool Graphic::IsTransparent() const
     414                 :            : {
     415                 :      35206 :     return mpImpGraphic->ImplIsTransparent();
     416                 :            : }
     417                 :            : 
     418                 :            : // ------------------------------------------------------------------------
     419                 :            : 
     420                 :      35204 : sal_Bool Graphic::IsAlpha() const
     421                 :            : {
     422                 :      35204 :     return mpImpGraphic->ImplIsAlpha();
     423                 :            : }
     424                 :            : 
     425                 :            : // ------------------------------------------------------------------------
     426                 :            : 
     427                 :     276111 : sal_Bool Graphic::IsAnimated() const
     428                 :            : {
     429                 :     276111 :     return mpImpGraphic->ImplIsAnimated();
     430                 :            : }
     431                 :            : 
     432                 :            : // ------------------------------------------------------------------------
     433                 :            : 
     434                 :      35204 : sal_Bool Graphic::IsEPS() const
     435                 :            : {
     436                 :      35204 :     return mpImpGraphic->ImplIsEPS();
     437                 :            : }
     438                 :            : 
     439                 :            : // ------------------------------------------------------------------------
     440                 :            : 
     441                 :      35269 : sal_Bool Graphic::IsRenderGraphic() const
     442                 :            : {
     443                 :      35269 :     return mpImpGraphic->ImplIsRenderGraphic();
     444                 :            : }
     445                 :            : 
     446                 :            : // ------------------------------------------------------------------------
     447                 :            : 
     448                 :      35204 : sal_Bool Graphic::HasRenderGraphic() const
     449                 :            : {
     450                 :      35204 :     return mpImpGraphic->ImplHasRenderGraphic();
     451                 :            : }
     452                 :            : 
     453                 :            : // ------------------------------------------------------------------------
     454                 :            : 
     455                 :        941 : Bitmap Graphic::GetBitmap(const GraphicConversionParameters& rParameters) const
     456                 :            : {
     457                 :        941 :     return mpImpGraphic->ImplGetBitmap(rParameters);
     458                 :            : }
     459                 :            : 
     460                 :            : // ------------------------------------------------------------------------
     461                 :            : 
     462                 :     248499 : BitmapEx Graphic::GetBitmapEx(const GraphicConversionParameters& rParameters) const
     463                 :            : {
     464                 :     248499 :     return mpImpGraphic->ImplGetBitmapEx(rParameters);
     465                 :            : }
     466                 :            : 
     467                 :            : // ------------------------------------------------------------------------
     468                 :            : 
     469                 :          0 : Animation Graphic::GetAnimation() const
     470                 :            : {
     471                 :          0 :     return mpImpGraphic->ImplGetAnimation();
     472                 :            : }
     473                 :            : 
     474                 :            : // ------------------------------------------------------------------------
     475                 :            : 
     476                 :        561 : const GDIMetaFile& Graphic::GetGDIMetaFile() const
     477                 :            : {
     478                 :        561 :     return mpImpGraphic->ImplGetGDIMetaFile();
     479                 :            : }
     480                 :            : 
     481                 :            : // ------------------------------------------------------------------------
     482                 :            : 
     483                 :          0 : ::vcl::RenderGraphic Graphic::GetRenderGraphic() const
     484                 :            : {
     485                 :          0 :     return mpImpGraphic->ImplGetRenderGraphic();
     486                 :            : }
     487                 :            : 
     488                 :            : // ------------------------------------------------------------------------
     489                 :            : 
     490                 :     176829 : uno::Reference< graphic::XGraphic > Graphic::GetXGraphic() const
     491                 :            : {
     492                 :     176829 :     uno::Reference< graphic::XGraphic > xRet;
     493                 :            : 
     494 [ +  + ][ +  - ]:     176829 :     if( GetType() != GRAPHIC_NONE )
     495                 :            :     {
     496         [ +  - ]:      74636 :         uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
     497         [ +  - ]:      74636 :         uno::Reference< graphic::XGraphicProvider > xProv( graphic::GraphicProvider::create( xContext ) );
     498                 :            : 
     499         [ +  - ]:      74636 :         uno::Sequence< beans::PropertyValue >   aLoadProps( 1 );
     500         [ +  - ]:      74636 :         ::rtl::OUString                         aURL( RTL_CONSTASCII_USTRINGPARAM( "private:memorygraphic/" ) );
     501                 :            : 
     502 [ +  - ][ +  - ]:      74636 :         aLoadProps[ 0 ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
     503 [ +  - ][ +  - ]:      74636 :         aLoadProps[ 0 ].Value <<= ( aURL += ::rtl::OUString::valueOf( reinterpret_cast< sal_Int64 >( this ) ) );
     504                 :            : 
     505 [ +  - ][ +  - ]:      74636 :         xRet = xProv->queryGraphic( aLoadProps );
         [ +  - ][ +  - ]
     506                 :            :     }
     507                 :            : 
     508                 :     176829 :     return xRet;
     509                 :            : }
     510                 :            : 
     511                 :            : // ------------------------------------------------------------------------
     512                 :            : 
     513                 :      39601 : Size Graphic::GetPrefSize() const
     514                 :            : {
     515                 :      39601 :     return mpImpGraphic->ImplGetPrefSize();
     516                 :            : }
     517                 :            : 
     518                 :            : // ------------------------------------------------------------------------
     519                 :            : 
     520                 :       3219 : void Graphic::SetPrefSize( const Size& rPrefSize )
     521                 :            : {
     522                 :       3219 :     ImplTestRefCount();
     523                 :       3219 :     mpImpGraphic->ImplSetPrefSize( rPrefSize );
     524                 :       3219 : }
     525                 :            : 
     526                 :            : // ------------------------------------------------------------------------
     527                 :            : 
     528                 :      39454 : MapMode Graphic::GetPrefMapMode() const
     529                 :            : {
     530                 :      39454 :     return mpImpGraphic->ImplGetPrefMapMode();
     531                 :            : }
     532                 :            : 
     533                 :            : // ------------------------------------------------------------------------
     534                 :            : 
     535                 :       3219 : void Graphic::SetPrefMapMode( const MapMode& rPrefMapMode )
     536                 :            : {
     537                 :       3219 :     ImplTestRefCount();
     538                 :       3219 :     mpImpGraphic->ImplSetPrefMapMode( rPrefMapMode );
     539                 :       3219 : }
     540                 :            : 
     541                 :            : // ------------------------------------------------------------------
     542                 :            : 
     543                 :        222 : Size Graphic::GetSizePixel( const OutputDevice* pRefDevice ) const
     544                 :            : {
     545                 :        222 :     Size aRet;
     546                 :            : 
     547         [ +  - ]:        222 :     if( GRAPHIC_BITMAP == mpImpGraphic->ImplGetType() )
     548 [ +  - ][ +  - ]:        222 :         aRet = mpImpGraphic->ImplGetBitmapEx(GraphicConversionParameters()).GetSizePixel();
     549                 :            :     else
     550 [ #  # ][ #  # ]:          0 :         aRet = ( pRefDevice ? pRefDevice : Application::GetDefaultDevice() )->LogicToPixel( GetPrefSize(), GetPrefMapMode() );
         [ #  # ][ #  # ]
     551                 :            : 
     552                 :        222 :     return aRet;
     553                 :            : }
     554                 :            : 
     555                 :            : // ------------------------------------------------------------------
     556                 :            : 
     557                 :      35204 : sal_uLong Graphic::GetSizeBytes() const
     558                 :            : {
     559                 :      35204 :     return mpImpGraphic->ImplGetSizeBytes();
     560                 :            : }
     561                 :            : 
     562                 :            : // ------------------------------------------------------------------------
     563                 :            : 
     564                 :          0 : void Graphic::Draw( OutputDevice* pOutDev, const Point& rDestPt ) const
     565                 :            : {
     566                 :          0 :     mpImpGraphic->ImplDraw( pOutDev, rDestPt );
     567                 :          0 : }
     568                 :            : 
     569                 :            : // ------------------------------------------------------------------------
     570                 :            : 
     571                 :        315 : void Graphic::Draw( OutputDevice* pOutDev,
     572                 :            :                     const Point& rDestPt, const Size& rDestSz ) const
     573                 :            : {
     574         [ -  + ]:        315 :     if( GRAPHIC_DEFAULT == mpImpGraphic->ImplGetType() )
     575                 :          0 :         ImplDrawDefault( pOutDev, NULL, NULL, NULL, NULL, rDestPt, rDestSz );
     576                 :            :     else
     577                 :        315 :         mpImpGraphic->ImplDraw( pOutDev, rDestPt, rDestSz );
     578                 :        315 : }
     579                 :            : 
     580                 :            : // ------------------------------------------------------------------------
     581                 :            : 
     582                 :         57 : void Graphic::DrawEx( OutputDevice* pOutDev, const String& rText,
     583                 :            :                     Font& rFont, const BitmapEx& rBitmap,
     584                 :            :                     const Point& rDestPt, const Size& rDestSz )
     585                 :            : {
     586                 :         57 :     ImplDrawDefault( pOutDev, &rText, &rFont, NULL, &rBitmap, rDestPt, rDestSz );
     587                 :         57 : }
     588                 :            : 
     589                 :            : // ------------------------------------------------------------------------
     590                 :            : 
     591                 :          0 : void Graphic::StartAnimation( OutputDevice* pOutDev, const Point& rDestPt,
     592                 :            :                               const Size& rDestSz, long nExtraData,
     593                 :            :                               OutputDevice* pFirstFrameOutDev )
     594                 :            : {
     595                 :          0 :     ImplTestRefCount();
     596                 :          0 :     mpImpGraphic->ImplStartAnimation( pOutDev, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev );
     597                 :          0 : }
     598                 :            : 
     599                 :            : // ------------------------------------------------------------------------
     600                 :            : 
     601                 :          0 : void Graphic::StopAnimation( OutputDevice* pOutDev, long nExtraData )
     602                 :            : {
     603                 :          0 :     ImplTestRefCount();
     604                 :          0 :     mpImpGraphic->ImplStopAnimation( pOutDev, nExtraData );
     605                 :          0 : }
     606                 :            : 
     607                 :            : // ------------------------------------------------------------------------
     608                 :            : 
     609                 :       3198 : void Graphic::SetAnimationNotifyHdl( const Link& rLink )
     610                 :            : {
     611                 :       3198 :     mpImpGraphic->ImplSetAnimationNotifyHdl( rLink );
     612                 :       3198 : }
     613                 :            : 
     614                 :            : // ------------------------------------------------------------------------
     615                 :            : 
     616                 :       3621 : Link Graphic::GetAnimationNotifyHdl() const
     617                 :            : {
     618                 :       3621 :     return mpImpGraphic->ImplGetAnimationNotifyHdl();
     619                 :            : }
     620                 :            : 
     621                 :            : // ------------------------------------------------------------------------
     622                 :            : 
     623                 :          0 : sal_uLong Graphic::GetAnimationLoopCount() const
     624                 :            : {
     625                 :          0 :     return mpImpGraphic->ImplGetAnimationLoopCount();
     626                 :            : }
     627                 :            : 
     628                 :            : // ------------------------------------------------------------------------
     629                 :            : 
     630                 :      13578 : GraphicReader* Graphic::GetContext()
     631                 :            : {
     632                 :      13578 :     return mpImpGraphic->ImplGetContext();
     633                 :            : }
     634                 :            : 
     635                 :            : // ------------------------------------------------------------------------
     636                 :            : 
     637                 :         78 : void Graphic::SetContext( GraphicReader* pReader )
     638                 :            : {
     639                 :         78 :     mpImpGraphic->ImplSetContext( pReader );
     640                 :         78 : }
     641                 :            : 
     642                 :            : // ------------------------------------------------------------------------
     643                 :            : 
     644                 :       3198 : void Graphic::SetDocFileName( const String& rName, sal_uLong nFilePos )
     645                 :            : {
     646                 :       3198 :     mpImpGraphic->ImplSetDocFileName( rName, nFilePos );
     647                 :       3198 : }
     648                 :            : 
     649                 :            : // ------------------------------------------------------------------------
     650                 :            : 
     651                 :       3621 : const String& Graphic::GetDocFileName() const
     652                 :            : {
     653                 :       3621 :     return mpImpGraphic->ImplGetDocFileName();
     654                 :            : }
     655                 :            : 
     656                 :            : // ------------------------------------------------------------------------
     657                 :            : 
     658                 :       3621 : sal_uLong Graphic::GetDocFilePos() const
     659                 :            : {
     660                 :       3621 :     return mpImpGraphic->ImplGetDocFilePos();
     661                 :            : }
     662                 :            : 
     663                 :            : // ------------------------------------------------------------------------
     664                 :            : 
     665                 :          0 : sal_Bool Graphic::ReadEmbedded( SvStream& rIStream, sal_Bool bSwap )
     666                 :            : {
     667                 :          0 :     ImplTestRefCount();
     668                 :          0 :     return mpImpGraphic->ImplReadEmbedded( rIStream, bSwap );
     669                 :            : }
     670                 :            : 
     671                 :            : // ------------------------------------------------------------------------
     672                 :            : 
     673                 :         15 : sal_Bool Graphic::SwapOut()
     674                 :            : {
     675                 :         15 :     ImplTestRefCount();
     676                 :         15 :     return mpImpGraphic->ImplSwapOut();
     677                 :            : }
     678                 :            : 
     679                 :            : // ------------------------------------------------------------------------
     680                 :            : 
     681                 :          0 : sal_Bool Graphic::SwapOut( SvStream* pOStream )
     682                 :            : {
     683                 :          0 :     ImplTestRefCount();
     684                 :          0 :     return mpImpGraphic->ImplSwapOut( pOStream );
     685                 :            : }
     686                 :            : 
     687                 :            : // ------------------------------------------------------------------------
     688                 :            : 
     689                 :          8 : sal_Bool Graphic::SwapIn()
     690                 :            : {
     691                 :          8 :     ImplTestRefCount();
     692                 :          8 :     return mpImpGraphic->ImplSwapIn();
     693                 :            : }
     694                 :            : 
     695                 :            : // ------------------------------------------------------------------------
     696                 :            : 
     697                 :          0 : sal_Bool Graphic::SwapIn( SvStream* pStrm )
     698                 :            : {
     699                 :          0 :     ImplTestRefCount();
     700                 :          0 :     return mpImpGraphic->ImplSwapIn( pStrm );
     701                 :            : }
     702                 :            : 
     703                 :            : // ------------------------------------------------------------------------
     704                 :            : 
     705                 :     101624 : sal_Bool Graphic::IsSwapOut() const
     706                 :            : {
     707                 :     101624 :     return mpImpGraphic->ImplIsSwapOut();
     708                 :            : }
     709                 :            : 
     710                 :            : // ------------------------------------------------------------------------
     711                 :            : 
     712                 :       3453 : void Graphic::SetLink( const GfxLink& rGfxLink )
     713                 :            : {
     714                 :       3453 :     ImplTestRefCount();
     715                 :       3453 :     mpImpGraphic->ImplSetLink( rGfxLink );
     716                 :       3453 : }
     717                 :            : 
     718                 :            : // ------------------------------------------------------------------------
     719                 :            : 
     720                 :        274 : GfxLink Graphic::GetLink() const
     721                 :            : {
     722                 :        274 :     return mpImpGraphic->ImplGetLink();
     723                 :            : }
     724                 :            : 
     725                 :            : // ------------------------------------------------------------------------
     726                 :            : 
     727                 :      43923 : sal_Bool Graphic::IsLink() const
     728                 :            : {
     729                 :      43923 :     return mpImpGraphic->ImplIsLink();
     730                 :            : }
     731                 :            : 
     732                 :            : // ------------------------------------------------------------------------
     733                 :            : 
     734                 :      36296 : sal_uLong Graphic::GetChecksum() const
     735                 :            : {
     736                 :      36296 :     return mpImpGraphic->ImplGetChecksum();
     737                 :            : }
     738                 :            : 
     739                 :            : // ------------------------------------------------------------------------
     740                 :            : 
     741                 :        435 : sal_Bool Graphic::ExportNative( SvStream& rOStream ) const
     742                 :            : {
     743                 :        435 :     return mpImpGraphic->ImplExportNative( rOStream );
     744                 :            : }
     745                 :            : 
     746                 :            : // ------------------------------------------------------------------------
     747                 :            : 
     748                 :       6933 : SvStream& operator>>( SvStream& rIStream, Graphic& rGraphic )
     749                 :            : {
     750                 :       6933 :     rGraphic.ImplTestRefCount();
     751                 :       6933 :     return rIStream >> *rGraphic.mpImpGraphic;
     752                 :            : }
     753                 :            : 
     754                 :            : // ------------------------------------------------------------------------
     755                 :            : 
     756                 :       1207 : SvStream& operator<<( SvStream& rOStream, const Graphic& rGraphic )
     757                 :            : {
     758                 :       1207 :     return rOStream << *rGraphic.mpImpGraphic;
     759                 :            : }
     760                 :            : 
     761                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10