LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/view/inc - ShapeFactory.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2012-12-27 Functions: 2 2 100.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             : #ifndef _CHART2_VIEW_SHAPEFACTORY_HXX
      20             : #define _CHART2_VIEW_SHAPEFACTORY_HXX
      21             : 
      22             : #include "PropertyMapper.hxx"
      23             : #include "VLineProperties.hxx"
      24             : #include "BaseGFXHelper.hxx"
      25             : #include <com/sun/star/beans/XPropertySet.hpp>
      26             : #include <com/sun/star/drawing/Direction3D.hpp>
      27             : #include <com/sun/star/drawing/HomogenMatrix.hpp>
      28             : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
      29             : #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
      30             : #include <com/sun/star/drawing/Position3D.hpp>
      31             : #include <com/sun/star/drawing/XDrawPage.hpp>
      32             : #include <com/sun/star/drawing/XShapes.hpp>
      33             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      34             : #include <com/sun/star/graphic/XGraphic.hpp>
      35             : 
      36             : //.............................................................................
      37             : namespace chart
      38             : {
      39             : //.............................................................................
      40             : 
      41             : class Stripe;
      42        1760 : class ShapeFactory
      43             : {
      44             : public:
      45        1760 :     ShapeFactory(::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> xFactory)
      46        1760 :         {m_xShapeFactory = xFactory;}
      47             : 
      48             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
      49             :         createGroup2D(
      50             :             const ::com::sun::star::uno::Reference<
      51             :                 ::com::sun::star::drawing::XShapes >& xTarget
      52             :                 , ::rtl::OUString aName = ::rtl::OUString() );
      53             : 
      54             : 
      55             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
      56             :         createGroup3D(
      57             :             const ::com::sun::star::uno::Reference<
      58             :                 ::com::sun::star::drawing::XShapes >& xTarget
      59             :                 , ::rtl::OUString aName = ::rtl::OUString() );
      60             : 
      61             :     //------
      62             : 
      63             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
      64             :             createCube(   const ::com::sun::star::uno::Reference<
      65             :                                 ::com::sun::star::drawing::XShapes >& xTarget
      66             :                         , const ::com::sun::star::drawing::Position3D& rPosition
      67             :                         , const ::com::sun::star::drawing::Direction3D& rSize
      68             :                         , sal_Int32 nRotateZAngleHundredthDegree
      69             :                         , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
      70             :                         , const tPropertyNameMap& rPropertyNameMap
      71             :                         , bool bRounded = false);
      72             : 
      73             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
      74             :         createCylinder(   const ::com::sun::star::uno::Reference<
      75             :                                 ::com::sun::star::drawing::XShapes >& xTarget
      76             :                         , const ::com::sun::star::drawing::Position3D& rPosition
      77             :                         , const ::com::sun::star::drawing::Direction3D& rSize
      78             :                         , sal_Int32 nRotateZAngleHundredthDegree );
      79             : 
      80             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
      81             :         createPyramid(    const ::com::sun::star::uno::Reference<
      82             :                                 ::com::sun::star::drawing::XShapes >& xTarget
      83             :                         , const ::com::sun::star::drawing::Position3D& rPosition
      84             :                         , const ::com::sun::star::drawing::Direction3D& rSize
      85             :                         , double fTopHeight
      86             :                         , bool bRotateZ
      87             :                         , const ::com::sun::star::uno::Reference<
      88             :                             ::com::sun::star::beans::XPropertySet >& xSourceProp
      89             :                         , const tPropertyNameMap& rPropertyNameMap);
      90             : 
      91             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
      92             :         createCone(       const ::com::sun::star::uno::Reference<
      93             :                                 ::com::sun::star::drawing::XShapes >& xTarget
      94             :                         , const ::com::sun::star::drawing::Position3D& rPosition
      95             :                         , const ::com::sun::star::drawing::Direction3D& rSize
      96             :                         , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree );
      97             : 
      98             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
      99             :         createPieSegment2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     100             :                     , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
     101             :                     , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
     102             :                     , const ::com::sun::star::drawing::Direction3D& rOffset
     103             :                     , const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene );
     104             : 
     105             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     106             :         createPieSegment( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     107             :                     , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
     108             :                     , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
     109             :                     , const ::com::sun::star::drawing::Direction3D& rOffset
     110             :                     , const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene
     111             :                     , double fDepth );
     112             : 
     113             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     114             :         createStripe( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     115             :                     , const Stripe& rStripe
     116             :                     , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
     117             :                     , const tPropertyNameMap& rPropertyNameMap
     118             :                     , sal_Bool bDoubleSided = true
     119             :                     , short nRotatedTexture = 0 //0 to 7 are the different possibilities
     120             :                     , bool bFlatNormals=true );
     121             : 
     122             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     123             :         createArea3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     124             :                     , const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon
     125             :                     , double fDepth);
     126             : 
     127             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     128             :         createArea2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     129             :                     , const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon);
     130             : 
     131             :     static sal_Int32 getSymbolCount();
     132             : 
     133             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     134             :         createSymbol2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     135             :                     , const ::com::sun::star::drawing::Position3D& rPos
     136             :                     , const ::com::sun::star::drawing::Direction3D& rSize
     137             :                     , sal_Int32 nStandardSymbol
     138             :                     , sal_Int32 nBorderColor=0
     139             :                     , sal_Int32 nFillColor=0 );
     140             : 
     141             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     142             :         createGraphic2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     143             :                     , const ::com::sun::star::drawing::Position3D& rPos
     144             :                     , const ::com::sun::star::drawing::Direction3D& rSize
     145             :                     , const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic );
     146             : 
     147             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     148             :         createLine2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     149             :                     , const ::com::sun::star::drawing::PointSequenceSequence& rPoints
     150             :                     , const VLineProperties* pLineProperties = NULL );
     151             : 
     152             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     153             :         createLine3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     154             :                     , const ::com::sun::star::drawing::PolyPolygonShape3D& rPoints
     155             :                     , const VLineProperties& rLineProperties );
     156             : 
     157             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     158             :         createCircle2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     159             :                     , const ::com::sun::star::drawing::Position3D& rPos
     160             :                     , const ::com::sun::star::drawing::Direction3D& rSize );
     161             : 
     162             :     //------------------- create 2D elements:
     163             : 
     164             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     165             :         createText( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget2D
     166             :                     , const ::rtl::OUString& rText
     167             :                     , const tNameSequence& rPropNames
     168             :                     , const tAnySequence& rPropValues
     169             :                     , const ::com::sun::star::uno::Any& rATransformation
     170             :                      );
     171             : 
     172             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     173             :         createInvisibleRectangle(
     174             :             const ::com::sun::star::uno::Reference<
     175             :                 ::com::sun::star::drawing::XShapes >& xTarget
     176             :                 , const ::com::sun::star::awt::Size& rSize );
     177             : 
     178             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
     179             :          getOrCreateChartRootShape( const ::com::sun::star::uno::Reference<
     180             :             ::com::sun::star::drawing::XDrawPage>& xPage );
     181             : 
     182             :     static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
     183             :          getChartRootShape( const ::com::sun::star::uno::Reference<
     184             :             ::com::sun::star::drawing::XDrawPage>& xPage );
     185             : 
     186             :     //------
     187             :     static void makeShapeInvisible( const ::com::sun::star::uno::Reference<
     188             :                                      ::com::sun::star::drawing::XShape >& xShape );
     189             : 
     190             :      static void setShapeName( const ::com::sun::star::uno::Reference<
     191             :                                      ::com::sun::star::drawing::XShape >& xShape
     192             :                              , const rtl::OUString& rName );
     193             : 
     194             :      static rtl::OUString getShapeName( const ::com::sun::star::uno::Reference<
     195             :                                      ::com::sun::star::drawing::XShape >& xShape );
     196             : 
     197             :      static ::com::sun::star::uno::Any makeTransformation( const ::com::sun::star::awt::Point& rScreenPosition2D, double fRotationAnglePi=0.0 );
     198             : 
     199             :      static rtl::OUString getStackedString( const rtl::OUString& rString, bool bStacked=true );
     200             : 
     201             :      static bool hasPolygonAnyLines( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
     202             :      static bool isPolygonEmptyOrSinglePoint( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
     203             :      static void closePolygon( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
     204             : 
     205             :      static ::com::sun::star::awt::Size calculateNewSizeRespectingAspectRatio(
     206             :            const ::com::sun::star::awt::Size& rTargetSize
     207             :          , const ::com::sun::star::awt::Size& rSourceSizeWithCorrectAspectRatio );
     208             : 
     209             :      static ::com::sun::star::awt::Point calculateTopLeftPositionToCenterObject(
     210             :            const ::com::sun::star::awt::Point& rTargetAreaPosition
     211             :          , const ::com::sun::star::awt::Size& rTargetAreaSize
     212             :          , const ::com::sun::star::awt::Size& rObjectSize );
     213             : 
     214             :      static ::basegfx::B2IRectangle getRectangleOfShape(
     215             :          const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape );
     216             : 
     217             :      static ::com::sun::star::awt::Size getSizeAfterRotation(
     218             :          const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, double fRotationAngleDegree );
     219             : 
     220             :      static void removeSubShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes );
     221             : 
     222             : private:
     223             :     ShapeFactory();
     224             : 
     225             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     226             :         impl_createCube( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     227             :                     , const ::com::sun::star::drawing::Position3D& rPosition
     228             :                     , const ::com::sun::star::drawing::Direction3D& rSize, sal_Int32 nRotateZAngleHundredthDegree
     229             :                     , bool bRounded );
     230             : 
     231             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     232             :         impl_createConeOrCylinder( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
     233             :                     , const ::com::sun::star::drawing::Position3D& rPosition
     234             :                     , const ::com::sun::star::drawing::Direction3D& rSize
     235             :                     , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
     236             :                     , bool bCylinder = false);
     237             : 
     238             :     //member:
     239             :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>
     240             :         m_xShapeFactory;
     241             : };
     242             : 
     243             : //.............................................................................
     244             : } //namespace chart
     245             : //.............................................................................
     246             : #endif
     247             : 
     248             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10