LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/oox/drawingml - customshapeproperties.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 22 54.5 %
Date: 2012-12-27 Functions: 15 33 45.5 %
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 OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
      21             : #define 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             :     rtl::OUString   maName;
      54             :     rtl::OUString   maFormula;
      55             : };
      56             : 
      57           0 : struct AdjustHandle
      58             : {
      59             :     sal_Bool                                polar;
      60             :     com::sun::star::drawing::EnhancedCustomShapeParameterPair
      61             :                                             pos;
      62             : 
      63             :     // depending to the type (polar or not):
      64             :     OptValue< rtl::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< rtl::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( sal_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         568 : 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             :     sal_Bool    stroke;
     100             :     sal_Bool    extrusionOk;
     101             :     std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > parameter;
     102             : 
     103           0 :     Path2D() : w( 0 ), h( 0 ), fill( XML_norm ), stroke( sal_True ), extrusionOk( sal_True ) {};
     104             : };
     105             : 
     106             : 
     107         558 : 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          18 : 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);
     134             : 
     135             :     sal_Int32 getShapePresetType() const { return mnShapePresetType; }
     136             :     ::rtl::OUString getShapePresetTypeName() const;
     137          50 :     void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; };
     138             : 
     139          52 :     std::vector< CustomShapeGuide >&    getAdjustmentGuideList(){ return maAdjustmentGuideList; };
     140           2 :     std::vector< CustomShapeGuide >&    getGuideList(){ return maGuideList; };
     141           2 :     std::vector< AdjustHandle >&        getAdjustHandleList(){ return maAdjustHandleList; };
     142           0 :     std::vector< ConnectionSite >&      getConnectionSiteList(){ return maConnectionSiteList; };
     143           2 :     OptValue< GeomRect >&               getTextRect(){ return maTextRect; };
     144           2 :     std::vector< Path2D >&              getPath2DList(){ return maPath2DList; };
     145           2 :     std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; };
     146           2 :     void                                setMirroredX( sal_Bool bMirroredX ) { mbMirroredX = bMirroredX; };
     147           0 :     void                                setMirroredY( sal_Bool bMirroredY ) { mbMirroredY = bMirroredY; };
     148           5 :     void                                setTextRotateAngle( sal_Int32 nAngle ) { mnTextRotateAngle = nAngle; };
     149             : 
     150             :     static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide );
     151             :     static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const rtl::OUString& rFormulaName );
     152             : 
     153           0 :     sal_Int32 getArcNum() { return mnArcNum++; }
     154             : 
     155             : private:
     156             : 
     157             :     sal_Int32                       mnShapePresetType;
     158             :     std::vector< CustomShapeGuide > maAdjustmentGuideList;
     159             :     std::vector< CustomShapeGuide > maGuideList;
     160             :     std::vector< AdjustHandle >     maAdjustHandleList;
     161             :     std::vector< ConnectionSite >   maConnectionSiteList;
     162             :     OptValue< GeomRect >            maTextRect;
     163             :     std::vector< Path2D >           maPath2DList;
     164             : 
     165             :     std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >
     166             :                                     maSegments;
     167             :     sal_Bool                        mbMirroredX;
     168             :     sal_Bool                        mbMirroredY;
     169             :     sal_Int32                       mnTextRotateAngle;
     170             : 
     171             :     typedef boost::unordered_map< sal_Int32, CustomShapeProvider * > PresetsMap;
     172             : 
     173             :     static PresetsMap maPresetsMap;
     174             :     static void initializePresetsMap();
     175             :     static void initializePresetsMap1();
     176             :     static void initializePresetsMap2();
     177             :     static void initializePresetsMap3();
     178             :     static void initializePresetsMap4();
     179             :     static void initializePresetsMap5();
     180             :     static void initializePresetsMap6();
     181             : 
     182             :     sal_Int32 mnArcNum;
     183             : };
     184             : 
     185             : } }
     186             : 
     187             : #endif  //  OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
     188             : 
     189             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10