LCOV - code coverage report
Current view: top level - libreoffice/svx/inc/svx - EnhancedCustomShape2d.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 6 0.0 %
Date: 2012-12-27 Functions: 0 5 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 _ENHANCEDCUSTOMSHAPE2D_HXX
      21             : #define _ENHANCEDCUSTOMSHAPE2D_HXX
      22             : 
      23             : #include <svx/msdffdef.hxx>
      24             : #include <svx/sdasitm.hxx>
      25             : #include <com/sun/star/uno/Sequence.h>
      26             : #include <com/sun/star/beans/PropertyValues.hpp>
      27             : #include <com/sun/star/awt/Point.hpp>
      28             : #include <com/sun/star/awt/Size.hpp>
      29             : #include <svl/itemset.hxx>
      30             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      31             : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
      32             : #include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
      33             : #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
      34             : #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
      35             : #include <svx/EnhancedCustomShapeFunctionParser.hxx>
      36             : 
      37             : #include <boost/shared_ptr.hpp>
      38             : #include <vector>
      39             : 
      40             : #define DFF_CUSTOMSHAPE_FLIP_V      1
      41             : #define DFF_CUSTOMSHAPE_FLIP_H      2
      42             : #define DFF_CUSTOMSHAPE_EXCH            4
      43             : 
      44             : class SdrModel;
      45             : class SdrObject;
      46             : class SfxItemSet;
      47             : struct SvxMSDffVertPair;
      48             : struct SvxMSDffCalculationData;
      49             : struct SvxMSDffTextRectangles;
      50             : 
      51             : #define HANDLE_FLAGS_MIRRORED_X             0x0001
      52             : #define HANDLE_FLAGS_MIRRORED_Y             0x0002
      53             : #define HANDLE_FLAGS_SWITCHED               0x0004
      54             : #define HANDLE_FLAGS_POLAR                  0x0008
      55             : #define HANDLE_FLAGS_MAP                    0x0010
      56             : #define HANDLE_FLAGS_RANGE_X_MINIMUM        0x0020
      57             : #define HANDLE_FLAGS_RANGE_X_MAXIMUM        0x0040
      58             : #define HANDLE_FLAGS_RANGE_Y_MINIMUM        0x0080
      59             : #define HANDLE_FLAGS_RANGE_Y_MAXIMUM        0x0100
      60             : #define HANDLE_FLAGS_RADIUS_RANGE_MINIMUM   0x0200
      61             : #define HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM   0x0400
      62             : #define HANDLE_FLAGS_REFX                   0x0800
      63             : #define HANDLE_FLAGS_REFY                   0x1000
      64             : #define HANDLE_FLAGS_REFANGLE               0x2000
      65             : #define HANDLE_FLAGS_REFR                   0x4000
      66             : 
      67             : // MSDFF_HANDLE_FLAGS_RANGE_Y seems to be not defined in
      68             : // escher, but we are using it internally in to differentiate
      69             : // between X_RANGE and Y_RANGE
      70             : 
      71             : class SdrPathObj;
      72             : 
      73             : class EnhancedCustomShape2d : public SfxItemSet
      74             : {
      75             :         SdrObject*                  pCustomShapeObj;
      76             :         MSO_SPT                     eSpType;
      77             : 
      78             :         sal_Int32                   nCoordLeft;
      79             :         sal_Int32                   nCoordTop;
      80             :         sal_Int32                   nCoordWidthG;
      81             :         sal_Int32                   nCoordHeightG;
      82             :         sal_Int32                   nCoordWidth;
      83             :         sal_Int32                   nCoordHeight;
      84             :         Rectangle                   aLogicRect;
      85             : 
      86             :         double                      fXScale;
      87             :         double                      fYScale;
      88             :         double                      fXRatio;
      89             :         double                      fYRatio;
      90             : 
      91             :         sal_Bool                    bOOXMLShape;
      92             : 
      93             :         sal_Int32                   nXRef;
      94             :         sal_Int32                   nYRef;
      95             :         sal_uInt32                  nFlags;
      96             :         sal_uInt32                  nColorData;
      97             : 
      98             :         /*
      99             : 
     100             :         */
     101             :         struct EquationResult {
     102             :             sal_Bool bReady;
     103             :             double fValue;
     104             :         };
     105             :         com::sun::star::uno::Sequence< rtl::OUString >                                                  seqEquations;
     106             :         std::vector< ::boost::shared_ptr< EnhancedCustomShape::ExpressionNode > >                       vNodesSharedPtr;
     107             :         std::vector< EquationResult >                                                                   vEquationResults;
     108             : 
     109             :         com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment >            seqSegments;
     110             :         com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair>       seqCoordinates;
     111             :         com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame >          seqTextFrames;
     112             :         com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair>       seqGluePoints;
     113             :         com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >    seqAdjustmentValues;
     114             :         com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValues >                          seqHandles;
     115             :         com::sun::star::uno::Sequence< com::sun::star::awt::Size >                                      seqSubViewSize;
     116             : 
     117             :         sal_Bool                    bTextFlow       : 1;
     118             :         sal_Bool                    bFilled         : 1;
     119             :         sal_Bool                    bStroked        : 1;
     120             : 
     121             :         sal_Bool                    bFlipH;
     122             :         sal_Bool                    bFlipV;
     123             :         sal_Int32                   nRotateAngle;
     124             : 
     125             :         sal_Bool                    SetAdjustValueAsDouble( const double& rValue, const sal_Int32 nIndex );
     126             :         sal_Int32                   GetLuminanceChange( sal_uInt32 nIndex ) const;
     127             :         Color                       GetColorData( const Color& rFillColor, sal_uInt32 nIndex, double dBrightness ) const;
     128             :         void                        AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rCustomShapeSet,
     129             :                                                   sal_uInt32& nColorIndex, sal_uInt32 nColorCount);
     130             :         sal_Bool                    GetParameter( double& rParameterReturnValue,  const com::sun::star::drawing::EnhancedCustomShapeParameter&,
     131             :                                                   const sal_Bool bReplaceGeoWidth, const sal_Bool bReplaceGeoHeight ) const;
     132             :         Point                       GetPoint( const com::sun::star::drawing::EnhancedCustomShapeParameterPair&,
     133             :                                                     const sal_Bool bScale = sal_True, const sal_Bool bReplaceGeoSize = sal_False ) const;
     134             : 
     135             :         void                        CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegmentInd, std::vector< SdrPathObj* >& rObjectList,
     136             :                                                    sal_Bool bLineGeometryNeededOnly, sal_Bool bSortFilledObjectsToBack,
     137             :                                                    sal_Int32 nIndex );
     138             :         SdrObject*                  CreatePathObj( sal_Bool bLineGeometryNeededOnly );
     139             :         const sal_Int32*            ApplyShapeAttributes( const SdrCustomShapeGeometryItem& rItem );
     140             : 
     141             :         void                        SetPathSize( sal_Int32 nIndex = 0 );
     142             : 
     143             :     public :
     144             : 
     145           0 :         struct Handle
     146             :         {
     147             :             sal_uInt32  nFlags;
     148             : 
     149             :             sal_Bool    bMirroredX;
     150             :             sal_Bool    bMirroredY;
     151             :             sal_Bool    bSwitched;
     152             : 
     153             :             com::sun::star::drawing::EnhancedCustomShapeParameterPair   aPosition;
     154             :             com::sun::star::drawing::EnhancedCustomShapeParameterPair   aPolar;
     155             : 
     156             :             sal_Int32   nRefX;
     157             :             sal_Int32   nRefY;
     158             :             sal_Int32   nRefAngle;
     159             :             sal_Int32   nRefR;
     160             : 
     161             :             com::sun::star::drawing::EnhancedCustomShapeParameter       aRadiusRangeMinimum;
     162             :             com::sun::star::drawing::EnhancedCustomShapeParameter       aRadiusRangeMaximum;
     163             :             com::sun::star::drawing::EnhancedCustomShapeParameter       aXRangeMinimum;
     164             :             com::sun::star::drawing::EnhancedCustomShapeParameter       aXRangeMaximum;
     165             :             com::sun::star::drawing::EnhancedCustomShapeParameter       aYRangeMinimum;
     166             :             com::sun::star::drawing::EnhancedCustomShapeParameter       aYRangeMaximum;
     167             : 
     168           0 :             Handle() : bMirroredX ( sal_False ), bMirroredY ( sal_False ), bSwitched( sal_False ),
     169           0 :                 nRefX( -1 ), nRefY( -1 ), nRefAngle( -1 ), nRefR( -1 ) {};
     170             :         };
     171             : 
     172           0 :         sal_Bool                    IsFlipVert() { return bFlipV; };
     173           0 :         sal_Bool                    IsFlipHorz() { return bFlipH; };
     174           0 :         sal_Int32                   GetRotateAngle() { return nRotateAngle; };
     175             :         SVX_DLLPUBLIC bool          IsPostRotate() const;
     176             : 
     177             :         SVX_DLLPUBLIC SdrObject*                    CreateLineGeometry();
     178             :         SVX_DLLPUBLIC SdrObject*                    CreateObject( sal_Bool bLineGeometryNeededOnly );
     179             :         SVX_DLLPUBLIC void                      ApplyGluePoints( SdrObject* pObj );
     180             :         SVX_DLLPUBLIC Rectangle                 GetTextRect() const;
     181             : 
     182             :         SVX_DLLPUBLIC sal_uInt32                    GetHdlCount() const;
     183             :         SVX_DLLPUBLIC sal_Bool                  GetHandlePosition( const sal_uInt32 nIndex, Point& rReturnPosition ) const;
     184             :         SVX_DLLPUBLIC sal_Bool                  SetHandleControllerPosition( const sal_uInt32 nIndex, const com::sun::star::awt::Point& rPosition );
     185             : 
     186             :         SVX_DLLPUBLIC EnhancedCustomShape2d( SdrObject* pSdrObjCustomShape );
     187             :         SVX_DLLPUBLIC ~EnhancedCustomShape2d();
     188             : 
     189             :         enum EnumFunc
     190             :         {
     191             :             ENUM_FUNC_PI,
     192             :             ENUM_FUNC_LEFT,
     193             :             ENUM_FUNC_TOP,
     194             :             ENUM_FUNC_RIGHT,
     195             :             ENUM_FUNC_BOTTOM,
     196             :             ENUM_FUNC_XSTRETCH,
     197             :             ENUM_FUNC_YSTRETCH,
     198             :             ENUM_FUNC_HASSTROKE,
     199             :             ENUM_FUNC_HASFILL,
     200             :             ENUM_FUNC_WIDTH,
     201             :             ENUM_FUNC_HEIGHT,
     202             :             ENUM_FUNC_LOGWIDTH,
     203             :             ENUM_FUNC_LOGHEIGHT
     204             :         };
     205             :         double                      GetEnumFunc( const EnumFunc eVal ) const;
     206             : 
     207             :         double                      GetAdjustValueAsDouble( const sal_Int32 nIndex ) const;
     208             :         double                      GetEquationValueAsDouble( const sal_Int32 nIndex ) const;
     209             :         sal_Int32                   GetAdjustValueAsInteger( const sal_Int32 nIndex, const sal_Int32 nDefault = 0 ) const;
     210             : 
     211             :         SVX_DLLPUBLIC static rtl::OUString      GetEquation( const sal_uInt16 nFlags, sal_Int16 nPara1, sal_Int16 nPara2, sal_Int16 nPara3 );
     212             : 
     213             :         static void                 AppendEnhancedCustomShapeEquationParameter( rtl::OUString& rParameter, const sal_Int16 nPara, const sal_Bool bIsSpecialValue );
     214             : 
     215             :         static void                 SetEnhancedCustomShapeEquationParameter( com::sun::star::drawing::EnhancedCustomShapeParameter&
     216             :                                         rParameter, const sal_Int16 nPara, const sal_Bool bIsSpecialValue );
     217             :         SVX_DLLPUBLIC static void                   SetEnhancedCustomShapeParameter( com::sun::star::drawing::EnhancedCustomShapeParameter&
     218             :                                         rParameter, const sal_Int32 nValue );
     219             :         SVX_DLLPUBLIC static void                   SetEnhancedCustomShapeHandleParameter( com::sun::star::drawing::EnhancedCustomShapeParameter&
     220             :                                         rParameter, const sal_Int32 nPara, const sal_Bool bIsSpecialValue, sal_Bool bHorz );
     221             :         static sal_Bool             ConvertSequenceToEnhancedCustomShape2dHandle( const com::sun::star::beans::PropertyValues& rHandleProperties,
     222             :                                         EnhancedCustomShape2d::Handle& rDestinationHandle );
     223             :         static void                 SwapStartAndEndArrow( SdrObject* pObj );
     224             : };
     225             : #endif
     226             : 
     227             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10