LCOV - code coverage report
Current view: top level - cppcanvas/source/mtfrenderer - mtftools.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           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                 :            : #ifndef _CPPCANVAS_RENDERER_MTFTOOLS_HXX
      30                 :            : #define _CPPCANVAS_RENDERER_MTFTOOLS_HXX
      31                 :            : 
      32                 :            : #include <action.hxx>
      33                 :            : #include <cppcanvas/canvas.hxx>
      34                 :            : 
      35                 :            : 
      36                 :            : class VirtualDevice;
      37                 :            : class Size;
      38                 :            : 
      39                 :            : namespace basegfx
      40                 :            : {
      41                 :            :     class B2DVector;
      42                 :            :     class B2DPoint;
      43                 :            : }
      44                 :            : namespace com { namespace sun { namespace star { namespace rendering
      45                 :            : {
      46                 :            :     struct RenderState;
      47                 :            : } } } }
      48                 :            : 
      49                 :            : 
      50                 :            : namespace cppcanvas
      51                 :            : {
      52                 :            :     namespace internal
      53                 :            :     {
      54                 :            :         struct OutDevState;
      55                 :            :     }
      56                 :            : 
      57                 :            :     namespace tools
      58                 :            :     {
      59                 :            :         /** Init render state from OutDevState
      60                 :            : 
      61                 :            :             This method initializes the given render state object,
      62                 :            :             sets up the transformation and the clip from the
      63                 :            :             OutDevState.
      64                 :            :          */
      65                 :            :         void initRenderState( ::com::sun::star::rendering::RenderState& renderState,
      66                 :            :                               const ::cppcanvas::internal::OutDevState&         outdevState );
      67                 :            : 
      68                 :            :         /** Calc output offset relative to baseline
      69                 :            : 
      70                 :            :             The XCanvas API always renders text relative to its
      71                 :            :             baseline. This method calculates an offset in logical
      72                 :            :             coordinates, depending on the OutDevState's
      73                 :            :             textReferencePoint and the font currently set, to offset
      74                 :            :             the text from the baseline.
      75                 :            : 
      76                 :            :             @param outdevState
      77                 :            :             State to take textReferencePoint from
      78                 :            : 
      79                 :            :             @param rVDev
      80                 :            :             VDev to obtain font metrics from.
      81                 :            :          */
      82                 :            :         ::Size getBaselineOffset( const ::cppcanvas::internal::OutDevState& outdevState,
      83                 :            :                                   const VirtualDevice&                      rVDev );
      84                 :            : 
      85                 :            :         /** Construct a matrix that converts from logical to pixel
      86                 :            :             coordinate system.
      87                 :            : 
      88                 :            :             This method calculates a matrix that approximates the
      89                 :            :             VirtualDevice's LogicToPixel conversion (disregarding any
      90                 :            :             offset components, thus the 'linear' in the method name -
      91                 :            :             the returned matrix is guaranteed to be linear).
      92                 :            : 
      93                 :            :             @param o_rMatrix
      94                 :            :             This matrix will receive the calculated transform, and is
      95                 :            :             also returned from this method.
      96                 :            : 
      97                 :            :             @return the calculated transformation matrix.
      98                 :            :          */
      99                 :            :         ::basegfx::B2DHomMatrix& calcLogic2PixelLinearTransform( ::basegfx::B2DHomMatrix&   o_rMatrix,
     100                 :            :                                                                  const VirtualDevice&       rVDev );
     101                 :            : 
     102                 :            :         /** Construct a matrix that converts from logical to pixel
     103                 :            :             coordinate system.
     104                 :            : 
     105                 :            :             This method calculates a matrix that approximates the
     106                 :            :             VirtualDevice's LogicToPixel conversion.
     107                 :            : 
     108                 :            :             @param o_rMatrix
     109                 :            :             This matrix will receive the calculated transform, and is
     110                 :            :             also returned from this method.
     111                 :            : 
     112                 :            :             @return the calculated transformation matrix.
     113                 :            :          */
     114                 :            :         ::basegfx::B2DHomMatrix& calcLogic2PixelAffineTransform( ::basegfx::B2DHomMatrix&   o_rMatrix,
     115                 :            :                                                                  const VirtualDevice&       rVDev );
     116                 :            : 
     117                 :            :         /** This method modifies the clip, to cancel the given
     118                 :            :             transformation.
     119                 :            : 
     120                 :            :             As the clip is relative to the render state
     121                 :            :             transformation, offsetting or scaling the render state
     122                 :            :             must modify the clip, to keep it at the same position
     123                 :            :             relative to the primitive at hand
     124                 :            : 
     125                 :            :             @param o_rRenderState
     126                 :            :             Render state to change the clip in
     127                 :            : 
     128                 :            :             @param rOutdevState
     129                 :            :             Input state. Is used to retrieve the original clip from
     130                 :            : 
     131                 :            :             @param rOffset
     132                 :            :             The clip is offsetted by the negative of this value.
     133                 :            : 
     134                 :            :             @param pScaling
     135                 :            :             The clip is inversely scaled by this value (if given)
     136                 :            : 
     137                 :            :             @param pRotation
     138                 :            :             The clip is inversely rotated by this value (if given)
     139                 :            : 
     140                 :            :             @return true, if the clip has changed, false if not
     141                 :            :          */
     142                 :            :         bool modifyClip( ::com::sun::star::rendering::RenderState&          o_rRenderState,
     143                 :            :                          const struct ::cppcanvas::internal::OutDevState&   rOutdevState,
     144                 :            :                          const CanvasSharedPtr&                             rCanvas,
     145                 :            :                          const ::basegfx::B2DPoint&                         rOffset,
     146                 :            :                          const ::basegfx::B2DVector*                        pScaling,
     147                 :            :                          const double*                                      pRotation );
     148                 :            : 
     149                 :            :         struct TextLineInfo
     150                 :            :         {
     151                 :          0 :             TextLineInfo( const double& rLineHeight,
     152                 :            :                           const double& rOverlineHeight,
     153                 :            :                           const double& rOverlineOffset,
     154                 :            :                           const double& rUnderlineOffset,
     155                 :            :                           const double& rStrikeoutOffset,
     156                 :            :                           sal_Int8      nOverlineStyle,
     157                 :            :                           sal_Int8      nUnderlineStyle,
     158                 :            :                           sal_Int8      nStrikeoutStyle ) :
     159                 :            :                 mnLineHeight( rLineHeight ),
     160                 :            :                 mnOverlineHeight( rOverlineHeight ),
     161                 :            :                 mnOverlineOffset( rOverlineOffset ),
     162                 :            :                 mnUnderlineOffset( rUnderlineOffset ),
     163                 :            :                 mnStrikeoutOffset( rStrikeoutOffset ),
     164                 :            :                 mnOverlineStyle( nOverlineStyle ),
     165                 :            :                 mnUnderlineStyle( nUnderlineStyle ),
     166                 :          0 :                 mnStrikeoutStyle( nStrikeoutStyle )
     167                 :            :             {
     168                 :          0 :             }
     169                 :            : 
     170                 :            :             double      mnLineHeight;
     171                 :            :             double      mnOverlineHeight;
     172                 :            :             double      mnOverlineOffset;
     173                 :            :             double      mnUnderlineOffset;
     174                 :            :             double      mnStrikeoutOffset;
     175                 :            :             sal_Int8    mnOverlineStyle;
     176                 :            :             sal_Int8    mnUnderlineStyle;
     177                 :            :             sal_Int8    mnStrikeoutStyle;
     178                 :            :         };
     179                 :            : 
     180                 :            :         /** Transform given bounds to device coordinate system.
     181                 :            :          */
     182                 :            :         ::basegfx::B2DRange calcDevicePixelBounds( const ::basegfx::B2DRange&                       rBounds,
     183                 :            :                                                    const ::com::sun::star::rendering::ViewState&    viewState,
     184                 :            :                                                    const ::com::sun::star::rendering::RenderState&  renderState );
     185                 :            : 
     186                 :            :         /** Generate text underline/strikeout info struct from OutDev
     187                 :            :             state.
     188                 :            :          */
     189                 :            :         TextLineInfo createTextLineInfo( const ::VirtualDevice&                     rVDev,
     190                 :            :                                          const ::cppcanvas::internal::OutDevState&  rState );
     191                 :            : 
     192                 :            :         /** Create a poly-polygon representing the given combination
     193                 :            :             of overline, strikeout and underline.
     194                 :            : 
     195                 :            :             @param rStartOffset
     196                 :            :             Offset in X direction, where the underline starts
     197                 :            : 
     198                 :            :             @param rLineWidth
     199                 :            :             Width of the line of text to overline/strikeout/underline
     200                 :            : 
     201                 :            :             @param rTextLineInfo
     202                 :            :             Common info needed for overline/strikeout/underline generation
     203                 :            :          */
     204                 :            :         ::basegfx::B2DPolyPolygon createTextLinesPolyPolygon( const double&         rStartOffset,
     205                 :            :                                                               const double&         rLineWidth,
     206                 :            :                                                               const TextLineInfo&   rTextLineInfo );
     207                 :            : 
     208                 :            :         ::basegfx::B2DPolyPolygon createTextLinesPolyPolygon( const ::basegfx::B2DPoint rStartPos,
     209                 :            :                                                               const double&             rLineWidth,
     210                 :            :                                                               const TextLineInfo&       rTextLineInfo );
     211                 :            :     }
     212                 :            : }
     213                 :            : 
     214                 :            : #endif /* _CPPCANVAS_RENDERER_MTFTOOLS_HXX */
     215                 :            : 
     216                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10