LCOV - code coverage report
Current view: top level - include/oox/drawingml - customshapeproperties.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 24 0.0 %
Date: 2014-04-14 Functions: 0 35 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_CUSTOMSHAPEPROPERTIES_HXX
      21             : #define INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
      22             : 
      23             : #include <boost/shared_ptr.hpp>
      24             : #include <boost/unordered_map.hpp>
      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 boost::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr;
      50             : 
      51           0 : struct CustomShapeGuide
      52             : {
      53             :     OUString   maName;
      54             :     OUString   maFormula;
      55             : };
      56             : 
      57           0 : 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           0 :     AdjustHandle( bool bPolar ) : polar( bPolar ) {};
      76             : };
      77             : 
      78           0 : struct ConnectionSite
      79             : {
      80             :     com::sun::star::drawing::EnhancedCustomShapeParameterPair
      81             :                                 pos;
      82             :     com::sun::star::drawing::EnhancedCustomShapeParameter
      83             :                                 ang;
      84             : };
      85             : 
      86           0 : 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           0 : 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           0 :     Path2D() : w( 0 ), h( 0 ), fill( XML_norm ), stroke( true ), extrusionOk( true ) {};
     104             : };
     105             : 
     106             : 
     107           0 : class CustomShapeProvider {
     108             : protected:
     109             :     struct ParameterPairData {
     110             :         sal_uInt16 nFirstType;
     111             :         sal_uInt16 nSecondType;
     112             :         sal_uInt32 nFirstValue;
     113             :         sal_uInt32 nSecondValue;
     114             :     };
     115             :     static com::sun::star::uno::Any createStringSequence( size_t nStrings, const char **pStrings );
     116             :     static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > createSegmentSequence( size_t nElems, const sal_uInt16 *pValues );
     117             :     static com::sun::star::drawing::EnhancedCustomShapeParameterPair createParameterPair( const ParameterPairData *pData );
     118             :     static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > createParameterPairSequence( size_t nElems, const ParameterPairData *pData );
     119             : public:
     120           0 :     virtual ~CustomShapeProvider() {}
     121             :     virtual PropertyMap getProperties() = 0;
     122             : };
     123             : 
     124           0 : class CustomShapeProperties
     125             : {
     126             : public:
     127             : 
     128             :     CustomShapeProperties();
     129             :     virtual ~CustomShapeProperties();
     130             : 
     131             :     void pushToPropSet( const ::oox::core::FilterBase& rFilterBase,
     132             :             const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
     133             :                         const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape, const ::com::sun::star::awt::Size &aSize );
     134             : 
     135             :     sal_Int32 getShapePresetType() const { return mnShapePresetType; }
     136             :     OUString getShapePresetTypeName() const;
     137           0 :     void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; };
     138           0 :     bool                                getShapeTypeOverride(){ return mbShapeTypeOverride; };
     139           0 :     void                                setShapeTypeOverride( bool bShapeTypeOverride ) { mbShapeTypeOverride = bShapeTypeOverride; };
     140             : 
     141           0 :     std::vector< CustomShapeGuide >&    getAdjustmentGuideList(){ return maAdjustmentGuideList; };
     142           0 :     std::vector< CustomShapeGuide >&    getGuideList(){ return maGuideList; };
     143           0 :     std::vector< AdjustHandle >&        getAdjustHandleList(){ return maAdjustHandleList; };
     144           0 :     std::vector< ConnectionSite >&      getConnectionSiteList(){ return maConnectionSiteList; };
     145           0 :     OptValue< GeomRect >&               getTextRect(){ return maTextRect; };
     146           0 :     std::vector< Path2D >&              getPath2DList(){ return maPath2DList; };
     147           0 :     std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; };
     148           0 :     void                                setMirroredX( bool bMirroredX ) { mbMirroredX = bMirroredX; };
     149           0 :     void                                setMirroredY( bool bMirroredY ) { mbMirroredY = bMirroredY; };
     150           0 :     void                                setTextRotateAngle( sal_Int32 nAngle ) { mnTextRotateAngle = nAngle; };
     151             : 
     152             :     static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide );
     153             :     static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const OUString& rFormulaName );
     154             : 
     155           0 :     sal_Int32 getArcNum() { return mnArcNum++; }
     156             : 
     157             : private:
     158             : 
     159             :     sal_Int32                       mnShapePresetType;
     160             :     bool                            mbShapeTypeOverride;
     161             :     std::vector< CustomShapeGuide > maAdjustmentGuideList;
     162             :     std::vector< CustomShapeGuide > maGuideList;
     163             :     std::vector< AdjustHandle >     maAdjustHandleList;
     164             :     std::vector< ConnectionSite >   maConnectionSiteList;
     165             :     OptValue< GeomRect >            maTextRect;
     166             :     std::vector< Path2D >           maPath2DList;
     167             : 
     168             :     std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >
     169             :                                     maSegments;
     170             :     bool                            mbMirroredX;
     171             :     bool                            mbMirroredY;
     172             :     sal_Int32                       mnTextRotateAngle;
     173             : 
     174             :     typedef boost::unordered_map< sal_Int32, CustomShapeProvider * > PresetsMap;
     175             : 
     176             :     static PresetsMap maPresetsMap;
     177             :     static void initializePresetsMap();
     178             :     static void initializePresetsMap1();
     179             :     static void initializePresetsMap2();
     180             :     static void initializePresetsMap3();
     181             :     static void initializePresetsMap4();
     182             :     static void initializePresetsMap5();
     183             :     static void initializePresetsMap6();
     184             : 
     185             :     sal_Int32 mnArcNum;
     186             : };
     187             : 
     188             : } }
     189             : 
     190             : #endif // INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10