LCOV - code coverage report
Current view: top level - libreoffice/canvas/source/vcl - impltools.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 23 0.0 %
Date: 2012-12-27 Functions: 0 6 0.0 %
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             : #ifndef _VCLCANVAS_TOOLS_HXX
      21             : #define _VCLCANVAS_TOOLS_HXX
      22             : 
      23             : #include <osl/mutex.hxx>
      24             : 
      25             : #include <vcl/svapp.hxx>
      26             : #include <vcl/outdev.hxx>
      27             : #include <vcl/solarmutex.hxx>
      28             : 
      29             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      30             : 
      31             : #include <com/sun/star/uno/Reference.hxx>
      32             : #include <com/sun/star/uno/Sequence.hxx>
      33             : 
      34             : #include <canvas/vclwrapper.hxx>
      35             : #include "outdevprovider.hxx"
      36             : 
      37             : 
      38             : class OutputDevice;
      39             : class Point;
      40             : class Size;
      41             : 
      42             : namespace basegfx
      43             : {
      44             :     namespace matrix
      45             :     {
      46             :         class B2DHomMatrix;
      47             :     }
      48             : }
      49             : 
      50             : namespace com { namespace sun { namespace star { namespace awt
      51             : {
      52             :     struct Point;
      53             :     struct Size;
      54             :     struct Rectangle;
      55             : } } } }
      56             : 
      57             : namespace com { namespace sun { namespace star { namespace drawing
      58             : {
      59             :     struct HomogenMatrix3;
      60             : } } } }
      61             : 
      62             : namespace com { namespace sun { namespace star { namespace geometry
      63             : {
      64             :     struct RealPoint2D;
      65             :     struct RealSize2D;
      66             :     struct RealRectangle2D;
      67             : } } } }
      68             : 
      69             : namespace com { namespace sun { namespace star { namespace rendering
      70             : {
      71             :     struct RenderState;
      72             :     struct ViewState;
      73             :     class  XBitmap;
      74             : } } } }
      75             : 
      76             : 
      77             : namespace vclcanvas
      78             : {
      79             :     namespace tools
      80             :     {
      81             :         ::BitmapEx
      82             :         bitmapExFromXBitmap( const ::com::sun::star::uno::Reference<
      83             :                              ::com::sun::star::rendering::XBitmap >& );
      84             : 
      85             :         /** Setup VCL font and output position
      86             : 
      87             :             @returns false, if no text output should happen
      88             :          */
      89             :         bool setupFontTransform( ::Point&                                                   o_rPoint,
      90             :                                  ::Font&                                                    io_rVCLFont,
      91             :                                  const ::com::sun::star::rendering::ViewState&      viewState,
      92             :                                  const ::com::sun::star::rendering::RenderState&    renderState,
      93             :                                  ::OutputDevice&                                            rOutDev );
      94             : 
      95             :         /** Predicate, to determine whether polygon is actually an axis-aligned rectangle
      96             : 
      97             :             @return true, if the polygon is a rectangle.
      98             :          */
      99             :         bool isRectangle( const PolyPolygon& rPolyPoly );
     100             : 
     101             : 
     102             :         // Little helper to encapsulate locking into policy class
     103           0 :         class LocalGuard
     104             :         {
     105             :         public:
     106             :             LocalGuard() :
     107             :                 aSolarGuard()
     108             :             {
     109             :             }
     110             : 
     111             :             /// To be compatible with CanvasBase mutex concept
     112           0 :             LocalGuard( const ::osl::Mutex& ) :
     113           0 :                 aSolarGuard()
     114             :             {
     115           0 :             }
     116             : 
     117             :         private:
     118             :             SolarMutexGuard aSolarGuard;
     119             :         };
     120             : 
     121             :         class OutDevStateKeeper
     122             :         {
     123             :         public:
     124           0 :             explicit OutDevStateKeeper( OutputDevice& rOutDev ) :
     125             :                 mpOutDev( &rOutDev ),
     126           0 :                 mbMappingWasEnabled( mpOutDev->IsMapModeEnabled() )
     127             :             {
     128           0 :                 init();
     129           0 :             }
     130             : 
     131           0 :             explicit OutDevStateKeeper( const OutDevProviderSharedPtr& rOutDev ) :
     132           0 :                 mpOutDev( rOutDev.get() ? &(rOutDev->getOutDev()) : NULL ),
     133           0 :                 mbMappingWasEnabled( mpOutDev ? mpOutDev->IsMapModeEnabled() : false )
     134             :             {
     135           0 :                 init();
     136           0 :             }
     137             : 
     138           0 :             ~OutDevStateKeeper()
     139             :             {
     140           0 :                 if( mpOutDev )
     141             :                 {
     142           0 :                     mpOutDev->EnableMapMode( mbMappingWasEnabled );
     143           0 :                     mpOutDev->Pop();
     144             :                 }
     145           0 :             }
     146             : 
     147             :         private:
     148           0 :             void init()
     149             :             {
     150           0 :                 if( mpOutDev )
     151             :                 {
     152           0 :                     mpOutDev->Push();
     153           0 :                     mpOutDev->EnableMapMode(sal_False);
     154             :                 }
     155           0 :             }
     156             : 
     157             :             OutputDevice*   mpOutDev;
     158             :             const bool      mbMappingWasEnabled;
     159             :         };
     160             : 
     161             :         ::Point mapRealPoint2D( const ::com::sun::star::geometry::RealPoint2D&  rPoint,
     162             :                                 const ::com::sun::star::rendering::ViewState&   rViewState,
     163             :                                 const ::com::sun::star::rendering::RenderState& rRenderState );
     164             : 
     165             :         ::PolyPolygon mapPolyPolygon( const ::basegfx::B2DPolyPolygon&                          rPoly,
     166             :                                       const ::com::sun::star::rendering::ViewState&     rViewState,
     167             :                                       const ::com::sun::star::rendering::RenderState&   rRenderState );
     168             : 
     169             :         enum ModulationMode
     170             :         {
     171             :             MODULATE_NONE,
     172             :             MODULATE_WITH_DEVICECOLOR
     173             :         };
     174             : 
     175             :         ::BitmapEx transformBitmap( const BitmapEx&                                     rBitmap,
     176             :                                     const ::basegfx::B2DHomMatrix&                      rTransform,
     177             :                                     const ::com::sun::star::uno::Sequence< double >&    rDeviceColor,
     178             :                                     ModulationMode                                      eModulationMode );
     179             : 
     180             :     }
     181             : }
     182             : 
     183             : #endif /* _VCLCANVAS_TOOLS_HXX */
     184             : 
     185             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10