LCOV - code coverage report
Current view: top level - oox/inc/drawingml - customshapeproperties.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 22 23 95.7 %
Date: 2015-06-13 12:38:46 Functions: 32 33 97.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_CUSTOMSHAPEPROPERTIES_HXX
      21             : #define INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
      22             : 
      23             : #include <memory>
      24             : #include <unordered_map>
      25             : #include <vector>
      26             : #include <map>
      27             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      28             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
      29             : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
      30             : #include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
      31             : #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
      32             : #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
      33             : #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
      34             : #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
      35             : #include <com/sun/star/beans/PropertyValues.hpp>
      36             : #include <com/sun/star/drawing/ProjectionMode.hpp>
      37             : #include <com/sun/star/drawing/XShape.hpp>
      38             : #include <com/sun/star/graphic/XGraphic.hpp>
      39             : #include <oox/core/xmlfilterbase.hxx>
      40             : #include <oox/drawingml/color.hxx>
      41             : #include <oox/helper/helper.hxx>
      42             : #include <oox/helper/propertymap.hxx>
      43             : #include <oox/token/tokens.hxx>
      44             : 
      45             : namespace oox { namespace drawingml {
      46             : 
      47             : class CustomShapeProperties;
      48             : 
      49             : typedef std::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr;
      50             : 
      51       45592 : struct CustomShapeGuide
      52             : {
      53             :     OUString   maName;
      54             :     OUString   maFormula;
      55             : };
      56             : 
      57        1011 : struct AdjustHandle
      58             : {
      59             :     bool                                    polar;
      60             :     com::sun::star::drawing::EnhancedCustomShapeParameterPair
      61             :                                             pos;
      62             : 
      63             :     // depending to the type (polar or not):
      64             :     OptValue< OUString >               gdRef1; // gdRefX   or gdRefR
      65             :     OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
      66             :                                             min1;   // minX     or minR
      67             :     OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
      68             :                                             max1;   // maxX     or maxR
      69             :     OptValue< OUString >               gdRef2; // gdRefY   or gdRefAng
      70             :     OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
      71             :                                             min2;   // minX     or minAng
      72             :     OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
      73             :                                             max2;   // maxY     or maxAng
      74             : 
      75         241 :     AdjustHandle( bool bPolar ) : polar( bPolar ) {};
      76             : };
      77             : 
      78        5292 : struct ConnectionSite
      79             : {
      80             :     com::sun::star::drawing::EnhancedCustomShapeParameterPair
      81             :                                 pos;
      82             :     com::sun::star::drawing::EnhancedCustomShapeParameter
      83             :                                 ang;
      84             : };
      85             : 
      86       28060 : struct GeomRect
      87             : {
      88             :     com::sun::star::drawing::EnhancedCustomShapeParameter   l;
      89             :     com::sun::star::drawing::EnhancedCustomShapeParameter   t;
      90             :     com::sun::star::drawing::EnhancedCustomShapeParameter   r;
      91             :     com::sun::star::drawing::EnhancedCustomShapeParameter   b;
      92             : };
      93             : 
      94        2283 : struct Path2D
      95             : {
      96             :     sal_Int64   w;
      97             :     sal_Int64   h;
      98             :     sal_Int32   fill;
      99             :     bool        stroke;
     100             :     bool        extrusionOk;
     101             :     std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > parameter;
     102             : 
     103         619 :     Path2D() : w( 0 ), h( 0 ), fill( XML_norm ), stroke( true ), extrusionOk( true ) {};
     104             : };
     105             : 
     106             : 
     107         339 : class CustomShapeProperties
     108             : {
     109             : public:
     110             : 
     111             :     CustomShapeProperties();
     112             :     virtual ~CustomShapeProperties();
     113             : 
     114             :     void pushToPropSet( const ::oox::core::FilterBase& rFilterBase,
     115             :             const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
     116             :                         const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape, const ::com::sun::star::awt::Size &aSize );
     117             : 
     118         132 :     sal_Int32 getShapePresetType() const { return mnShapePresetType; }
     119             :     css::uno::Sequence< sal_Int8 > getShapePresetTypeName() const;
     120        2423 :     void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; };
     121           0 :     bool                                getShapeTypeOverride(){ return mbShapeTypeOverride; };
     122         437 :     void                                setShapeTypeOverride( bool bShapeTypeOverride ) { mbShapeTypeOverride = bShapeTypeOverride; };
     123             : 
     124       12625 :     std::vector< CustomShapeGuide >&    getAdjustmentGuideList(){ return maAdjustmentGuideList; };
     125       14210 :     std::vector< CustomShapeGuide >&    getGuideList(){ return maGuideList; };
     126         458 :     std::vector< AdjustHandle >&        getAdjustHandleList(){ return maAdjustHandleList; };
     127        1804 :     std::vector< ConnectionSite >&      getConnectionSiteList(){ return maConnectionSiteList; };
     128         458 :     OptValue< GeomRect >&               getTextRect(){ return maTextRect; };
     129         458 :     std::vector< Path2D >&              getPath2DList(){ return maPath2DList; };
     130         458 :     std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; };
     131          14 :     void                                setMirroredX( bool bMirroredX ) { mbMirroredX = bMirroredX; };
     132          91 :     void                                setMirroredY( bool bMirroredY ) { mbMirroredY = bMirroredY; };
     133         749 :     void                                setTextRotateAngle( sal_Int32 nAngle ) { mnTextRotateAngle = nAngle; };
     134             : 
     135             :     static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide );
     136             :     static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const OUString& rFormulaName );
     137             : 
     138         393 :     sal_Int32 getArcNum() { return mnArcNum++; }
     139             : 
     140             : private:
     141             : 
     142             :     sal_Int32                       mnShapePresetType;
     143             :     bool                            mbShapeTypeOverride;
     144             :     std::vector< CustomShapeGuide > maAdjustmentGuideList;
     145             :     std::vector< CustomShapeGuide > maGuideList;
     146             :     std::vector< AdjustHandle >     maAdjustHandleList;
     147             :     std::vector< ConnectionSite >   maConnectionSiteList;
     148             :     OptValue< GeomRect >            maTextRect;
     149             :     std::vector< Path2D >           maPath2DList;
     150             : 
     151             :     std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >
     152             :                                     maSegments;
     153             :     bool                            mbMirroredX;
     154             :     bool                            mbMirroredY;
     155             :     sal_Int32                       mnTextRotateAngle;
     156             : 
     157             :     typedef std::unordered_map< sal_Int32, PropertyMap > PresetDataMap;
     158             : 
     159             :     static PresetDataMap maPresetDataMap;
     160             :     static void initializePresetDataMap();
     161             : 
     162             :     sal_Int32 mnArcNum;
     163             : };
     164             : 
     165             : } }
     166             : 
     167             : #endif // INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
     168             : 
     169             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11