LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/toolkit/source/awt - vclxgraphics.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 41 308 13.3 %
Date: 2013-07-09 Functions: 12 52 23.1 %
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             : 
      21             : #include <toolkit/awt/vclxgraphics.hxx>
      22             : #include <toolkit/awt/vclxdevice.hxx>
      23             : #include <toolkit/awt/vclxfont.hxx>
      24             : #include <toolkit/helper/macros.hxx>
      25             : #include <toolkit/helper/vclunohelper.hxx>
      26             : #include <cppuhelper/typeprovider.hxx>
      27             : #include <rtl/uuid.h>
      28             : 
      29             : #include <vcl/svapp.hxx>
      30             : #include <vcl/outdev.hxx>
      31             : #include <vcl/image.hxx>
      32             : #include <vcl/gradient.hxx>
      33             : #include <tools/debug.hxx>
      34             : 
      35             : using namespace com::sun::star;
      36             : 
      37             : //  ----------------------------------------------------
      38             : //  class VCLXGraphics
      39             : //  ----------------------------------------------------
      40             : 
      41             : // uno::XInterface
      42       13171 : uno::Any VCLXGraphics::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
      43             : {
      44             :     uno::Any aRet = ::cppu::queryInterface( rType,
      45             :                                         (static_cast< ::com::sun::star::awt::XGraphics* >(this)),
      46             :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)),
      47       13171 :                                         (static_cast< ::com::sun::star::lang::XUnoTunnel* >(this)) );
      48       13171 :     return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
      49             : }
      50             : 
      51             : // lang::XUnoTunnel
      52       55122 : IMPL_XUNOTUNNEL( VCLXGraphics )
      53             : 
      54             : // lang::XTypeProvider
      55           0 : IMPL_XTYPEPROVIDER_START( VCLXGraphics )
      56           0 :     getCppuType( ( uno::Reference< awt::XGraphics>* ) NULL )
      57           0 : IMPL_XTYPEPROVIDER_END
      58             : 
      59       11209 : VCLXGraphics::VCLXGraphics()
      60             : {
      61       11209 :     mpOutputDevice = NULL;
      62       11209 :     mpClipRegion = NULL;
      63       11209 : }
      64             : 
      65       33627 : VCLXGraphics::~VCLXGraphics()
      66             : {
      67       11209 :     VCLXGraphicsList_impl* pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : NULL;
      68       11209 :     if ( pLst )
      69             :     {
      70       11196 :         for( VCLXGraphicsList_impl::iterator it = pLst->begin(); it != pLst->end(); ++it )
      71             :         {
      72       11196 :             if( *it == this ) {
      73       11196 :                 pLst->erase( it );
      74       11196 :                 break;
      75             :             }
      76             :         }
      77             :     }
      78             : 
      79       11209 :     delete mpClipRegion;
      80       22418 : }
      81             : 
      82          13 : void VCLXGraphics::SetOutputDevice( OutputDevice* pOutDev )
      83             : {
      84          13 :     mpOutputDevice = pOutDev;
      85          13 :     mxDevice = NULL;
      86          13 :     initAttrs();
      87          13 : }
      88             : 
      89       11209 : void VCLXGraphics::Init( OutputDevice* pOutDev )
      90             : {
      91             :     DBG_ASSERT( !mpOutputDevice, "VCLXGraphics::Init already has pOutDev !" );
      92       11209 :     mpOutputDevice  = pOutDev;
      93             : 
      94       11209 :     initAttrs();
      95       11209 :     mpClipRegion    = NULL;
      96             : 
      97             :     // Register at OutputDevice
      98       11209 :     VCLXGraphicsList_impl* pLst = mpOutputDevice->GetUnoGraphicsList();
      99       11209 :     if ( !pLst )
     100        1149 :         pLst = mpOutputDevice->CreateUnoGraphicsList();
     101       11209 :     pLst->push_back( this );
     102       11209 : }
     103             : 
     104       11222 : void VCLXGraphics::initAttrs()
     105             : {
     106       11222 :     if ( !mpOutputDevice )
     107       11235 :         return;
     108             : 
     109       11209 :     maFont          = mpOutputDevice->GetFont();
     110       11209 :     maTextColor     = mpOutputDevice->GetTextColor(); /* COL_BLACK */
     111       11209 :     maTextFillColor = mpOutputDevice->GetTextFillColor(); /* COL_TRANSPARENT */
     112       11209 :     maLineColor     = mpOutputDevice->GetLineColor(); /* COL_BLACK */
     113       11209 :     maFillColor     = mpOutputDevice->GetFillColor(); /* COL_WHITE */
     114       11209 :     meRasterOp      = mpOutputDevice->GetRasterOp(); /* ROP_OVERPAINT */
     115             : }
     116             : 
     117           0 : void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags )
     118             : {
     119           0 :     if(mpOutputDevice)
     120             :     {
     121           0 :         SolarMutexGuard aVclGuard;
     122             : 
     123           0 :         if ( nFlags & INITOUTDEV_FONT )
     124             :         {
     125           0 :             mpOutputDevice->SetFont( maFont );
     126           0 :             mpOutputDevice->SetTextColor( maTextColor );
     127           0 :             mpOutputDevice->SetTextFillColor( maTextFillColor );
     128             :         }
     129             : 
     130           0 :         if ( nFlags & INITOUTDEV_COLORS )
     131             :         {
     132           0 :             mpOutputDevice->SetLineColor( maLineColor );
     133           0 :             mpOutputDevice->SetFillColor( maFillColor );
     134             :         }
     135             : 
     136           0 :         if ( nFlags & INITOUTDEV_RASTEROP )
     137             :         {
     138           0 :             mpOutputDevice->SetRasterOp( meRasterOp );
     139             :         }
     140             : 
     141           0 :         if ( nFlags & INITOUTDEV_CLIPREGION )
     142             :         {
     143           0 :             if( mpClipRegion )
     144           0 :                 mpOutputDevice->SetClipRegion( *mpClipRegion );
     145             :             else
     146           0 :                 mpOutputDevice->SetClipRegion();
     147           0 :         }
     148             :     }
     149           0 : }
     150             : 
     151           0 : uno::Reference< awt::XDevice > VCLXGraphics::getDevice() throw(uno::RuntimeException)
     152             : {
     153           0 :     SolarMutexGuard aGuard;
     154             : 
     155           0 :     if( !mxDevice.is() && mpOutputDevice )
     156             :     {
     157           0 :         VCLXDevice* pDev = new VCLXDevice;
     158           0 :         pDev->SetOutputDevice( mpOutputDevice );
     159           0 :         mxDevice = pDev;
     160             :     }
     161           0 :     return mxDevice;
     162             : }
     163             : 
     164           0 : awt::SimpleFontMetric VCLXGraphics::getFontMetric() throw(uno::RuntimeException)
     165             : {
     166           0 :     SolarMutexGuard aGuard;
     167             : 
     168           0 :     awt::SimpleFontMetric aM;
     169           0 :     if( mpOutputDevice )
     170             :     {
     171           0 :         mpOutputDevice->SetFont( maFont );
     172           0 :         aM = VCLUnoHelper::CreateFontMetric( mpOutputDevice->GetFontMetric() );
     173             :     }
     174           0 :     return aM;
     175             : }
     176             : 
     177           0 : void VCLXGraphics::setFont( const uno::Reference< awt::XFont >& rxFont ) throw(uno::RuntimeException)
     178             : {
     179           0 :     SolarMutexGuard aGuard;
     180             : 
     181           0 :     maFont = VCLUnoHelper::CreateFont( rxFont );
     182           0 : }
     183             : 
     184           0 : uno::Reference< awt::XFont > VCLXGraphics::getFont() throw(uno::RuntimeException)
     185             : {
     186           0 :     uno::Reference< awt::XFont > xFont;
     187           0 :     uno::Reference< awt::XDevice > xDevice( getDevice() );
     188             : 
     189           0 :     SolarMutexGuard aGuard;
     190             : 
     191           0 :     if ( xDevice.is() )
     192             :     {
     193           0 :         VCLXFont *pFont = new VCLXFont;
     194           0 :         pFont->Init( *xDevice.get(), maFont );
     195           0 :         xFont.set( static_cast< ::cppu::OWeakObject* >( pFont ), uno::UNO_QUERY );
     196             :     }
     197             : 
     198           0 :     return xFont;
     199             : }
     200             : 
     201           0 : void VCLXGraphics::selectFont( const awt::FontDescriptor& rDescription ) throw(uno::RuntimeException)
     202             : {
     203           0 :     SolarMutexGuard aGuard;
     204             : 
     205           0 :     maFont = VCLUnoHelper::CreateFont( rDescription, Font() );
     206           0 : }
     207             : 
     208           0 : void VCLXGraphics::setTextColor( sal_Int32 nColor ) throw(uno::RuntimeException)
     209             : {
     210           0 :     SolarMutexGuard aGuard;
     211             : 
     212           0 :     maTextColor = Color( (sal_uInt32)nColor );
     213           0 : }
     214             : 
     215           0 : ::sal_Int32 VCLXGraphics::getTextColor() throw(uno::RuntimeException)
     216             : {
     217           0 :     SolarMutexGuard aGuard;
     218           0 :     return maTextColor.GetColor();
     219             : }
     220             : 
     221           0 : void VCLXGraphics::setTextFillColor( sal_Int32 nColor ) throw(uno::RuntimeException)
     222             : {
     223           0 :     SolarMutexGuard aGuard;
     224             : 
     225           0 :     maTextFillColor = Color( (sal_uInt32)nColor );
     226           0 : }
     227             : 
     228           0 : ::sal_Int32 VCLXGraphics::getTextFillColor() throw(uno::RuntimeException)
     229             : {
     230           0 :     SolarMutexGuard aGuard;
     231           0 :     return maTextFillColor.GetColor();
     232             : }
     233             : 
     234           0 : void VCLXGraphics::setLineColor( sal_Int32 nColor ) throw(uno::RuntimeException)
     235             : {
     236           0 :     SolarMutexGuard aGuard;
     237             : 
     238           0 :     maLineColor = Color( (sal_uInt32)nColor );
     239           0 : }
     240             : 
     241           0 : ::sal_Int32 VCLXGraphics::getLineColor() throw(uno::RuntimeException)
     242             : {
     243           0 :     SolarMutexGuard aGuard;
     244           0 :     return maLineColor.GetColor();
     245             : }
     246             : 
     247           0 : void VCLXGraphics::setFillColor( sal_Int32 nColor ) throw(uno::RuntimeException)
     248             : {
     249           0 :     SolarMutexGuard aGuard;
     250             : 
     251           0 :     maFillColor = Color( (sal_uInt32)nColor );
     252           0 : }
     253             : 
     254           0 : ::sal_Int32 VCLXGraphics::getFillColor() throw(uno::RuntimeException)
     255             : {
     256           0 :     SolarMutexGuard aGuard;
     257           0 :     return maFillColor.GetColor();
     258             : }
     259             : 
     260           0 : void VCLXGraphics::setRasterOp( awt::RasterOperation eROP ) throw(uno::RuntimeException)
     261             : {
     262           0 :     SolarMutexGuard aGuard;
     263             : 
     264           0 :     meRasterOp = (RasterOp)eROP;
     265           0 : }
     266             : 
     267           0 : awt::RasterOperation VCLXGraphics::getRasterOp()
     268             : throw(uno::RuntimeException)
     269             : {
     270           0 :     SolarMutexGuard aGuard;
     271           0 :     return (awt::RasterOperation) meRasterOp;
     272             : }
     273             : 
     274           0 : void VCLXGraphics::setClipRegion( const uno::Reference< awt::XRegion >& rxRegion ) throw(uno::RuntimeException)
     275             : {
     276           0 :     SolarMutexGuard aGuard;
     277             : 
     278           0 :     delete mpClipRegion;
     279           0 :     if ( rxRegion.is() )
     280           0 :         mpClipRegion = new Region( VCLUnoHelper::GetRegion( rxRegion ) );
     281             :     else
     282           0 :         mpClipRegion = NULL;
     283           0 : }
     284             : 
     285           0 : void VCLXGraphics::intersectClipRegion( const uno::Reference< awt::XRegion >& rxRegion ) throw(uno::RuntimeException)
     286             : {
     287           0 :     SolarMutexGuard aGuard;
     288             : 
     289           0 :     if ( rxRegion.is() )
     290             :     {
     291           0 :         Region aRegion( VCLUnoHelper::GetRegion( rxRegion ) );
     292           0 :         if ( !mpClipRegion )
     293           0 :             mpClipRegion = new Region( aRegion );
     294             :         else
     295           0 :             mpClipRegion->Intersect( aRegion );
     296           0 :     }
     297           0 : }
     298             : 
     299           0 : void VCLXGraphics::push(  ) throw(uno::RuntimeException)
     300             : {
     301           0 :     SolarMutexGuard aGuard;
     302             : 
     303             : 
     304           0 :     if( mpOutputDevice )
     305           0 :         mpOutputDevice->Push();
     306           0 : }
     307             : 
     308           0 : void VCLXGraphics::pop(  ) throw(uno::RuntimeException)
     309             : {
     310           0 :     SolarMutexGuard aGuard;
     311             : 
     312             : 
     313           0 :     if( mpOutputDevice )
     314           0 :         mpOutputDevice->Pop();
     315           0 : }
     316             : 
     317           0 : void VCLXGraphics::clear(
     318             :     const awt::Rectangle& aRect )
     319             : throw(uno::RuntimeException)
     320             : {
     321           0 :     SolarMutexGuard aGuard;
     322             : 
     323           0 :     if( mpOutputDevice )
     324             :     {
     325           0 :         const ::Rectangle aVCLRect = VCLUnoHelper::ConvertToVCLRect( aRect );
     326           0 :         mpOutputDevice->Erase( aVCLRect );
     327           0 :     }
     328           0 : }
     329             : 
     330           0 : void VCLXGraphics::copy( const uno::Reference< awt::XDevice >& rxSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(uno::RuntimeException)
     331             : {
     332           0 :     SolarMutexGuard aGuard;
     333             : 
     334           0 :     if ( mpOutputDevice )
     335             :     {
     336           0 :         VCLXDevice* pFromDev = VCLXDevice::GetImplementation( rxSource );
     337             :         DBG_ASSERT( pFromDev, "VCLXGraphics::copy - invalid device" );
     338           0 :         if ( pFromDev )
     339             :         {
     340           0 :             InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP );
     341             :             mpOutputDevice->DrawOutDev( Point( nDestX, nDestY ), Size( nDestWidth, nDestHeight ),
     342           0 :                                     Point( nSourceX, nSourceY ), Size( nSourceWidth, nSourceHeight ), *pFromDev->GetOutputDevice() );
     343             :         }
     344           0 :     }
     345           0 : }
     346             : 
     347           0 : void VCLXGraphics::draw( const uno::Reference< awt::XDisplayBitmap >& rxBitmapHandle, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(uno::RuntimeException)
     348             : {
     349           0 :     SolarMutexGuard aGuard;
     350             : 
     351           0 :     if( mpOutputDevice )
     352             :     {
     353           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP);
     354           0 :         uno::Reference< awt::XBitmap > xBitmap( rxBitmapHandle, uno::UNO_QUERY );
     355           0 :         BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap );
     356             : 
     357           0 :         Point aPos(nDestX - nSourceX, nDestY - nSourceY);
     358           0 :           Size aSz = aBmpEx.GetSizePixel();
     359             : 
     360           0 :         if(nDestWidth != nSourceWidth)
     361             :         {
     362           0 :             float zoomX = (float)nDestWidth / (float)nSourceWidth;
     363           0 :             aSz.Width() = (long) ((float)aSz.Width() * zoomX);
     364             :         }
     365             : 
     366           0 :         if(nDestHeight != nSourceHeight)
     367             :         {
     368           0 :             float zoomY = (float)nDestHeight / (float)nSourceHeight;
     369           0 :             aSz.Height() = (long) ((float)aSz.Height() * zoomY);
     370             :         }
     371             : 
     372           0 :         if(nSourceX || nSourceY || aSz.Width() != nSourceWidth || aSz.Height() != nSourceHeight)
     373           0 :             mpOutputDevice->IntersectClipRegion(Region(Rectangle(nDestX, nDestY, nDestX + nDestWidth - 1, nDestY + nDestHeight - 1)));
     374             : 
     375           0 :         mpOutputDevice->DrawBitmapEx( aPos, aSz, aBmpEx );
     376           0 :     }
     377           0 : }
     378             : 
     379           0 : void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(uno::RuntimeException)
     380             : {
     381           0 :     SolarMutexGuard aGuard;
     382             : 
     383           0 :     if( mpOutputDevice )
     384             :     {
     385           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     386           0 :         mpOutputDevice->DrawPixel( Point( x, y ) );
     387           0 :     }
     388           0 : }
     389             : 
     390           0 : void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException)
     391             : {
     392           0 :     SolarMutexGuard aGuard;
     393             : 
     394           0 :     if( mpOutputDevice )
     395             :     {
     396           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     397           0 :         mpOutputDevice->DrawLine( Point( x1, y1 ), Point( x2, y2 ) );
     398           0 :     }
     399           0 : }
     400             : 
     401           0 : void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(uno::RuntimeException)
     402             : {
     403           0 :     SolarMutexGuard aGuard;
     404             : 
     405           0 :     if( mpOutputDevice )
     406             :     {
     407           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     408           0 :         mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ) );
     409           0 :     }
     410           0 : }
     411             : 
     412           0 : void VCLXGraphics::drawRoundedRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(uno::RuntimeException)
     413             : {
     414           0 :     SolarMutexGuard aGuard;
     415             : 
     416           0 :     if( mpOutputDevice )
     417             :     {
     418           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     419           0 :         mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ), nHorzRound, nVertRound );
     420           0 :     }
     421           0 : }
     422             : 
     423           0 : void VCLXGraphics::drawPolyLine( const uno::Sequence< sal_Int32 >& DataX, const uno::Sequence< sal_Int32 >& DataY ) throw(uno::RuntimeException)
     424             : {
     425           0 :     SolarMutexGuard aGuard;
     426             : 
     427           0 :     if( mpOutputDevice )
     428             :     {
     429           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     430           0 :         mpOutputDevice->DrawPolyLine( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
     431           0 :     }
     432           0 : }
     433             : 
     434           0 : void VCLXGraphics::drawPolygon( const uno::Sequence< sal_Int32 >& DataX, const uno::Sequence< sal_Int32 >& DataY ) throw(uno::RuntimeException)
     435             : {
     436           0 :     SolarMutexGuard aGuard;
     437             : 
     438           0 :     if( mpOutputDevice )
     439             :     {
     440           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     441           0 :         mpOutputDevice->DrawPolygon( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
     442           0 :     }
     443           0 : }
     444             : 
     445           0 : void VCLXGraphics::drawPolyPolygon( const uno::Sequence< uno::Sequence< sal_Int32 > >& DataX, const uno::Sequence< uno::Sequence< sal_Int32 > >& DataY ) throw(uno::RuntimeException)
     446             : {
     447           0 :     SolarMutexGuard aGuard;
     448             : 
     449           0 :     if( mpOutputDevice )
     450             :     {
     451           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     452           0 :         sal_uInt16 nPolys = (sal_uInt16) DataX.getLength();
     453           0 :         PolyPolygon aPolyPoly( nPolys );
     454           0 :         for ( sal_uInt16 n = 0; n < nPolys; n++ )
     455           0 :             aPolyPoly[n] = VCLUnoHelper::CreatePolygon( DataX.getConstArray()[n], DataY.getConstArray()[n] );
     456             : 
     457           0 :         mpOutputDevice->DrawPolyPolygon( aPolyPoly );
     458           0 :     }
     459           0 : }
     460             : 
     461           0 : void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(uno::RuntimeException)
     462             : {
     463           0 :     SolarMutexGuard aGuard;
     464             : 
     465           0 :     if( mpOutputDevice )
     466             :     {
     467           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     468           0 :         mpOutputDevice->DrawEllipse( Rectangle( Point( x, y ), Size( width, height ) ) );
     469           0 :     }
     470           0 : }
     471             : 
     472           0 : void VCLXGraphics::drawArc( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException)
     473             : {
     474           0 :     SolarMutexGuard aGuard;
     475             : 
     476           0 :     if( mpOutputDevice )
     477             :     {
     478           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     479           0 :         mpOutputDevice->DrawArc( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
     480           0 :     }
     481           0 : }
     482             : 
     483           0 : void VCLXGraphics::drawPie( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException)
     484             : {
     485           0 :     SolarMutexGuard aGuard;
     486             : 
     487           0 :     if( mpOutputDevice )
     488             :     {
     489           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     490           0 :         mpOutputDevice->DrawPie( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
     491           0 :     }
     492           0 : }
     493             : 
     494           0 : void VCLXGraphics::drawChord( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException)
     495             : {
     496           0 :     SolarMutexGuard aGuard;
     497             : 
     498           0 :     if( mpOutputDevice )
     499             :     {
     500           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     501           0 :         mpOutputDevice->DrawChord( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
     502           0 :     }
     503           0 : }
     504             : 
     505           0 : void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, const awt::Gradient& rGradient ) throw(uno::RuntimeException)
     506             : {
     507           0 :     SolarMutexGuard aGuard;
     508             : 
     509           0 :     if( mpOutputDevice )
     510             :     {
     511           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     512           0 :         Gradient aGradient((GradientStyle)rGradient.Style, rGradient.StartColor, rGradient.EndColor);
     513           0 :         aGradient.SetAngle(rGradient.Angle);
     514           0 :         aGradient.SetBorder(rGradient.Border);
     515           0 :         aGradient.SetOfsX(rGradient.XOffset);
     516           0 :         aGradient.SetOfsY(rGradient.YOffset);
     517           0 :         aGradient.SetStartIntensity(rGradient.StartIntensity);
     518           0 :         aGradient.SetEndIntensity(rGradient.EndIntensity);
     519           0 :         aGradient.SetSteps(rGradient.StepCount);
     520           0 :         mpOutputDevice->DrawGradient( Rectangle( Point( x, y ), Size( width, height ) ), aGradient );
     521           0 :     }
     522           0 : }
     523             : 
     524           0 : void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const OUString& rText ) throw(uno::RuntimeException)
     525             : {
     526           0 :     SolarMutexGuard aGuard;
     527             : 
     528           0 :     if( mpOutputDevice )
     529             :     {
     530           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS |INITOUTDEV_FONT);
     531           0 :         mpOutputDevice->DrawText( Point( x, y ), rText );
     532           0 :     }
     533           0 : }
     534             : 
     535           0 : void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rText, const uno::Sequence< sal_Int32 >& rLongs ) throw(uno::RuntimeException)
     536             : {
     537           0 :     SolarMutexGuard aGuard;
     538             : 
     539           0 :     if( mpOutputDevice )
     540             :     {
     541           0 :         InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS|INITOUTDEV_FONT );
     542           0 :         mpOutputDevice->DrawTextArray( Point( x, y ), rText, rLongs.getConstArray() );
     543           0 :     }
     544           0 : }
     545             : 
     546             : 
     547           0 : void VCLXGraphics::drawImage( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int16 nStyle, const uno::Reference< graphic::XGraphic >& xGraphic ) throw(uno::RuntimeException)
     548             : {
     549           0 :     SolarMutexGuard aGuard;
     550             : 
     551           0 :     if( mpOutputDevice && xGraphic.is() )
     552             :     {
     553           0 :         Image aImage( xGraphic );
     554           0 :         if ( !!aImage )
     555             :         {
     556           0 :             InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
     557           0 :             mpOutputDevice->DrawImage( Point( x, y ), Size( width, height ), aImage, nStyle );
     558           0 :         }
     559           0 :     }
     560         465 : }
     561             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10