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

Generated by: LCOV version 1.11