LCOV - code coverage report
Current view: top level - include/oox/drawingml - shapepropertymap.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 6 0.0 %
Date: 2014-04-14 Functions: 0 18 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_DRAWINGML_SHAPEPROPERTYMAP_HXX
      21             : #define INCLUDED_OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
      22             : 
      23             : #include <oox/helper/propertymap.hxx>
      24             : #include <oox/dllapi.h>
      25             : 
      26             : #include <vector>
      27             : 
      28             : namespace oox { class ModelObjectHelper; }
      29             : 
      30             : namespace oox {
      31             : namespace drawingml {
      32             : 
      33             : 
      34             : 
      35             : /** Enumeration for various properties related to drawing shape formatting.
      36             : 
      37             :     This is an abstraction for shape formatting properties that have different
      38             :     names in various implementations, e.g. drawing shapes vs. chart objects.
      39             :  */
      40             : enum ShapePropertyId
      41             : {
      42             :     SHAPEPROP_LineStyle,
      43             :     SHAPEPROP_LineWidth,
      44             :     SHAPEPROP_LineColor,
      45             :     SHAPEPROP_LineTransparency,
      46             :     SHAPEPROP_LineDash,                     /// Explicit line dash or name of a line dash stored in a global container.
      47             :     SHAPEPROP_LineJoint,
      48             :     SHAPEPROP_LineStart,                    /// Explicit line start marker or name of a line marker stored in a global container.
      49             :     SHAPEPROP_LineStartWidth,
      50             :     SHAPEPROP_LineStartCenter,
      51             :     SHAPEPROP_LineEnd,                      /// Explicit line end marker or name of a line marker stored in a global container.
      52             :     SHAPEPROP_LineEndWidth,
      53             :     SHAPEPROP_LineEndCenter,
      54             :     SHAPEPROP_FillStyle,
      55             :     SHAPEPROP_FillColor,
      56             :     SHAPEPROP_FillTransparency,
      57             :     SHAPEPROP_GradientTransparency,
      58             :     SHAPEPROP_FillGradient,                 /// Explicit fill gradient or name of a fill gradient stored in a global container.
      59             :     SHAPEPROP_FillBitmapUrl,                /// Explicit fill bitmap URL or name of a fill bitmap URL stored in a global container.
      60             :     SHAPEPROP_FillBitmapMode,
      61             :     SHAPEPROP_FillBitmapSizeX,
      62             :     SHAPEPROP_FillBitmapSizeY,
      63             :     SHAPEPROP_FillBitmapOffsetX,
      64             :     SHAPEPROP_FillBitmapOffsetY,
      65             :     SHAPEPROP_FillBitmapRectanglePoint,
      66             :     SHAPEPROP_FillHatch,
      67             :     SHAPEPROP_ShadowXDistance,
      68             :     SHAPEPROP_FillBitmapNameFromUrl,
      69             :     SHAPEPROP_END
      70             : };
      71             : 
      72             : 
      73             : 
      74           0 : struct OOX_DLLPUBLIC ShapePropertyInfo
      75             : {
      76             :     std::vector<sal_Int32> maPropertyIds;
      77             :     bool                mbNamedLineMarker;      /// True = use named line marker instead of explicit line marker.
      78             :     bool                mbNamedLineDash;        /// True = use named line dash instead of explicit line dash.
      79             :     bool                mbNamedFillGradient;    /// True = use named fill gradient instead of explicit fill gradient.
      80             :     bool                mbNamedFillBitmapUrl;   /// True = use named fill bitmap URL instead of explicit fill bitmap URL.
      81             : 
      82             :     static ShapePropertyInfo DEFAULT;           /// Default property info (used as default parameter of other methods).
      83             : 
      84             :     explicit            ShapePropertyInfo(
      85             :                             const sal_Int32* pnPropertyIds,
      86             :                             bool bNamedLineMarker,
      87             :                             bool bNamedLineDash,
      88             :                             bool bNamedFillGradient,
      89             :                             bool bNamedFillBitmapUrl );
      90             : 
      91           0 :     bool         has( ShapePropertyId ePropId ) const { return maPropertyIds.size() > size_t(ePropId) && maPropertyIds[ ePropId ] >= 0; }
      92           0 :     sal_Int32    operator[]( ShapePropertyId ePropId ) const { return maPropertyIds[ ePropId ]; }
      93             : };
      94             : 
      95             : 
      96             : 
      97           0 : class OOX_DLLPUBLIC ShapePropertyMap : public PropertyMap
      98             : {
      99             : public:
     100             :     explicit            ShapePropertyMap(
     101             :                             ModelObjectHelper& rModelObjHelper,
     102             :                             const ShapePropertyInfo& rShapePropInfo = ShapePropertyInfo::DEFAULT );
     103             : 
     104             :     /** Returns true, if the specified property is supported. */
     105             :     bool                supportsProperty( ShapePropertyId ePropId ) const;
     106             : 
     107             :     /** Returns true, if named line markers are supported, and the specified
     108             :         line marker has already been inserted into the marker table. */
     109             :     bool                hasNamedLineMarkerInTable( const OUString& rMarkerName ) const;
     110             : 
     111             :     /** Sets the specified shape property to the passed value. */
     112             :     bool                setAnyProperty( ShapePropertyId ePropId, const ::com::sun::star::uno::Any& rValue );
     113             : 
     114             :     /** Sets the specified shape property to the passed value. */
     115             :     template< typename Type >
     116           0 :     bool         setProperty( ShapePropertyId ePropId, const Type& rValue )
     117           0 :                             { return setAnyProperty( ePropId, ::com::sun::star::uno::Any( rValue ) ); }
     118             : 
     119             :     using PropertyMap::setAnyProperty;
     120             :     using PropertyMap::setProperty;
     121             : 
     122             : private:
     123             :     /** Sets an explicit line marker, or creates a named line marker. */
     124             :     bool                setLineMarker( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
     125             :     /** Sets an explicit line dash, or creates a named line dash. */
     126             :     bool                setLineDash( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
     127             :     /** Sets an explicit fill gradient, or creates a named fill gradient. */
     128             :     bool                setFillGradient( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
     129             :     /** Creates a named transparency gradient. */
     130             :     bool                setGradientTrans( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
     131             :     /** Sets an explicit fill bitmap URL, or creates a named fill bitmap URL. */
     132             :     bool                setFillBitmapUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
     133             :     /** Sets an explicit fill bitmap URL and pushes the name to FillBitmapName */
     134             :     bool                setFillBitmapNameFromUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
     135             : 
     136             :     // not implemented, to prevent implicit conversion from enum to int
     137             :     ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId );
     138             :     const ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId ) const;
     139             : 
     140             : private:
     141             :     ModelObjectHelper&  mrModelObjHelper;
     142             :     ShapePropertyInfo   maShapePropInfo;
     143             : };
     144             : 
     145             : 
     146             : 
     147             : } // namespace drawingml
     148             : } // namespace oox
     149             : 
     150             : #endif
     151             : 
     152             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10