LCOV - code coverage report
Current view: top level - include/oox/vml - vmlformatting.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 5 0.0 %
Date: 2014-04-14 Functions: 0 7 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_OOX_VML_VMLFORMATTING_HXX
      21             : #define INCLUDED_OOX_VML_VMLFORMATTING_HXX
      22             : 
      23             : #include <oox/helper/helper.hxx>
      24             : #include <oox/dllapi.h>
      25             : #include <com/sun/star/awt/Point.hpp>
      26             : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      27             : #include <com/sun/star/drawing/XShape.hpp>
      28             : 
      29             : #include <vector>
      30             : 
      31             : namespace oox {
      32             :     class GraphicHelper;
      33             :     namespace drawingml { class Color; }
      34             :     namespace drawingml { class ShapePropertyMap; }
      35             : }
      36             : 
      37             : namespace oox {
      38             : namespace vml {
      39             : 
      40             : 
      41             : 
      42             : typedef ::std::pair< sal_Int32, sal_Int32 > Int32Pair;
      43             : typedef ::std::pair< double, double >       DoublePair;
      44             : 
      45             : 
      46             : 
      47             : class OOX_DLLPUBLIC ConversionHelper
      48             : {
      49             : public:
      50             :     /** Returns two values contained in rValue separated by cSep.
      51             :      */
      52             :     static bool         separatePair(
      53             :                             OUString& orValue1, OUString& orValue2,
      54             :                             const OUString& rValue, sal_Unicode cSep );
      55             : 
      56             :     /** Returns the boolean value from the passed string of a VML attribute.
      57             :         Supported values: 'f', 't', 'false', 'true'. False for anything else.
      58             :      */
      59             :     static bool         decodeBool( const OUString& rValue );
      60             : 
      61             :     /** Converts the passed VML percentage measure string to a normalized
      62             :         floating-point value.
      63             : 
      64             :         @param rValue  The VML percentage value. This is a floating-point value
      65             :             with optional following '%' or 'f' sign. If the sign is missing, the
      66             :             floating point value will be returned unmodified. If the '%' sign
      67             :             is present, the value will be divided by 100. If the 'f' sign is present,
      68             :             the value will be divided by 65536.
      69             :      */
      70             :     static double       decodePercent(
      71             :                             const OUString& rValue,
      72             :                             double fDefValue );
      73             : 
      74             :     /** Converts the passed VML measure string to EMU (English Metric Units).
      75             : 
      76             :         @param rGraphicHelper  The graphic helper needed to perform pixel
      77             :             conversion according to the current output device.
      78             : 
      79             :         @param rValue  The VML measure value. This is a floating-point value
      80             :             with optional measure string following the value.
      81             : 
      82             :         @param nRefValue  Reference value needed for percentage measure.
      83             : 
      84             :         @param bPixelX  Set to true if the value is oriented horizontally (e.g.
      85             :             X coordinates, widths). Set to false if the value is oriented
      86             :             vertically (e.g. Y coordinates, heights). This is needed because
      87             :             output devices may specify different width and height for a pixel.
      88             : 
      89             :         @param bDefaultAsPixel  Set to true if omitted measure unit means
      90             :             pixel. Set to false if omitted measure unit means EMU.
      91             :      */
      92             :     static sal_Int64    decodeMeasureToEmu(
      93             :                             const GraphicHelper& rGraphicHelper,
      94             :                             const OUString& rValue,
      95             :                             sal_Int32 nRefValue,
      96             :                             bool bPixelX,
      97             :                             bool bDefaultAsPixel );
      98             : 
      99             :     /** Converts the passed VML measure string to 1/100 mm.
     100             : 
     101             :         @param rGraphicHelper  See above.
     102             :         @param rValue  See above.
     103             :         @param nRefValue  See above.
     104             :         @param bPixelX  See above.
     105             :         @param bDefaultAsPixel  See above.
     106             :      */
     107             :     static sal_Int32    decodeMeasureToHmm(
     108             :                             const GraphicHelper& rGraphicHelper,
     109             :                             const OUString& rValue,
     110             :                             sal_Int32 nRefValue,
     111             :                             bool bPixelX,
     112             :                             bool bDefaultAsPixel );
     113             : 
     114             :     /** Converts VML color attributes to a DrawingML color.
     115             : 
     116             :         @param roVmlColor  The VML string representation of the color. If
     117             :             existing, this can be a 3-digit or 6-digit hexadecimal RGB value
     118             :             with leading '#' character, a predefined color name (e.g. 'black',
     119             :             'red', etc.), the index into an application defined color palette
     120             :             in brackets with leading color name (e.g. 'red [9]' or
     121             :             'windowColor [64]'), or a color modifier used in one-color
     122             :             gradients (e.g. 'fill darken(128)' or 'fill lighten(0)').
     123             : 
     124             :         @param roVmlOpacity  The opacity of the color. If existing, this should
     125             :             be a floating-point value in the range [0.0;1.0].
     126             : 
     127             :         @param nDefaultRgb  Deafult RGB color used if the parameter roVmlColor
     128             :             is empty.
     129             : 
     130             :         @param nPrimaryRgb  If set to something else than API_RGB_TRANSPARENT,
     131             :             specifies the color to be used to resolve the color modifiers used
     132             :             in one-color gradients.
     133             : 
     134             :         @return  The resulting DrawingML color.
     135             :      */
     136             :     static ::oox::drawingml::Color decodeColor(
     137             :                             const GraphicHelper& rGraphicHelper,
     138             :                             const OptValue< OUString >& roVmlColor,
     139             :                             const OptValue< double >& roVmlOpacity,
     140             :                             sal_Int32 nDefaultRgb,
     141             :                             sal_Int32 nPrimaryRgb = API_RGB_TRANSPARENT );
     142             : 
     143             :     /** Converts VML path string into point and flag vectors.
     144             : 
     145             :         @param rPoints  The point vector to fill with coordinates.
     146             : 
     147             :         @param rFlags  The flag vector to fill. PolygonFlags_NORMAL indicates
     148             :             a corresponding plain shape coordinate in rPoints and
     149             :             PolygonFlags_CONTROL indicates a bezier curve control point.
     150             : 
     151             :         @param rPath  The VML path string.
     152             : 
     153             :         @param rGraphicHelper  See above.
     154             :     */
     155             :     static void         decodeVmlPath(
     156             :                             ::std::vector< ::std::vector< ::com::sun::star::awt::Point > >& rPoints,
     157             :                             ::std::vector< ::std::vector< ::com::sun::star::drawing::PolygonFlags > >& rFlags,
     158             :                             const OUString& rPath );
     159             : 
     160             : private:
     161             :                         ConversionHelper();
     162             :                         ~ConversionHelper();
     163             : };
     164             : 
     165             : 
     166             : 
     167             : /** The stroke arrow model structure contains all properties for an line end arrow. */
     168           0 : struct StrokeArrowModel
     169             : {
     170             :     OptValue< sal_Int32 > moArrowType;
     171             :     OptValue< sal_Int32 > moArrowWidth;
     172             :     OptValue< sal_Int32 > moArrowLength;
     173             : 
     174             :     void                assignUsed( const StrokeArrowModel& rSource );
     175             : };
     176             : 
     177             : 
     178             : 
     179             : /** The stroke model structure contains all shape border properties. */
     180           0 : struct StrokeModel
     181             : {
     182             :     OptValue< bool >    moStroked;              ///< Shape border line on/off.
     183             :     StrokeArrowModel    maStartArrow;           ///< Start line arrow style.
     184             :     StrokeArrowModel    maEndArrow;             ///< End line arrow style.
     185             :     OptValue< OUString > moColor;        ///< Solid line color.
     186             :     OptValue< double > moOpacity;               ///< Solid line color opacity.
     187             :     OptValue< OUString > moWeight;       ///< Line width.
     188             :     OptValue< OUString > moDashStyle;    ///< Line dash (predefined or manually).
     189             :     OptValue< sal_Int32 > moLineStyle;          ///< Line style (single, double, ...).
     190             :     OptValue< sal_Int32 > moEndCap;             ///< Type of line end cap.
     191             :     OptValue< sal_Int32 > moJoinStyle;          ///< Type of line join.
     192             : 
     193             :     void                assignUsed( const StrokeModel& rSource );
     194             : 
     195             :     /** Writes the properties to the passed property map. */
     196             :     void                pushToPropMap(
     197             :                             ::oox::drawingml::ShapePropertyMap& rPropMap,
     198             :                             const GraphicHelper& rGraphicHelper ) const;
     199             : };
     200             : 
     201             : 
     202             : 
     203             : /** The fill model structure contains all shape fill properties. */
     204           0 : struct OOX_DLLPUBLIC FillModel
     205             : {
     206             :     OptValue< bool >    moFilled;               ///< Shape fill on/off.
     207             :     OptValue< OUString > moColor;        ///< Solid fill color.
     208             :     OptValue< double >  moOpacity;              ///< Solid fill color opacity.
     209             :     OptValue< OUString > moColor2;       ///< End color of gradient.
     210             :     OptValue< double >  moOpacity2;             ///< End color opacity of gradient.
     211             :     OptValue< sal_Int32 > moType;               ///< Fill type.
     212             :     OptValue< sal_Int32 > moAngle;              ///< Gradient rotation angle.
     213             :     OptValue< double >  moFocus;                ///< Linear gradient focus of second color.
     214             :     OptValue< DoublePair > moFocusPos;          ///< Rectangular gradient focus position of second color.
     215             :     OptValue< DoublePair > moFocusSize;         ///< Rectangular gradient focus size of second color.
     216             :     OptValue< OUString > moBitmapPath;   ///< Path to fill bitmap fragment.
     217             :     OptValue< bool >    moRotate;               ///< True = rotate gradient/bitmap with shape.
     218             : 
     219             :     void                assignUsed( const FillModel& rSource );
     220             : 
     221             :     /** Writes the properties to the passed property map. */
     222             :     void                pushToPropMap(
     223             :                             ::oox::drawingml::ShapePropertyMap& rPropMap,
     224             :                             const GraphicHelper& rGraphicHelper ) const;
     225             : };
     226             : 
     227             : 
     228             : 
     229             : /** The shadow model structure contains all shape shadow properties. */
     230           0 : struct OOX_DLLPUBLIC ShadowModel
     231             : {
     232             :     bool               mbHasShadow;               ///< Is a v:shadow element seen?
     233             :     OptValue<bool>     moShadowOn;                ///< Is the element turned on?
     234             :     OptValue<OUString> moColor;                   ///< Specifies the color of the shadow.
     235             :     OptValue<OUString> moOffset;                  ///< Specifies the shadow's offset from the shape's location.
     236             :     OptValue<double>   moOpacity;                 ///< Specifies the opacity of the shadow.
     237             : 
     238             :     ShadowModel();
     239             : 
     240             :     /** Writes the properties to the passed property map. */
     241             :     void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper) const;
     242             : };
     243             : 
     244             : /** The shadow model structure contains all shape textpath properties. */
     245           0 : struct OOX_DLLPUBLIC TextpathModel
     246             : {
     247             :     OptValue<OUString> moString;                  ///< Specifies the string of the textpath.
     248             : 
     249             :     TextpathModel();
     250             : 
     251             :     /** Writes the properties to the passed property map. */
     252             :     void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, com::sun::star::uno::Reference<com::sun::star::drawing::XShape> xShape) const;
     253             : };
     254             : 
     255             : } // namespace vml
     256             : } // namespace oox
     257             : 
     258             : #endif
     259             : 
     260             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10