LCOV - code coverage report
Current view: top level - chart2/source/view/main - ShapeFactory.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 879 1170 75.1 %
Date: 2014-11-03 Functions: 31 36 86.1 %
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             : #include "ShapeFactory.hxx"
      21             : #include "ViewDefines.hxx"
      22             : #include "Stripe.hxx"
      23             : #include "CommonConverters.hxx"
      24             : #include "macros.hxx"
      25             : #include "RelativeSizeHelper.hxx"
      26             : #include "PropertyMapper.hxx"
      27             : #include <comphelper/InlineContainer.hxx>
      28             : #include <com/sun/star/beans/XPropertySet.hpp>
      29             : #include <com/sun/star/drawing/CircleKind.hpp>
      30             : #include <com/sun/star/drawing/DoubleSequence.hpp>
      31             : #include <com/sun/star/drawing/FlagSequence.hpp>
      32             : #include <com/sun/star/drawing/FillStyle.hpp>
      33             : #include <com/sun/star/drawing/LineStyle.hpp>
      34             : #include <com/sun/star/drawing/NormalsKind.hpp>
      35             : #include <com/sun/star/drawing/PointSequence.hpp>
      36             : #include <com/sun/star/drawing/PolygonKind.hpp>
      37             : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      38             : #include <com/sun/star/drawing/ProjectionMode.hpp>
      39             : #include <com/sun/star/drawing/ShadeMode.hpp>
      40             : #include <com/sun/star/drawing/TextFitToSizeType.hpp>
      41             : #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
      42             : #include <com/sun/star/drawing/TextureProjectionMode.hpp>
      43             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      44             : #include <com/sun/star/text/XText.hpp>
      45             : #include <com/sun/star/uno/Any.hxx>
      46             : 
      47             : #include <editeng/unoprnms.hxx>
      48             : #include <rtl/math.hxx>
      49             : #include <svx/svdocirc.hxx>
      50             : #include <svx/svdopath.hxx>
      51             : 
      52             : #include <basegfx/point/b2dpoint.hxx>
      53             : #include <basegfx/matrix/b3dhommatrix.hxx>
      54             : 
      55             : #include <algorithm>
      56             : 
      57             : using namespace ::com::sun::star;
      58             : using ::com::sun::star::uno::Reference;
      59             : 
      60             : namespace chart
      61             : {
      62             : 
      63         436 : uno::Reference< drawing::XShapes > ShapeFactory::getOrCreateChartRootShape(
      64             :     const uno::Reference< drawing::XDrawPage>& xDrawPage )
      65             : {
      66         436 :     uno::Reference<drawing::XShapes> xRet = ShapeFactory::getChartRootShape(xDrawPage);
      67         436 :     if (xRet.is())
      68           0 :         return xRet;
      69             : 
      70             :     // Create a new root shape and set it to the bottom of the page.  The root
      71             :     // shape is identified by having the name com.sun.star.chart2.shapes.
      72             :     uno::Reference<drawing::XShape> xShape(
      73         872 :         m_xShapeFactory->createInstance("com.sun.star.drawing.GroupShape"), uno::UNO_QUERY);
      74         872 :     uno::Reference<drawing::XShapes2> xShapes2(xDrawPage, uno::UNO_QUERY_THROW);
      75         436 :     xShapes2->addBottom(xShape);
      76             : 
      77         436 :     setShapeName(xShape, "com.sun.star.chart2.shapes");
      78         436 :     xShape->setSize(awt::Size(0,0));
      79             : 
      80         436 :     xRet = uno::Reference<drawing::XShapes>(xShape, uno::UNO_QUERY);
      81         436 :     return xRet;
      82             : }
      83             : 
      84         886 : void ShapeFactory::setPageSize(uno::Reference< drawing::XShapes >, const awt::Size& )
      85             : {
      86         886 : }
      87             : 
      88             : //  diverse tools::PolyPolygon create methods
      89             : 
      90        3241 : uno::Any createPolyPolygon_Cube(
      91             :             const drawing::Direction3D& rSize, double fRoundedEdge, bool bRounded = true )
      92             : {
      93             :     OSL_PRECOND(fRoundedEdge>=0, "fRoundedEdge needs to be >= 0");
      94             : 
      95             :     // always use extra points, so set percent diagonal to 0.4 which is 0% in the UI (old Chart comment)
      96        3241 :     if( fRoundedEdge == 0.0  && bRounded)
      97           0 :         fRoundedEdge = 0.4 / 200.0;
      98        3241 :     else if(!bRounded)
      99        3241 :         fRoundedEdge = 0.0;
     100             : 
     101             :     //fWidthH stands for Half Width
     102        3241 :     const double fWidthH = rSize.DirectionX >=0.0?  rSize.DirectionX/2.0  : -rSize.DirectionX/2.0;
     103        3241 :     const double fHeight = rSize.DirectionY;
     104             : 
     105        3241 :     const double fHeightSign = fHeight >= 0.0 ? 1.0 : -1.0;
     106             : 
     107        3241 :     const double fOffset = (fWidthH * fRoundedEdge) * 1.05; // increase by 5% for safety
     108        3241 :     const bool bRoundEdges = fRoundedEdge && fOffset < fWidthH && 2.0 * fOffset < fHeightSign*fHeight;
     109        3241 :     const sal_Int32 nPointCount = bRoundEdges ? 13 : 5;
     110             : 
     111        3241 :     drawing::PolyPolygonShape3D aPP;
     112             : 
     113        3241 :     aPP.SequenceX.realloc(1);
     114        3241 :     aPP.SequenceY.realloc(1);
     115        3241 :     aPP.SequenceZ.realloc(1);
     116             : 
     117        3241 :     drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
     118        3241 :     drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
     119        3241 :     drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
     120             : 
     121        3241 :     pOuterSequenceX->realloc(nPointCount);
     122        3241 :     pOuterSequenceY->realloc(nPointCount);
     123        3241 :     pOuterSequenceZ->realloc(nPointCount);
     124             : 
     125        3241 :     double* pInnerSequenceX = pOuterSequenceX->getArray();
     126        3241 :     double* pInnerSequenceY = pOuterSequenceY->getArray();
     127        3241 :     double* pInnerSequenceZ = pOuterSequenceZ->getArray();
     128             : 
     129       22687 :     for(sal_Int32 nN = nPointCount; nN--;)
     130       16205 :         *pInnerSequenceZ++ = 0.0;
     131             : 
     132        3241 :     if(nPointCount == 5)
     133             :     {
     134        3241 :         *pInnerSequenceY++ = 0.0;
     135        3241 :         *pInnerSequenceY++ = 0.0;
     136        3241 :         *pInnerSequenceY++ = fHeight;
     137        3241 :         *pInnerSequenceY++ = fHeight;
     138        3241 :         *pInnerSequenceY++ = 0.0;
     139             : 
     140        3241 :         *pInnerSequenceX++ = -fWidthH;
     141        3241 :         *pInnerSequenceX++ = fWidthH;
     142        3241 :         *pInnerSequenceX++ = fWidthH;
     143        3241 :         *pInnerSequenceX++ = -fWidthH;
     144        3241 :         *pInnerSequenceX++ = -fWidthH;
     145             :     }
     146             :     else
     147             :     {
     148           0 :         *pInnerSequenceY++ = 0.0;
     149           0 :         *pInnerSequenceY++ = 0.0;
     150           0 :         *pInnerSequenceY++ = 0.0;
     151           0 :         *pInnerSequenceY++ = fHeightSign*fOffset;
     152           0 :         *pInnerSequenceY++ = fHeight - fHeightSign*fOffset;
     153           0 :         *pInnerSequenceY++ = fHeight;
     154           0 :         *pInnerSequenceY++ = fHeight;
     155           0 :         *pInnerSequenceY++ = fHeight;
     156           0 :         *pInnerSequenceY++ = fHeight;
     157           0 :         *pInnerSequenceY++ = fHeight - fHeightSign*fOffset;
     158           0 :         *pInnerSequenceY++ = fHeightSign*fOffset;
     159           0 :         *pInnerSequenceY++ = 0.0;
     160           0 :         *pInnerSequenceY++ = 0.0;
     161             : 
     162           0 :         *pInnerSequenceX++ = -fWidthH + fOffset;
     163           0 :         *pInnerSequenceX++ = fWidthH - fOffset;
     164           0 :         *pInnerSequenceX++ = fWidthH;
     165           0 :         *pInnerSequenceX++ = fWidthH;
     166           0 :         *pInnerSequenceX++ = fWidthH;
     167           0 :         *pInnerSequenceX++ = fWidthH;
     168           0 :         *pInnerSequenceX++ = fWidthH - fOffset;
     169           0 :         *pInnerSequenceX++ = -fWidthH + fOffset;
     170           0 :         *pInnerSequenceX++ = -fWidthH;
     171           0 :         *pInnerSequenceX++ = -fWidthH;
     172           0 :         *pInnerSequenceX++ = -fWidthH;
     173           0 :         *pInnerSequenceX++ = -fWidthH;
     174           0 :         *pInnerSequenceX++ = -fWidthH + fOffset;
     175             :     }
     176        3241 :     return uno::Any( &aPP, cppu::UnoType<drawing::PolyPolygonShape3D>::get());
     177             : }
     178             : 
     179          48 : uno::Any createPolyPolygon_Cylinder(
     180             :              double fHeight
     181             :            , double fRadius
     182             :            , sal_Int32& nVerticalSegmentCount )
     183             : {
     184             :     //fHeight may be negative
     185             :     OSL_PRECOND(fRadius>0, "The radius of a cylinder needs to be > 0");
     186             : 
     187          48 :     drawing::PolyPolygonShape3D aPP;
     188             : 
     189          48 :     nVerticalSegmentCount=1;
     190             : 
     191          48 :     aPP.SequenceX.realloc(3);
     192          48 :     aPP.SequenceY.realloc(3);
     193          48 :     aPP.SequenceZ.realloc(3);
     194             : 
     195          48 :     drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
     196          48 :     drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
     197          48 :     drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
     198             : 
     199          48 :     pOuterSequenceX->realloc(2);
     200          48 :     pOuterSequenceY->realloc(2);
     201          48 :     pOuterSequenceZ->realloc(2);
     202             : 
     203          48 :     double* pInnerSequenceX = pOuterSequenceX->getArray();
     204          48 :     double* pInnerSequenceY = pOuterSequenceY->getArray();
     205          48 :     double* pInnerSequenceZ = pOuterSequenceZ->getArray();
     206             : 
     207          48 :     double fY1 = 0.0;
     208          48 :     double fY2 = fHeight;
     209             : 
     210          48 :     if( fHeight<0.0 )
     211           0 :         ::std::swap(fY1,fY2);
     212             : 
     213         192 :     for(sal_Int32 nN = 2; nN--;)
     214          96 :         *pInnerSequenceZ++ = 0.0;
     215             : 
     216          48 :     *pInnerSequenceX++ = 0.0;
     217          48 :     *pInnerSequenceY++ = fY1;
     218             : 
     219          48 :     *pInnerSequenceX++ = fRadius;
     220          48 :     *pInnerSequenceY++ = fY1;
     221             : 
     222          48 :     pOuterSequenceX++;pOuterSequenceY++;pOuterSequenceZ++;
     223          48 :     pOuterSequenceX->realloc(2);
     224          48 :     pOuterSequenceY->realloc(2);
     225          48 :     pOuterSequenceZ->realloc(2);
     226             : 
     227          48 :     pInnerSequenceX = pOuterSequenceX->getArray();
     228          48 :     pInnerSequenceY = pOuterSequenceY->getArray();
     229          48 :     pInnerSequenceZ = pOuterSequenceZ->getArray();
     230             : 
     231         192 :     for(sal_Int32 nN = 2; nN--;)
     232          96 :         *pInnerSequenceZ++ = 0.0;
     233             : 
     234          48 :     *pInnerSequenceX++ = fRadius;
     235          48 :     *pInnerSequenceY++ = fY1;
     236             : 
     237          48 :     *pInnerSequenceX++ = fRadius;
     238          48 :     *pInnerSequenceY++ = fY2;
     239             : 
     240          48 :     pOuterSequenceX++;pOuterSequenceY++;pOuterSequenceZ++;
     241          48 :     pOuterSequenceX->realloc(2);
     242          48 :     pOuterSequenceY->realloc(2);
     243          48 :     pOuterSequenceZ->realloc(2);
     244             : 
     245          48 :     pInnerSequenceX = pOuterSequenceX->getArray();
     246          48 :     pInnerSequenceY = pOuterSequenceY->getArray();
     247          48 :     pInnerSequenceZ = pOuterSequenceZ->getArray();
     248             : 
     249         192 :     for(sal_Int32 nN = 2; nN--;)
     250          96 :         *pInnerSequenceZ++ = 0.0;
     251             : 
     252          48 :     *pInnerSequenceX++ = fRadius;
     253          48 :     *pInnerSequenceY++ = fY2;
     254             : 
     255          48 :     *pInnerSequenceX++ = 0.0;
     256          48 :     *pInnerSequenceY++ = fY2;
     257             : 
     258          48 :     return uno::Any( &aPP, cppu::UnoType<drawing::PolyPolygonShape3D>::get());
     259             : }
     260             : 
     261          48 : uno::Any createPolyPolygon_Cone( double fHeight, double fRadius, double fTopHeight
     262             :             , sal_Int32& nVerticalSegmentCount )
     263             : {
     264             :     OSL_PRECOND(fRadius>0, "The radius of a cone needs to be > 0");
     265             : 
     266             :     //for stacked charts we need cones without top -> fTopHeight != 0 resp. bTopless == true
     267             :     //fTopHeight indicates the high of the cutted top only (not the full height)
     268          48 :     bool bTopless = !::rtl::math::approxEqual( fHeight, fHeight + fTopHeight );
     269             : 
     270          48 :     double r1= 0.0, r2 = fRadius;
     271          48 :     if(bTopless)
     272             :         // #i63212# fHeight may be negative, fTopHeight is always positive -> use fabs(fHeight)
     273          16 :         r1 = fRadius * (fTopHeight)/(fabs(fHeight)+fTopHeight);
     274             : 
     275          48 :     nVerticalSegmentCount=1;
     276          48 :     drawing::PolyPolygonShape3D aPP;
     277             : 
     278          48 :     aPP.SequenceX.realloc(2);
     279          48 :     aPP.SequenceY.realloc(2);
     280          48 :     aPP.SequenceZ.realloc(2);
     281             : 
     282          48 :     drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
     283          48 :     drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
     284          48 :     drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
     285             : 
     286          48 :     pOuterSequenceX->realloc(2);
     287          48 :     pOuterSequenceY->realloc(2);
     288          48 :     pOuterSequenceZ->realloc(2);
     289             : 
     290          48 :     double* pInnerSequenceX = pOuterSequenceX->getArray();
     291          48 :     double* pInnerSequenceY = pOuterSequenceY->getArray();
     292          48 :     double* pInnerSequenceZ = pOuterSequenceZ->getArray();
     293             : 
     294          48 :     double fX1 = 0.0;
     295          48 :     double fX2 = r2;
     296          48 :     double fX3 = r1;
     297             : 
     298          48 :     double fY1 = 0.0;
     299          48 :     double fY2 = 0.0;
     300          48 :     double fY3 = fHeight;
     301             : 
     302          48 :     if( fHeight<0.0 )
     303             :     {
     304           0 :         ::std::swap(fX1,fX3);
     305           0 :         ::std::swap(fY1,fY3);
     306             :     }
     307             : 
     308         192 :     for(sal_Int32 nN = 2; nN--;)
     309          96 :         *pInnerSequenceZ++ = 0.0;
     310             : 
     311          48 :     *pInnerSequenceY++ = fY1;
     312          48 :     *pInnerSequenceX++ = fX1;
     313             : 
     314          48 :     *pInnerSequenceY++ = fY2;
     315          48 :     *pInnerSequenceX++ = fX2;
     316             : 
     317          48 :     pOuterSequenceX++;pOuterSequenceY++;pOuterSequenceZ++;
     318          48 :     pOuterSequenceX->realloc(2);
     319          48 :     pOuterSequenceY->realloc(2);
     320          48 :     pOuterSequenceZ->realloc(2);
     321             : 
     322          48 :     pInnerSequenceX = pOuterSequenceX->getArray();
     323          48 :     pInnerSequenceY = pOuterSequenceY->getArray();
     324          48 :     pInnerSequenceZ = pOuterSequenceZ->getArray();
     325             : 
     326         192 :     for(sal_Int32 nN = 2; nN--;)
     327          96 :         *pInnerSequenceZ++ = 0.0;
     328             : 
     329          48 :     *pInnerSequenceY++ = fY2;
     330          48 :     *pInnerSequenceX++ = fX2;
     331             : 
     332          48 :     *pInnerSequenceY++ = fY3;
     333          48 :     *pInnerSequenceX++ = fX3;
     334             : 
     335          48 :     return uno::Any( &aPP, cppu::UnoType<drawing::PolyPolygonShape3D>::get());
     336             : }
     337             : 
     338             : //  methods for 3D shape creation
     339             : 
     340             : uno::Reference<drawing::XShape>
     341        3241 :         ShapeFactory::createCube(
     342             :             const uno::Reference<drawing::XShapes>& xTarget
     343             :             , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
     344             :             , sal_Int32 nRotateZAngleHundredthDegree
     345             :             , const uno::Reference< beans::XPropertySet >& xSourceProp
     346             :             , const tPropertyNameMap& rPropertyNameMap
     347             :             , bool bRounded )
     348             : {
     349        3241 :     if( !xTarget.is() )
     350           0 :         return 0;
     351        3241 :     if( bRounded )
     352             :     {
     353             :         try
     354             :         {
     355           0 :             if( xSourceProp.is() )
     356             :             {
     357             :                 drawing::LineStyle aLineStyle;
     358           0 :                 xSourceProp->getPropertyValue( "BorderStyle" ) >>= aLineStyle;
     359           0 :                 if( aLineStyle == drawing::LineStyle_SOLID )
     360           0 :                     bRounded = false;
     361             :             }
     362             :         }
     363           0 :         catch( const uno::Exception& e )
     364             :         {
     365             :             ASSERT_EXCEPTION( e );
     366             :         }
     367             :     }
     368        3241 :     uno::Reference<drawing::XShape> xShape = impl_createCube( xTarget, rPosition, rSize, nRotateZAngleHundredthDegree, bRounded );
     369        6482 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
     370        3241 :     if( xSourceProp.is())
     371          84 :         PropertyMapper::setMappedProperties( xProp, xSourceProp, rPropertyNameMap );
     372        6482 :     return xShape;
     373             : }
     374             : 
     375             : uno::Reference<drawing::XShape>
     376        3241 :         ShapeFactory::impl_createCube(
     377             :               const uno::Reference<drawing::XShapes>& xTarget
     378             :             , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
     379             :             , sal_Int32 nRotateZAngleHundredthDegree
     380             :             , bool bRounded )
     381             : {
     382        3241 :     if( !xTarget.is() )
     383           0 :         return 0;
     384             : 
     385             :     //create shape
     386             :     uno::Reference< drawing::XShape > xShape(
     387        3241 :         m_xShapeFactory->createInstance(
     388        3241 :             "com.sun.star.drawing.Shape3DExtrudeObject" ), uno::UNO_QUERY );
     389        3241 :     xTarget->add(xShape);
     390             : 
     391             :     //set properties
     392        6482 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
     393             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
     394        3241 :     if( xProp.is())
     395             :     {
     396             :         try
     397             :         {
     398             :             //depth
     399        3241 :             double fDepth = rSize.DirectionZ;
     400        3241 :             if(fDepth<0)
     401           0 :                 fDepth*=-1.0;
     402        3241 :             xProp->setPropertyValue( UNO_NAME_3D_EXTRUDE_DEPTH
     403        3241 :                 , uno::makeAny((sal_Int32)fDepth) );
     404             : 
     405             :             //PercentDiagonal
     406        3241 :             sal_Int16 nPercentDiagonal = bRounded ? 3 : 0;
     407        3241 :             xProp->setPropertyValue( UNO_NAME_3D_PERCENT_DIAGONAL
     408        3241 :                 , uno::makeAny( nPercentDiagonal ) );
     409             : 
     410             :             //Polygon
     411        3241 :             xProp->setPropertyValue( UNO_NAME_3D_POLYPOLYGON3D
     412        3241 :                 , createPolyPolygon_Cube( rSize, double(nPercentDiagonal)/200.0,bRounded) );
     413             : 
     414             :             //Matrix for position
     415             :             {
     416        3241 :                 ::basegfx::B3DHomMatrix aM;
     417        3241 :                 if(nRotateZAngleHundredthDegree!=0)
     418          24 :                     aM.rotate(0.0,0.0,-nRotateZAngleHundredthDegree/18000.00*F_PI);
     419             :                 aM.translate(rPosition.PositionX
     420             :                             , rPosition.PositionY
     421        3241 :                             , rPosition.PositionZ - (fDepth/2.0));
     422        3241 :                 drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
     423        3241 :                 xProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
     424        3241 :                     , uno::makeAny(aHM) );
     425             :             }
     426             :         }
     427           0 :         catch( const uno::Exception& e )
     428             :         {
     429             :             ASSERT_EXCEPTION( e );
     430             :         }
     431             :     }
     432        6482 :     return xShape;
     433             : }
     434             : 
     435             : uno::Reference<drawing::XShape>
     436          48 :         ShapeFactory::createCylinder(
     437             :             const uno::Reference<drawing::XShapes>& xTarget
     438             :           , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
     439             :           , sal_Int32 nRotateZAngleHundredthDegree )
     440             : {
     441             :     return impl_createConeOrCylinder(
     442          48 :               xTarget, rPosition, rSize, 0.0, nRotateZAngleHundredthDegree, true );
     443             : }
     444             : 
     445             : uno::Reference<drawing::XShape>
     446           0 :         ShapeFactory::createPyramid(
     447             :             const uno::Reference<drawing::XShapes>& xTarget
     448             :           , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
     449             :           , double fTopHeight, bool bRotateZ
     450             :           , const uno::Reference< beans::XPropertySet >& xSourceProp
     451             :           , const tPropertyNameMap& rPropertyNameMap )
     452             : {
     453           0 :     if( !xTarget.is() )
     454           0 :         return 0;
     455             : 
     456           0 :     Reference< drawing::XShapes > xGroup( ShapeFactory::createGroup3D( xTarget, OUString() ) );
     457             : 
     458           0 :     bool bDoubleSided = false;
     459           0 :     short nRotatedTexture = 0;
     460             : 
     461           0 :     const double fWidth = rSize.DirectionX;
     462           0 :     const double fDepth = rSize.DirectionZ;
     463           0 :     const double fHeight = rSize.DirectionY;
     464             : 
     465           0 :     drawing::Position3D aBottomP1( rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ - fDepth/2.0  );
     466           0 :     if(bRotateZ)
     467           0 :         aBottomP1.PositionY -= fWidth/2.0;
     468             :     else
     469           0 :         aBottomP1.PositionX -= fWidth/2.0;
     470           0 :     drawing::Position3D aBottomP2( aBottomP1 );
     471           0 :     if(bRotateZ)
     472           0 :         aBottomP2.PositionY += fWidth;
     473             :     else
     474           0 :         aBottomP2.PositionX += fWidth;
     475           0 :     drawing::Position3D aBottomP3( aBottomP2 );
     476           0 :     drawing::Position3D aBottomP4( aBottomP1 );
     477           0 :     aBottomP3.PositionZ += fDepth;
     478           0 :     aBottomP4.PositionZ += fDepth;
     479             : 
     480           0 :     const double fTopFactor = (fTopHeight)/(fabs(fHeight)+fTopHeight);
     481           0 :     drawing::Position3D aTopP1( rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ - fDepth*fTopFactor/2.0  );
     482           0 :     if(bRotateZ)
     483             :     {
     484           0 :         aTopP1.PositionY -= fWidth*fTopFactor/2.0;
     485           0 :         aTopP1.PositionX += fHeight;
     486             :     }
     487             :     else
     488             :     {
     489           0 :         aTopP1.PositionX -= fWidth*fTopFactor/2.0;
     490           0 :         aTopP1.PositionY += fHeight;
     491             :     }
     492           0 :     drawing::Position3D aTopP2( aTopP1 );
     493           0 :     if(bRotateZ)
     494           0 :         aTopP2.PositionY += fWidth*fTopFactor;
     495             :     else
     496           0 :         aTopP2.PositionX += fWidth*fTopFactor;
     497           0 :     drawing::Position3D aTopP3( aTopP2 );
     498           0 :     drawing::Position3D aTopP4( aTopP1 );
     499           0 :     aTopP3.PositionZ += fDepth*fTopFactor;
     500           0 :     aTopP4.PositionZ += fDepth*fTopFactor;
     501             : 
     502           0 :     Stripe aStripeBottom( aBottomP1, aBottomP4, aBottomP3, aBottomP2 );
     503             : 
     504           0 :     drawing::Position3D aNormalsBottomP1( aBottomP1 );
     505           0 :     drawing::Position3D aNormalsBottomP2( aBottomP2 );
     506           0 :     drawing::Position3D aNormalsBottomP3( aBottomP3 );
     507           0 :     drawing::Position3D aNormalsBottomP4( aBottomP4 );
     508           0 :     drawing::Position3D aNormalsTopP1( aBottomP1 );
     509           0 :     drawing::Position3D aNormalsTopP2( aBottomP2 );
     510           0 :     drawing::Position3D aNormalsTopP3( aBottomP3 );
     511           0 :     drawing::Position3D aNormalsTopP4( aBottomP4 );
     512           0 :     if( bRotateZ )
     513             :     {
     514           0 :         aNormalsTopP1.PositionX += fHeight;
     515           0 :         aNormalsTopP2.PositionX += fHeight;
     516           0 :         aNormalsTopP3.PositionX += fHeight;
     517           0 :         aNormalsTopP4.PositionX += fHeight;
     518             :     }
     519             :     else
     520             :     {
     521           0 :         aNormalsTopP1.PositionY += fHeight;
     522           0 :         aNormalsTopP2.PositionY += fHeight;
     523           0 :         aNormalsTopP3.PositionY += fHeight;
     524           0 :         aNormalsTopP4.PositionY += fHeight;
     525             :     }
     526             : 
     527           0 :     bool bInvertPolygon = false;
     528           0 :     bool bInvertNormals = false;
     529             : 
     530           0 :     if(bRotateZ)
     531             :     {
     532             :         //bars
     533           0 :         if(fHeight>=0.0)
     534             :         {
     535           0 :             nRotatedTexture = 2;
     536           0 :             bInvertNormals = true;
     537           0 :             aStripeBottom = Stripe( aBottomP1, aBottomP4, aBottomP3, aBottomP2 );
     538             :         }
     539             :         else
     540             :         {
     541           0 :             bInvertPolygon = true;
     542           0 :             nRotatedTexture = 1;
     543           0 :             aStripeBottom = Stripe( aBottomP2, aBottomP3, aBottomP4, aBottomP1 );
     544             :         }
     545             :     }
     546             :     else
     547             :     {
     548             :         //columns
     549           0 :         if(fHeight>=0.0)
     550             :         {
     551           0 :             bInvertPolygon = true;
     552           0 :             nRotatedTexture = 2;
     553           0 :             aStripeBottom = Stripe( aBottomP2, aBottomP3, aBottomP4, aBottomP1 );
     554             :         }
     555             :         else
     556             :         {
     557           0 :             nRotatedTexture = 3;
     558           0 :             bInvertNormals = true;
     559           0 :             aStripeBottom = Stripe( aBottomP4, aBottomP3, aBottomP2, aBottomP1 );
     560             :         }
     561             :     }
     562           0 :     aStripeBottom.InvertNormal(true);
     563             : 
     564           0 :     Stripe aStripe1( aTopP2, aTopP1, aBottomP1, aBottomP2 );
     565           0 :     Stripe aStripe2( aTopP3, aTopP2, aBottomP2, aBottomP3 );
     566           0 :     Stripe aStripe3( aTopP4, aTopP3, aBottomP3, aBottomP4 );
     567           0 :     Stripe aStripe4( aTopP1, aTopP4, aBottomP4, aBottomP1 );
     568             : 
     569           0 :     if( bInvertPolygon )
     570             :     {
     571           0 :         aStripe1 = Stripe( aBottomP1, aTopP1, aTopP2, aBottomP2 );
     572           0 :         aStripe2 = Stripe( aBottomP2, aTopP2, aTopP3, aBottomP3 );
     573           0 :         aStripe3 = Stripe( aBottomP3, aTopP3, aTopP4, aBottomP4 );
     574           0 :         aStripe4 = Stripe( aBottomP4, aTopP4, aTopP1, aBottomP1 );
     575             :     }
     576             : 
     577           0 :     Stripe aNormalsStripe1( aNormalsTopP1, aNormalsBottomP1, aNormalsBottomP2, aNormalsTopP2 );
     578           0 :     Stripe aNormalsStripe2( aNormalsTopP2, aNormalsBottomP2, aNormalsBottomP3, aNormalsTopP3 );
     579           0 :     Stripe aNormalsStripe3( aNormalsTopP3, aNormalsBottomP3, aNormalsBottomP4, aNormalsTopP4 );
     580           0 :     Stripe aNormalsStripe4( aNormalsTopP4, aNormalsBottomP4, aNormalsBottomP1, aNormalsTopP1 );
     581             : 
     582           0 :     if( bInvertNormals )
     583             :     {
     584           0 :         aNormalsStripe1 = Stripe( aNormalsTopP2, aNormalsBottomP2, aNormalsBottomP1, aNormalsTopP1 );
     585           0 :         aNormalsStripe2 = Stripe( aNormalsTopP3, aNormalsBottomP3, aNormalsBottomP2, aNormalsTopP2 );
     586           0 :         aNormalsStripe3 = Stripe( aNormalsTopP4, aNormalsBottomP4, aNormalsBottomP3, aNormalsTopP3 );
     587           0 :         aNormalsStripe4 = Stripe( aNormalsTopP1, aNormalsBottomP1, aNormalsBottomP4, aNormalsTopP4 );
     588             :     }
     589             : 
     590           0 :     aStripe1.SetManualNormal( aNormalsStripe1.getNormal() );
     591           0 :     aStripe2.SetManualNormal( aNormalsStripe2.getNormal() );
     592           0 :     aStripe3.SetManualNormal( aNormalsStripe3.getNormal() );
     593           0 :     aStripe4.SetManualNormal( aNormalsStripe4.getNormal() );
     594             : 
     595           0 :     const bool bFlatNormals = false;
     596           0 :     ShapeFactory::createStripe( xGroup, aStripe1, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
     597           0 :     ShapeFactory::createStripe( xGroup, aStripe2, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
     598           0 :     ShapeFactory::createStripe( xGroup, aStripe3, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
     599           0 :     ShapeFactory::createStripe( xGroup, aStripe4, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
     600           0 :     ShapeFactory::createStripe( xGroup, aStripeBottom, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
     601             : 
     602           0 :     return Reference< drawing::XShape >( xGroup, uno::UNO_QUERY );
     603             : }
     604             : 
     605             : uno::Reference<drawing::XShape>
     606          48 :         ShapeFactory::createCone(
     607             :             const uno::Reference<drawing::XShapes>& xTarget
     608             :           , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
     609             :           , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree )
     610             : {
     611          48 :     return impl_createConeOrCylinder( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree );
     612             : }
     613             : 
     614             : uno::Reference<drawing::XShape>
     615          96 :         ShapeFactory::impl_createConeOrCylinder(
     616             :               const uno::Reference<drawing::XShapes>& xTarget
     617             :             , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
     618             :             , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
     619             :             , bool bCylinder )
     620             : {
     621          96 :     if( !xTarget.is() )
     622           0 :         return 0;
     623             : 
     624             :     //create shape
     625             :     uno::Reference< drawing::XShape > xShape(
     626          96 :             m_xShapeFactory->createInstance(
     627          96 :             "com.sun.star.drawing.Shape3DLatheObject" ), uno::UNO_QUERY );
     628          96 :     xTarget->add(xShape);
     629             : 
     630          96 :     double fWidth      = rSize.DirectionX/2.0; //The depth will be corrrected within Matrix
     631          96 :     double fRadius     = fWidth; //!!!!!!!! problem in drawing layer: rotation object calculates wrong needed size -> wrong camera (it's a problem with bounding boxes)
     632          96 :     double fHeight     = rSize.DirectionY;
     633             : 
     634             :     //set properties
     635         192 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
     636             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
     637          96 :     if( xProp.is())
     638             :     {
     639             :         try
     640             :         {
     641             :             //PercentDiagonal
     642          96 :             sal_Int16 nPercentDiagonal = 5;
     643          96 :             xProp->setPropertyValue( UNO_NAME_3D_PERCENT_DIAGONAL
     644          96 :                 , uno::makeAny( nPercentDiagonal ) );
     645             : 
     646             :             //Polygon
     647          96 :             sal_Int32 nVerticalSegmentCount = 0;
     648             :             uno::Any aPPolygon = bCylinder ? createPolyPolygon_Cylinder(
     649             :                                                 fHeight, fRadius, nVerticalSegmentCount)
     650             :                                            : createPolyPolygon_Cone(
     651          96 :                                                 fHeight, fRadius, fTopHeight, nVerticalSegmentCount);
     652          96 :             xProp->setPropertyValue( UNO_NAME_3D_POLYPOLYGON3D, aPPolygon );
     653             : 
     654             :             //Matrix for position
     655             :             {
     656          96 :                 ::basegfx::B3DHomMatrix aM;
     657          96 :                 if(nRotateZAngleHundredthDegree!=0)
     658          24 :                     aM.rotate(0.0,0.0,-nRotateZAngleHundredthDegree/18000.00*F_PI);
     659             :                 //stretch the symmetric objects to given depth
     660          96 :                 aM.scale(1.0,1.0,rSize.DirectionZ/rSize.DirectionX);
     661          96 :                 aM.translate(rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ);
     662          96 :                 drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
     663          96 :                 xProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
     664          96 :                     , uno::makeAny(aHM) );
     665             :             }
     666             : 
     667             :             //Segments
     668          96 :             xProp->setPropertyValue( UNO_NAME_3D_HORZ_SEGS
     669          96 :                 , uno::makeAny(CHART_3DOBJECT_SEGMENTCOUNT) );
     670          96 :             xProp->setPropertyValue( UNO_NAME_3D_VERT_SEGS
     671          96 :                 , uno::makeAny((sal_Int32)nVerticalSegmentCount) );//depends on point count of the used polygon
     672             : 
     673             :             //Reduced lines
     674          96 :             xProp->setPropertyValue( UNO_NAME_3D_REDUCED_LINE_GEOMETRY
     675          96 :                 , uno::makeAny(true) );
     676             :         }
     677           0 :         catch( const uno::Exception& e )
     678             :         {
     679             :             ASSERT_EXCEPTION( e );
     680             :         }
     681             :     }
     682         192 :     return xShape;
     683             : }
     684             : 
     685         152 : void appendAndCloseBezierCoords( drawing::PolyPolygonBezierCoords& rReturn, const drawing::PolyPolygonBezierCoords& rAdd, bool bAppendInverse )
     686             : {
     687         152 :     if(!rAdd.Coordinates.getLength())
     688           0 :         return;
     689         152 :     sal_Int32 nAddCount = rAdd.Coordinates[0].getLength();
     690         152 :     if(!nAddCount)
     691           0 :         return;
     692             : 
     693         152 :     sal_Int32 nOldCount = rReturn.Coordinates[0].getLength();
     694             : 
     695         152 :     rReturn.Coordinates[0].realloc(nOldCount+nAddCount+1);
     696         152 :     rReturn.Flags[0].realloc(nOldCount+nAddCount+1);
     697             : 
     698        3592 :     for(sal_Int32 nN=0;nN<nAddCount; nN++ )
     699             :     {
     700        3440 :         sal_Int32 nAdd = bAppendInverse ? (nAddCount-1-nN) : nN;
     701        3440 :         rReturn.Coordinates[0][nOldCount+nN] = rAdd.Coordinates[0][nAdd];
     702        3440 :         rReturn.Flags[0][nOldCount+nN] = rAdd.Flags[0][nAdd];
     703             :     }
     704             : 
     705             :     //close
     706         152 :     rReturn.Coordinates[0][nOldCount+nAddCount] = rReturn.Coordinates[0][0];
     707         152 :     rReturn.Flags[0][nOldCount+nAddCount] = rReturn.Flags[0][0];
     708             : }
     709             : 
     710         304 : drawing::PolyPolygonBezierCoords getCircularArcBezierCoords(
     711             :         double fStartAngleRadian, double fWidthAngleRadian, double fUnitRadius
     712             :         , const ::basegfx::B2DHomMatrix& rTransformationFromUnitCircle
     713             :         , const double fAngleSubdivisionRadian )
     714             : {
     715             :     //at least one polygon is created using two normal and two control points
     716             :     //if the angle is larger it is separated into multiple sub angles
     717             : 
     718         304 :     drawing::PolyPolygonBezierCoords aReturn = drawing::PolyPolygonBezierCoords();
     719         304 :     sal_Int32 nSegmentCount = static_cast< sal_Int32 >( fWidthAngleRadian/fAngleSubdivisionRadian );
     720         304 :     if( fWidthAngleRadian > fAngleSubdivisionRadian*nSegmentCount )
     721         280 :         nSegmentCount++;
     722             : 
     723         304 :     double fFirstSegmentAngle = fAngleSubdivisionRadian;
     724         304 :     double fLastSegmentAngle = fAngleSubdivisionRadian;
     725         304 :     if(nSegmentCount==1)
     726             :     {
     727           0 :         fFirstSegmentAngle = fWidthAngleRadian;
     728           0 :         fLastSegmentAngle = 0.0;
     729             :     }
     730             :     else
     731             :     {
     732         304 :         double fFirstAngleOnSubDevision = (static_cast<sal_Int32>(fStartAngleRadian/fAngleSubdivisionRadian)+1)*fAngleSubdivisionRadian;
     733         304 :         if( !::rtl::math::approxEqual( fStartAngleRadian, fFirstAngleOnSubDevision ) )
     734         304 :             fFirstSegmentAngle = fFirstAngleOnSubDevision-fStartAngleRadian;
     735             : 
     736         304 :         if(nSegmentCount>1)
     737             :         {
     738         304 :             fLastSegmentAngle = fWidthAngleRadian-fFirstSegmentAngle-fAngleSubdivisionRadian*(nSegmentCount-2);
     739         304 :             if( fLastSegmentAngle<0 )
     740           0 :                 nSegmentCount--;
     741         304 :             if( fLastSegmentAngle>fAngleSubdivisionRadian )
     742             :             {
     743         104 :                 fLastSegmentAngle-=fAngleSubdivisionRadian;
     744         104 :                 nSegmentCount++;
     745             :             }
     746             :         }
     747             :     }
     748             : 
     749         304 :     sal_Int32 nPointCount     = 1 + 3*nSegmentCount; //first point of next segment equals last point of former segment
     750             : 
     751         304 :     aReturn.Coordinates = drawing::PointSequenceSequence(1);
     752         304 :     aReturn.Flags       = drawing::FlagSequenceSequence(1);
     753             : 
     754         608 :     drawing::PointSequence aPoints(nPointCount);
     755         608 :     drawing::FlagSequence  aFlags(nPointCount);
     756             : 
     757             :     //!! applying matrix to vector does ignore translation, so it is important to use a B2DPoint here instead of B2DVector
     758         608 :     ::basegfx::B2DPoint P0,P1,P2,P3;
     759             : 
     760         304 :     sal_Int32 nPoint=0;
     761         304 :     double fCurrentRotateAngle = fStartAngleRadian;
     762        2496 :     for(sal_Int32 nSegment=0; nSegment<nSegmentCount; nSegment++)
     763             :     {
     764        2192 :         double fCurrentSegmentAngle = fAngleSubdivisionRadian;
     765        2192 :         if(nSegment==0)//first segment gets only a smaller peace until the next subdevision
     766         304 :             fCurrentSegmentAngle = fFirstSegmentAngle;
     767        1888 :         else if(nSegment==(nSegmentCount-1)) //the last segment gets the rest angle that does not fit into equal pieces
     768         304 :             fCurrentSegmentAngle = fLastSegmentAngle;
     769             : 
     770             :         //first create untransformed points for a unit circle arc:
     771        2192 :         const double fCos = cos(fCurrentSegmentAngle/2.0);
     772        2192 :         const double fSin = sin(fCurrentSegmentAngle/2.0);
     773        2192 :         P0.setX(fCos);
     774        2192 :         P3.setX(fCos);
     775        2192 :         P0.setY(-fSin);
     776        2192 :         P3.setY(-P0.getY());
     777             : 
     778        2192 :         P1.setX((4.0-fCos)/3.0);
     779        2192 :         P2.setX(P1.getX());
     780        2192 :         P1.setY((1.0-fCos)*(fCos-3.0)/(3.0*fSin));
     781        2192 :         P2.setY(-P1.getY());
     782             :         //transform thus startangle equals NULL
     783        2192 :         ::basegfx::B2DHomMatrix aStart;
     784        2192 :         aStart.rotate(fCurrentSegmentAngle/2.0 + fCurrentRotateAngle );
     785        2192 :         fCurrentRotateAngle+=fCurrentSegmentAngle;
     786             : 
     787        2192 :         aStart.scale( fUnitRadius, fUnitRadius );
     788             : 
     789             :         //apply given transformation to get final points
     790        2192 :         P0 = rTransformationFromUnitCircle*(aStart*P0);
     791        2192 :         P1 = rTransformationFromUnitCircle*(aStart*P1);
     792        2192 :         P2 = rTransformationFromUnitCircle*(aStart*P2);
     793        2192 :         P3 = rTransformationFromUnitCircle*(aStart*P3);
     794             : 
     795        2192 :         aPoints[nPoint].X = static_cast< sal_Int32 >( P0.getX());
     796        2192 :         aPoints[nPoint].Y = static_cast< sal_Int32 >( P0.getY());
     797        2192 :         aFlags [nPoint++] = drawing::PolygonFlags_NORMAL;
     798             : 
     799        2192 :         aPoints[nPoint].X = static_cast< sal_Int32 >( P1.getX());
     800        2192 :         aPoints[nPoint].Y = static_cast< sal_Int32 >( P1.getY());
     801        2192 :         aFlags[nPoint++] = drawing::PolygonFlags_CONTROL;
     802             : 
     803        2192 :         aPoints[nPoint].X = static_cast< sal_Int32 >( P2.getX());
     804        2192 :         aPoints[nPoint].Y = static_cast< sal_Int32 >( P2.getY());
     805        2192 :         aFlags [nPoint++] = drawing::PolygonFlags_CONTROL;
     806             : 
     807        2192 :         if(nSegment==(nSegmentCount-1))
     808             :         {
     809         304 :             aPoints[nPoint].X = static_cast< sal_Int32 >( P3.getX());
     810         304 :             aPoints[nPoint].Y = static_cast< sal_Int32 >( P3.getY());
     811         304 :             aFlags [nPoint++] = drawing::PolygonFlags_NORMAL;
     812             :         }
     813        2192 :     }
     814             : 
     815         304 :     aReturn.Coordinates[0] = aPoints;
     816         304 :     aReturn.Flags[0] = aFlags;
     817             : 
     818         608 :     return aReturn;
     819             : }
     820             : 
     821         152 : drawing::PolyPolygonBezierCoords getRingBezierCoords(
     822             :             double fUnitCircleInnerRadius
     823             :             , double fUnitCircleOuterRadius
     824             :             , double fStartAngleRadian, double fWidthAngleRadian
     825             :             , ::basegfx::B2DHomMatrix aTransformationFromUnitCircle
     826             :             , const double fAngleSubdivisionRadian )
     827             : {
     828         152 :     drawing::PolyPolygonBezierCoords aReturn = drawing::PolyPolygonBezierCoords();
     829             : 
     830         152 :     aReturn.Coordinates = drawing::PointSequenceSequence(1);
     831         152 :     aReturn.Flags       = drawing::FlagSequenceSequence(1);
     832             : 
     833             :     drawing::PolyPolygonBezierCoords aOuterArc = getCircularArcBezierCoords(
     834         304 :         fStartAngleRadian, fWidthAngleRadian, fUnitCircleOuterRadius, aTransformationFromUnitCircle, fAngleSubdivisionRadian );
     835         152 :     aReturn.Coordinates[0] = aOuterArc.Coordinates[0];
     836         152 :     aReturn.Flags[0] = aOuterArc.Flags[0];
     837             : 
     838             :     drawing::PolyPolygonBezierCoords aInnerArc = getCircularArcBezierCoords(
     839         304 :         fStartAngleRadian, fWidthAngleRadian, fUnitCircleInnerRadius, aTransformationFromUnitCircle, fAngleSubdivisionRadian );
     840         152 :     appendAndCloseBezierCoords( aReturn, aInnerArc, true );
     841             : 
     842         304 :     return aReturn;
     843             : }
     844             : 
     845             : uno::Reference< drawing::XShape >
     846         136 :         ShapeFactory::createPieSegment2D(
     847             :                     const uno::Reference< drawing::XShapes >& xTarget
     848             :                     , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
     849             :                     , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
     850             :                     , const drawing::Direction3D& rOffset
     851             :                     , const drawing::HomogenMatrix& rUnitCircleToScene )
     852             : {
     853         136 :     if( !xTarget.is() )
     854           0 :         return 0;
     855             : 
     856         272 :     while(fUnitCircleWidthAngleDegree>360)
     857           0 :         fUnitCircleWidthAngleDegree -= 360.0;
     858         272 :     while(fUnitCircleWidthAngleDegree<0)
     859           0 :         fUnitCircleWidthAngleDegree += 360.0;
     860             : 
     861             :     //create shape
     862             :     uno::Reference< drawing::XShape > xShape(
     863         136 :             m_xShapeFactory->createInstance(
     864         136 :                 "com.sun.star.drawing.ClosedBezierShape" ), uno::UNO_QUERY );
     865         136 :     xTarget->add(xShape); //need to add the shape before setting of properties
     866             : 
     867             :     //set properties
     868         272 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
     869             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
     870         136 :     if( xProp.is())
     871             :     {
     872             :         try
     873             :         {
     874         136 :             ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) );
     875         136 :             aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY);
     876             : 
     877         136 :             const double fAngleSubdivisionRadian = F_PI/10.0;
     878             : 
     879             :             drawing::PolyPolygonBezierCoords aCoords = getRingBezierCoords(
     880             :                 fUnitCircleInnerRadius, fUnitCircleOuterRadius
     881         272 :                 , fUnitCircleStartAngleDegree*F_PI/180.0, fUnitCircleWidthAngleDegree*F_PI/180.0
     882         544 :                 , aTransformationFromUnitCircle, fAngleSubdivisionRadian );
     883             : 
     884         272 :             xProp->setPropertyValue( "PolyPolygonBezier", uno::makeAny( aCoords ) );
     885             :         }
     886           0 :         catch( const uno::Exception& e )
     887             :         {
     888             :             ASSERT_EXCEPTION( e );
     889             :         }
     890             :     }
     891             : 
     892         272 :     return xShape;
     893             : }
     894             : 
     895             : uno::Reference< drawing::XShape >
     896          16 :         ShapeFactory::createPieSegment(
     897             :                     const uno::Reference< drawing::XShapes >& xTarget
     898             :                     , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
     899             :                     , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
     900             :                     , const drawing::Direction3D& rOffset
     901             :                     , const drawing::HomogenMatrix& rUnitCircleToScene
     902             :                     , double fDepth )
     903             : {
     904          16 :     if( !xTarget.is() )
     905           0 :         return 0;
     906             : 
     907          32 :     while(fUnitCircleWidthAngleDegree>360)
     908           0 :         fUnitCircleWidthAngleDegree -= 360.0;
     909          32 :     while(fUnitCircleWidthAngleDegree<0)
     910           0 :         fUnitCircleWidthAngleDegree += 360.0;
     911             : 
     912             :     //create shape
     913             :     uno::Reference< drawing::XShape > xShape(
     914          16 :         m_xShapeFactory->createInstance(
     915          16 :             "com.sun.star.drawing.Shape3DExtrudeObject" ), uno::UNO_QUERY );
     916          16 :     xTarget->add(xShape); //need to add the shape before setting of properties
     917             : 
     918             :     //set properties
     919          32 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
     920             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
     921          16 :     if( xProp.is())
     922             :     {
     923             :         try
     924             :         {
     925          16 :             ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) );
     926          16 :             aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY);
     927             : 
     928          16 :             const double fAngleSubdivisionRadian = F_PI/32.0;
     929             : 
     930             :             drawing::PolyPolygonBezierCoords aCoords = getRingBezierCoords(
     931             :                 fUnitCircleInnerRadius, fUnitCircleOuterRadius
     932          32 :                 , fUnitCircleStartAngleDegree*F_PI/180.0, fUnitCircleWidthAngleDegree*F_PI/180.0
     933          64 :                 , aTransformationFromUnitCircle, fAngleSubdivisionRadian );
     934             : 
     935             :             //depth
     936          16 :             xProp->setPropertyValue( UNO_NAME_3D_EXTRUDE_DEPTH
     937          16 :                 , uno::makeAny((sal_Int32)fDepth) );
     938             : 
     939             :             //PercentDiagonal
     940          16 :             sal_Int16 nPercentDiagonal = 0;
     941          16 :             xProp->setPropertyValue( UNO_NAME_3D_PERCENT_DIAGONAL
     942          16 :                 , uno::makeAny( nPercentDiagonal ) );
     943             : 
     944             :             //Polygon
     945          32 :             drawing::PolyPolygonShape3D aPoly( BezierToPoly(aCoords) );
     946          16 :             ShapeFactory::closePolygon( aPoly );
     947          16 :             xProp->setPropertyValue( UNO_NAME_3D_POLYPOLYGON3D
     948          16 :                 , uno::makeAny( aPoly ) );
     949             : 
     950             :             //DoubleSided
     951          16 :             xProp->setPropertyValue( UNO_NAME_3D_DOUBLE_SIDED
     952          16 :                 , uno::makeAny( true ) );
     953             : 
     954             :             //Reduced lines
     955          16 :             xProp->setPropertyValue( UNO_NAME_3D_REDUCED_LINE_GEOMETRY
     956          16 :                 , uno::makeAny( true ) );
     957             : 
     958             :             //TextureProjectionMode
     959          16 :             xProp->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_Y
     960          16 :                 , uno::makeAny( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
     961             : 
     962             :             //TextureProjectionMode
     963          16 :             xProp->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_X
     964          16 :                 , uno::makeAny( drawing::TextureProjectionMode_PARALLEL ) );
     965          16 :             xProp->setPropertyValue( UNO_NAME_3D_TEXTURE_PROJ_Y
     966          32 :                 , uno::makeAny( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
     967             :         }
     968           0 :         catch( const uno::Exception& e )
     969             :         {
     970             :             ASSERT_EXCEPTION( e );
     971             :         }
     972             :     }
     973          32 :     return xShape;
     974             : }
     975             : 
     976             : uno::Reference< drawing::XShape >
     977         723 :         ShapeFactory::createStripe( const uno::Reference< drawing::XShapes >& xTarget
     978             :                     , const Stripe& rStripe
     979             :                     , const uno::Reference< beans::XPropertySet >& xSourceProp
     980             :                     , const tPropertyNameMap& rPropertyNameMap
     981             :                     , bool bDoubleSided
     982             :                     , short nRotatedTexture
     983             :                     , bool bFlatNormals )
     984             : {
     985         723 :     if( !xTarget.is() )
     986           0 :         return 0;
     987             : 
     988             :     //create shape
     989             :     uno::Reference< drawing::XShape > xShape(
     990         723 :             m_xShapeFactory->createInstance(
     991         723 :             "com.sun.star.drawing.Shape3DPolygonObject" ), uno::UNO_QUERY );
     992         723 :     xTarget->add(xShape);
     993             : 
     994             :     //set properties
     995        1446 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
     996             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
     997         723 :     if( xProp.is())
     998             :     {
     999             :         try
    1000             :         {
    1001             :             //Polygon
    1002         723 :             xProp->setPropertyValue( UNO_NAME_3D_POLYPOLYGON3D
    1003         723 :                 , rStripe.getPolyPolygonShape3D() );
    1004             : 
    1005             :             //TexturePolygon
    1006         723 :             xProp->setPropertyValue( UNO_NAME_3D_TEXTUREPOLYGON3D
    1007         723 :                 , rStripe.getTexturePolygon( nRotatedTexture ) );
    1008             : 
    1009             :             //Normals Polygon
    1010         723 :             xProp->setPropertyValue( UNO_NAME_3D_NORMALSPOLYGON3D
    1011         723 :                 , rStripe.getNormalsPolygon() );
    1012             :             //NormalsKind
    1013         723 :             if(bFlatNormals)
    1014         723 :                 xProp->setPropertyValue( UNO_NAME_3D_NORMALS_KIND
    1015         723 :                     , uno::makeAny( drawing::NormalsKind_FLAT ) );
    1016             : 
    1017             :             //LineOnly
    1018         723 :             xProp->setPropertyValue( UNO_NAME_3D_LINEONLY
    1019         723 :                 , uno::makeAny( false) );
    1020             : 
    1021             :             //DoubleSided
    1022         723 :             xProp->setPropertyValue( UNO_NAME_3D_DOUBLE_SIDED
    1023         723 :                 , uno::makeAny(bDoubleSided) );
    1024             : 
    1025         723 :             if( xSourceProp.is())
    1026         723 :                 PropertyMapper::setMappedProperties( xProp, xSourceProp, rPropertyNameMap );
    1027             :         }
    1028           0 :         catch( const uno::Exception& e )
    1029             :         {
    1030             :             ASSERT_EXCEPTION( e );
    1031             :         }
    1032             :     }
    1033        1446 :     return xShape;
    1034             : }
    1035             : 
    1036             : uno::Reference< drawing::XShape >
    1037           0 :         ShapeFactory::createArea3D( const uno::Reference< drawing::XShapes >& xTarget
    1038             :                     , const drawing::PolyPolygonShape3D& rPolyPolygon
    1039             :                     , double fDepth )
    1040             : {
    1041           0 :     if( !xTarget.is() )
    1042           0 :         return 0;
    1043             : 
    1044           0 :     if( !rPolyPolygon.SequenceX.getLength())
    1045           0 :         return 0;
    1046             : 
    1047             :     //create shape
    1048             :     uno::Reference< drawing::XShape > xShape(
    1049           0 :         m_xShapeFactory->createInstance(
    1050           0 :             "com.sun.star.drawing.Shape3DExtrudeObject" ), uno::UNO_QUERY );
    1051           0 :     xTarget->add(xShape);
    1052             : 
    1053             :     //set properties
    1054           0 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
    1055             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
    1056           0 :     if( xProp.is())
    1057             :     {
    1058             :         try
    1059             :         {
    1060             :             //depth
    1061           0 :             xProp->setPropertyValue( UNO_NAME_3D_EXTRUDE_DEPTH
    1062           0 :                 , uno::makeAny((sal_Int32)fDepth) );
    1063             : 
    1064             :             //PercentDiagonal
    1065           0 :             sal_Int16 nPercentDiagonal = 0;
    1066           0 :             xProp->setPropertyValue( UNO_NAME_3D_PERCENT_DIAGONAL
    1067           0 :                 , uno::makeAny( nPercentDiagonal ) );
    1068             : 
    1069             :             //Polygon
    1070           0 :             xProp->setPropertyValue( UNO_NAME_3D_POLYPOLYGON3D
    1071           0 :                 , uno::makeAny( rPolyPolygon ) );
    1072             : 
    1073             :             //DoubleSided
    1074           0 :             xProp->setPropertyValue( UNO_NAME_3D_DOUBLE_SIDED
    1075           0 :                 , uno::makeAny( true) );
    1076             : 
    1077             :             //the z component of the polygon is now ignored by the drawing layer,
    1078             :             //so we nned to translate the object via transformation matrix
    1079             : 
    1080             :             //Matrix for position
    1081           0 :             if( rPolyPolygon.SequenceZ.getLength()&& rPolyPolygon.SequenceZ[0].getLength() )
    1082             :             {
    1083           0 :                 ::basegfx::B3DHomMatrix aM;
    1084             :                 aM.translate( 0
    1085             :                             , 0
    1086           0 :                             , rPolyPolygon.SequenceZ[0][0] );
    1087           0 :                 drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
    1088           0 :                 xProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
    1089           0 :                     , uno::makeAny(aHM) );
    1090             :             }
    1091             :         }
    1092           0 :         catch( const uno::Exception& e )
    1093             :         {
    1094             :             ASSERT_EXCEPTION( e );
    1095             :         }
    1096             :     }
    1097           0 :     return xShape;
    1098             : }
    1099             : 
    1100             : uno::Reference< drawing::XShape >
    1101        4865 :         ShapeFactory::createArea2D( const uno::Reference< drawing::XShapes >& xTarget
    1102             :                     , const drawing::PolyPolygonShape3D& rPolyPolygon )
    1103             : {
    1104        4865 :     if( !xTarget.is() )
    1105           0 :         return 0;
    1106             : 
    1107             :     //create shape
    1108             :     uno::Reference< drawing::XShape > xShape(
    1109        4865 :         m_xShapeFactory->createInstance(
    1110        4865 :             "com.sun.star.drawing.PolyPolygonShape" ), uno::UNO_QUERY );
    1111        4865 :     xTarget->add(xShape);
    1112             : 
    1113             :     //set properties
    1114        9730 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
    1115             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
    1116        4865 :     if( xProp.is())
    1117             :     {
    1118             :         try
    1119             :         {
    1120             :             //UNO_NAME_POLYGON "Polygon" drawing::PointSequence*
    1121        4865 :             drawing::PointSequenceSequence aPoints( PolyToPointSequence(rPolyPolygon) );
    1122             : 
    1123             :             //Polygon
    1124        4865 :             xProp->setPropertyValue( UNO_NAME_POLYPOLYGON
    1125        4865 :                 , uno::makeAny( aPoints ) );
    1126             : 
    1127             :             //ZOrder
    1128             :             //an area should always be behind other shapes
    1129        4865 :             xProp->setPropertyValue( UNO_NAME_MISC_OBJ_ZORDER
    1130        4865 :                 , uno::makeAny( sal_Int32(0) ) );
    1131             :         }
    1132           0 :         catch( const uno::Exception& e )
    1133             :         {
    1134             :             ASSERT_EXCEPTION( e );
    1135             :         }
    1136             :     }
    1137        9730 :     return xShape;
    1138             : }
    1139             : 
    1140         446 : drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Position3D& rPos
    1141             :                                  , const drawing::Direction3D& rSize
    1142             :                                  , sal_Int32 nStandardSymbol )
    1143             : {
    1144         446 :     if(nStandardSymbol<0)
    1145           0 :         nStandardSymbol*=-1;
    1146         446 :     nStandardSymbol = nStandardSymbol%ShapeFactory::getSymbolCount();
    1147         446 :     SymbolEnum eSymbolType=static_cast<SymbolEnum>(nStandardSymbol);
    1148             : 
    1149         446 :     const double& fX = rPos.PositionX;
    1150         446 :     const double& fY = rPos.PositionY;
    1151             : 
    1152         446 :     const double fWidthH  = rSize.DirectionX/2.0; //fWidthH stands for Half Width
    1153         446 :     const double fHeightH = rSize.DirectionY/2.0; //fHeightH stands for Half Height
    1154             : 
    1155         446 :     const sal_Int32 nQuarterCount = 35; // points inside a quadrant, used in case circle
    1156             : 
    1157         446 :     sal_Int32 nPointCount = 4; //all arrow symbols only need 4 points
    1158         446 :     switch( eSymbolType )
    1159             :     {
    1160             :         case Symbol_Square:
    1161             :         case Symbol_Diamond:
    1162             :         case Symbol_Bowtie:
    1163             :         case Symbol_Sandglass:
    1164             :         case Symbol_HorizontalBar:
    1165             :         case Symbol_VerticalBar:
    1166         254 :             nPointCount = 5;
    1167         254 :             break;
    1168             :         case Symbol_X:
    1169          34 :             nPointCount = 13;
    1170          34 :             break;
    1171             :         case Symbol_Plus:
    1172           6 :             nPointCount = 13;
    1173           6 :             break;
    1174             :         case Symbol_Star:
    1175           6 :             nPointCount = 9;
    1176           6 :             break;
    1177             :         case Symbol_Asterisk:
    1178         102 :             nPointCount = 19;
    1179         102 :             break;
    1180             :         case Symbol_Circle:
    1181          14 :             nPointCount = 5 + 4 * nQuarterCount;
    1182          14 :             break;
    1183             :         default:
    1184          30 :             break;
    1185             :     }
    1186             : 
    1187         446 :     drawing::PolyPolygonShape3D aPP;
    1188             : 
    1189         446 :     aPP.SequenceX.realloc(1);
    1190         446 :     aPP.SequenceY.realloc(1);
    1191         446 :     aPP.SequenceZ.realloc(1);
    1192             : 
    1193         446 :     drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
    1194         446 :     drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
    1195         446 :     drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
    1196             : 
    1197         446 :     pOuterSequenceX->realloc(nPointCount);
    1198         446 :     pOuterSequenceY->realloc(nPointCount);
    1199         446 :     pOuterSequenceZ->realloc(nPointCount);
    1200             : 
    1201         446 :     double* pInnerSequenceX = pOuterSequenceX->getArray();
    1202         446 :     double* pInnerSequenceY = pOuterSequenceY->getArray();
    1203         446 :     double* pInnerSequenceZ = pOuterSequenceZ->getArray();
    1204             : 
    1205        6824 :     for(sal_Int32 nN = nPointCount; nN--;)
    1206        5932 :         *pInnerSequenceZ++ = 0.0;
    1207             : 
    1208         446 :     switch(eSymbolType)
    1209             :     {
    1210             :         case Symbol_Square:
    1211             :         {
    1212         200 :             *pInnerSequenceX++ = fX-fWidthH;
    1213         200 :             *pInnerSequenceY++ = fY-fHeightH;
    1214             : 
    1215         200 :             *pInnerSequenceX++ = fX-fWidthH;
    1216         200 :             *pInnerSequenceY++ = fY+fHeightH;
    1217             : 
    1218         200 :             *pInnerSequenceX++ = fX+fWidthH;
    1219         200 :             *pInnerSequenceY++ = fY+fHeightH;
    1220             : 
    1221         200 :             *pInnerSequenceX++ = fX+fWidthH;
    1222         200 :             *pInnerSequenceY++ = fY-fHeightH;
    1223             : 
    1224         200 :             *pInnerSequenceX++ = fX-fWidthH;
    1225         200 :             *pInnerSequenceY++ = fY-fHeightH;
    1226         200 :             break;
    1227             :         }
    1228             :         case Symbol_UpArrow:
    1229             :         {
    1230           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1231           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1232             : 
    1233           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1234           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1235             : 
    1236           6 :             *pInnerSequenceX++ = fX;
    1237           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1238             : 
    1239           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1240           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1241           6 :             break;
    1242             :         }
    1243             :         case Symbol_DownArrow:
    1244             :         {
    1245          12 :             *pInnerSequenceX++ = fX-fWidthH;
    1246          12 :             *pInnerSequenceY++ = fY-fHeightH;
    1247             : 
    1248          12 :             *pInnerSequenceX++ = fX;
    1249          12 :             *pInnerSequenceY++ = fY+fHeightH;
    1250             : 
    1251          12 :             *pInnerSequenceX++ = fX+fWidthH;
    1252          12 :             *pInnerSequenceY++ = fY-fHeightH;
    1253             : 
    1254          12 :             *pInnerSequenceX++ = fX-fWidthH;
    1255          12 :             *pInnerSequenceY++ = fY-fHeightH;
    1256          12 :             break;
    1257             :         }
    1258             :         case Symbol_RightArrow:
    1259             :         {
    1260           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1261           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1262             : 
    1263           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1264           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1265             : 
    1266           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1267           6 :             *pInnerSequenceY++ = fY;
    1268             : 
    1269           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1270           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1271           6 :             break;
    1272             :         }
    1273             :         case Symbol_LeftArrow:
    1274             :         {
    1275           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1276           6 :             *pInnerSequenceY++ = fY;
    1277             : 
    1278           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1279           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1280             : 
    1281           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1282           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1283             : 
    1284           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1285           6 :             *pInnerSequenceY++ = fY;
    1286           6 :             break;
    1287             :         }
    1288             :         case Symbol_Bowtie:
    1289             :         {
    1290           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1291           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1292             : 
    1293           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1294           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1295             : 
    1296           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1297           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1298             : 
    1299           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1300           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1301             : 
    1302           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1303           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1304           6 :             break;
    1305             :         }
    1306             :         case Symbol_Sandglass:
    1307             :         {
    1308           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1309           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1310             : 
    1311           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1312           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1313             : 
    1314           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1315           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1316             : 
    1317           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1318           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1319             : 
    1320           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1321           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1322           6 :             break;
    1323             :         }
    1324             :         case Symbol_Diamond:
    1325             :         {
    1326          42 :             *pInnerSequenceX++ = fX-fWidthH;
    1327          42 :             *pInnerSequenceY++ = fY;
    1328             : 
    1329          42 :             *pInnerSequenceX++ = fX;
    1330          42 :             *pInnerSequenceY++ = fY+fHeightH;
    1331             : 
    1332          42 :             *pInnerSequenceX++ = fX+fWidthH;
    1333          42 :             *pInnerSequenceY++ = fY;
    1334             : 
    1335          42 :             *pInnerSequenceX++ = fX;
    1336          42 :             *pInnerSequenceY++ = fY-fHeightH;
    1337             : 
    1338          42 :             *pInnerSequenceX++ = fX-fWidthH;
    1339          42 :             *pInnerSequenceY++ = fY;
    1340          42 :             break;
    1341             :         }
    1342             :         case Symbol_HorizontalBar:
    1343             :         {
    1344           0 :             *pInnerSequenceX++ = fX-fWidthH;
    1345           0 :             *pInnerSequenceY++ = fY-0.2*fHeightH;
    1346             : 
    1347           0 :             *pInnerSequenceX++ = fX+fWidthH;
    1348           0 :             *pInnerSequenceY++ = fY-0.2*fHeightH;
    1349             : 
    1350           0 :             *pInnerSequenceX++ = fX+fWidthH;
    1351           0 :             *pInnerSequenceY++ = fY+0.2*fHeightH;
    1352             : 
    1353           0 :             *pInnerSequenceX++ = fX-fWidthH;
    1354           0 :             *pInnerSequenceY++ = fY+0.2*fHeightH;
    1355             : 
    1356           0 :             *pInnerSequenceX++ = fX-fWidthH;
    1357           0 :             *pInnerSequenceY++ = fY-0.2*fHeightH;
    1358           0 :             break;
    1359             :         }
    1360             :         case Symbol_VerticalBar:
    1361             :         {
    1362           0 :             *pInnerSequenceX++ = fX-0.2*fWidthH;
    1363           0 :             *pInnerSequenceY++ = fY-fHeightH;
    1364             : 
    1365           0 :             *pInnerSequenceX++ = fX+0.2*fWidthH;
    1366           0 :             *pInnerSequenceY++ = fY-fHeightH;
    1367             : 
    1368           0 :             *pInnerSequenceX++ = fX+0.2*fWidthH;
    1369           0 :             *pInnerSequenceY++ = fY+fHeightH;
    1370             : 
    1371           0 :             *pInnerSequenceX++ = fX-0.2*fWidthH;
    1372           0 :             *pInnerSequenceY++ = fY+fHeightH;
    1373             : 
    1374           0 :             *pInnerSequenceX++ = fX-0.2*fWidthH;
    1375           0 :             *pInnerSequenceY++ = fY-fHeightH;
    1376             : 
    1377           0 :             break;
    1378             :         }
    1379             :         case Symbol_Circle:
    1380             :         {
    1381          14 :             double fOmega = 1.5707963267948966192 / (nQuarterCount + 1.0);
    1382             :             // one point in the middle of each edge to get full size bounding rectangle
    1383          14 :             *pInnerSequenceX++ = fX + fWidthH;
    1384          14 :             *pInnerSequenceY++ = fY;
    1385             :             // 0 to PI/2
    1386         504 :             for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
    1387             :             {
    1388         490 :                 *pInnerSequenceX++ = fX + fWidthH * cos( i * fOmega );
    1389         490 :                 *pInnerSequenceY++ = fY - fHeightH * sin( i * fOmega );
    1390             :             }
    1391             :             // PI/2 to PI
    1392          14 :             *pInnerSequenceX++ = fX;
    1393          14 :             *pInnerSequenceY++ = fY - fHeightH;
    1394         504 :             for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
    1395             :             {
    1396         490 :                 *pInnerSequenceX++ = fX - fWidthH * sin( i * fOmega);
    1397         490 :                 *pInnerSequenceY++ = fY - fHeightH * cos( i * fOmega);
    1398             :             }
    1399             :             // PI to 3/2*PI
    1400          14 :             *pInnerSequenceX++ = fX - fWidthH;
    1401          14 :             *pInnerSequenceY++ = fY;
    1402         504 :             for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
    1403             :             {
    1404         490 :                 *pInnerSequenceX++ = fX - fWidthH * cos( i * fOmega);
    1405         490 :                 *pInnerSequenceY++ = fY + fHeightH * sin( i * fOmega);
    1406             :             }
    1407             :             // 3/2*PI to 2*PI
    1408          14 :             *pInnerSequenceX++ = fX;
    1409          14 :             *pInnerSequenceY++ = fY + fHeightH;
    1410         504 :             for (sal_Int32 i = 1; i <= nQuarterCount; ++i)
    1411             :             {
    1412         490 :                 *pInnerSequenceX++ = fX + fWidthH * sin(i * fOmega);
    1413         490 :                 *pInnerSequenceY++ = fY + fHeightH * cos(i * fOmega);
    1414             :             }
    1415             :             // close polygon
    1416          14 :             *pInnerSequenceX++ = fX + fWidthH;
    1417          14 :             *pInnerSequenceY++ = fY;
    1418          14 :             break;
    1419             :         }
    1420             :         case Symbol_Star:
    1421             :         {
    1422           6 :             *pInnerSequenceX++ = fX;
    1423           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1424             : 
    1425           6 :             *pInnerSequenceX++ = fX+0.2*fWidthH;
    1426           6 :             *pInnerSequenceY++ = fY-0.2*fHeightH;
    1427             : 
    1428           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1429           6 :             *pInnerSequenceY++ = fY;
    1430             : 
    1431           6 :             *pInnerSequenceX++ = fX+0.2*fWidthH;
    1432           6 :             *pInnerSequenceY++ = fY+0.2*fHeightH;
    1433             : 
    1434           6 :             *pInnerSequenceX++ = fX;
    1435           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1436             : 
    1437           6 :             *pInnerSequenceX++ = fX-0.2*fWidthH;
    1438           6 :             *pInnerSequenceY++ = fY+0.2*fHeightH;
    1439             : 
    1440           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1441           6 :             *pInnerSequenceY++ = fY;
    1442             : 
    1443           6 :             *pInnerSequenceX++ = fX-0.2*fWidthH;
    1444           6 :             *pInnerSequenceY++ = fY-0.2*fHeightH;
    1445             : 
    1446           6 :             *pInnerSequenceX++ = fX;
    1447           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1448           6 :             break;
    1449             :         }
    1450             :         case Symbol_X:
    1451             :         {
    1452          34 :             const double fScaleX = fWidthH / 128.0;
    1453          34 :             const double fScaleY = fHeightH / 128.0;
    1454          34 :             const double fSmall = sqrt(200.0);
    1455          34 :             const double fLarge = 128.0 - fSmall;
    1456             : 
    1457          34 :             *pInnerSequenceX++ = fX;
    1458          34 :             *pInnerSequenceY++ = fY - fScaleY * fSmall;
    1459             : 
    1460          34 :             *pInnerSequenceX++ = fX - fScaleX * fLarge;
    1461          34 :             *pInnerSequenceY++ = fY - fHeightH;
    1462             : 
    1463          34 :             *pInnerSequenceX++ = fX - fWidthH;
    1464          34 :             *pInnerSequenceY++ = fY - fScaleY * fLarge;
    1465             : 
    1466          34 :             *pInnerSequenceX++ = fX - fScaleX * fSmall;
    1467          34 :             *pInnerSequenceY++ = fY;
    1468             : 
    1469          34 :             *pInnerSequenceX++ = fX - fWidthH;
    1470          34 :             *pInnerSequenceY++ = fY + fScaleY * fLarge;
    1471             : 
    1472          34 :             *pInnerSequenceX++ = fX - fScaleX * fLarge;
    1473          34 :             *pInnerSequenceY++ = fY + fHeightH;
    1474             : 
    1475          34 :             *pInnerSequenceX++ = fX;
    1476          34 :             *pInnerSequenceY++ = fY + fScaleY * fSmall;
    1477             : 
    1478          34 :             *pInnerSequenceX++ = fX + fScaleX * fLarge;
    1479          34 :             *pInnerSequenceY++ = fY + fHeightH;
    1480             : 
    1481          34 :             *pInnerSequenceX++ = fX + fWidthH;
    1482          34 :             *pInnerSequenceY++ = fY + fScaleY * fLarge;
    1483             : 
    1484          34 :             *pInnerSequenceX++ = fX + fScaleX * fSmall;
    1485          34 :             *pInnerSequenceY++ = fY;
    1486             : 
    1487          34 :             *pInnerSequenceX++ = fX + fWidthH;
    1488          34 :             *pInnerSequenceY++ = fY - fScaleY * fLarge;
    1489             : 
    1490          34 :             *pInnerSequenceX++ = fX + fScaleX * fLarge;
    1491          34 :             *pInnerSequenceY++ = fY - fHeightH;
    1492             : 
    1493          34 :             *pInnerSequenceX++ = fX;
    1494          34 :             *pInnerSequenceY++ = fY - fScaleY * fSmall;
    1495          34 :             break;
    1496             : 
    1497             :         }
    1498             :         case Symbol_Plus:
    1499             :         {
    1500           6 :             const double fScaleX = fWidthH / 128.0;
    1501           6 :             const double fScaleY = fHeightH / 128.0;
    1502           6 :             const double fHalf = 10.0; //half line width on 256 size square
    1503           6 :             const double fdX = fScaleX * fHalf;
    1504           6 :             const double fdY = fScaleY * fHalf;
    1505             : 
    1506           6 :             *pInnerSequenceX++ = fX-fdX;
    1507           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1508             : 
    1509           6 :             *pInnerSequenceX++ = fX-fdX;
    1510           6 :             *pInnerSequenceY++ = fY-fdY;
    1511             : 
    1512           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1513           6 :             *pInnerSequenceY++ = fY-fdY;
    1514             : 
    1515           6 :             *pInnerSequenceX++ = fX-fWidthH;
    1516           6 :             *pInnerSequenceY++ = fY+fdY;
    1517             : 
    1518           6 :             *pInnerSequenceX++ = fX-fdX;
    1519           6 :             *pInnerSequenceY++ = fY+fdY;
    1520             : 
    1521           6 :             *pInnerSequenceX++ = fX-fdX;
    1522           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1523             : 
    1524           6 :             *pInnerSequenceX++ = fX+fdX;
    1525           6 :             *pInnerSequenceY++ = fY+fHeightH;
    1526             : 
    1527           6 :             *pInnerSequenceX++ = fX+fdX;
    1528           6 :             *pInnerSequenceY++ = fY+fdY;
    1529             : 
    1530           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1531           6 :             *pInnerSequenceY++ = fY+fdY;
    1532             : 
    1533           6 :             *pInnerSequenceX++ = fX+fWidthH;
    1534           6 :             *pInnerSequenceY++ = fY-fdY;
    1535             : 
    1536           6 :             *pInnerSequenceX++ = fX+fdX;
    1537           6 :             *pInnerSequenceY++ = fY-fdY;
    1538             : 
    1539           6 :             *pInnerSequenceX++ = fX+fdY;
    1540           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1541             : 
    1542           6 :             *pInnerSequenceX++ = fX-fdX;
    1543           6 :             *pInnerSequenceY++ = fY-fHeightH;
    1544           6 :             break;
    1545             : 
    1546             :         }
    1547             :         case Symbol_Asterisk:
    1548             :         {
    1549         102 :             const double fHalf = 10.0; // half line width on 256 size square
    1550         102 :             const double fTwoY = fHalf * sqrt(3.0);
    1551         102 :             const double fFourY = (128.0 - 2.0 * fHalf ) / sqrt(3.0);
    1552         102 :             const double fThreeX = 128.0 - fHalf;
    1553         102 :             const double fThreeY = fHalf * sqrt(3.0) + fFourY;
    1554         102 :             const double fFiveX = 2.0 * fHalf;
    1555             : 
    1556         102 :             const double fScaleX = fWidthH / 128.0;
    1557         102 :             const double fScaleY = fHeightH / 128.0;
    1558             : 
    1559             :             //1
    1560         102 :             *pInnerSequenceX++ = fX-fScaleX * fHalf;
    1561         102 :             *pInnerSequenceY++ = fY-fHeightH;
    1562             :             //2
    1563         102 :             *pInnerSequenceX++ = fX-fScaleX * fHalf;
    1564         102 :             *pInnerSequenceY++ = fY-fScaleY * fTwoY;
    1565             :             //3
    1566         102 :             *pInnerSequenceX++ = fX-fScaleX * fThreeX;
    1567         102 :             *pInnerSequenceY++ = fY-fScaleY * fThreeY;
    1568             :             //4
    1569         102 :             *pInnerSequenceX++ = fX-fWidthH;
    1570         102 :             *pInnerSequenceY++ = fY-fScaleY * fFourY;
    1571             :             //5
    1572         102 :             *pInnerSequenceX++ = fX-fScaleX * fFiveX;
    1573         102 :             *pInnerSequenceY++ = fY;
    1574             :             //6 as 4
    1575         102 :             *pInnerSequenceX++ = fX-fWidthH;
    1576         102 :             *pInnerSequenceY++ = fY+fScaleY * fFourY;
    1577             :             //7 as 3
    1578         102 :             *pInnerSequenceX++ = fX-fScaleX * fThreeX;
    1579         102 :             *pInnerSequenceY++ = fY+fScaleY * fThreeY;
    1580             :             //8 as 2
    1581         102 :             *pInnerSequenceX++ = fX-fScaleX * fHalf;
    1582         102 :             *pInnerSequenceY++ = fY+fScaleY * fTwoY;
    1583             :             //9 as 1
    1584         102 :             *pInnerSequenceX++ = fX-fScaleX * fHalf;
    1585         102 :             *pInnerSequenceY++ = fY+fHeightH;
    1586             :             //10 as 1
    1587         102 :             *pInnerSequenceX++ = fX+fScaleX * fHalf;
    1588         102 :             *pInnerSequenceY++ = fY+fHeightH;
    1589             :             //11 as 2
    1590         102 :             *pInnerSequenceX++ = fX+fScaleX * fHalf;
    1591         102 :             *pInnerSequenceY++ = fY+fScaleY * fTwoY;
    1592             :             //12 as 3
    1593         102 :             *pInnerSequenceX++ = fX+fScaleX * fThreeX;
    1594         102 :             *pInnerSequenceY++ = fY+fScaleY * fThreeY;
    1595             :             //13 as 4
    1596         102 :             *pInnerSequenceX++ = fX+fWidthH;
    1597         102 :             *pInnerSequenceY++ = fY+fScaleY * fFourY;
    1598             :             //14 as 5
    1599         102 :             *pInnerSequenceX++ = fX+fScaleX * fFiveX;
    1600         102 :             *pInnerSequenceY++ = fY;
    1601             :             //15 as 4
    1602         102 :             *pInnerSequenceX++ = fX+fWidthH;
    1603         102 :             *pInnerSequenceY++ = fY-fScaleY * fFourY;
    1604             :             //16 as 3
    1605         102 :             *pInnerSequenceX++ = fX+fScaleX * fThreeX;
    1606         102 :             *pInnerSequenceY++ = fY-fScaleY * fThreeY;
    1607             :             //17 as 2
    1608         102 :             *pInnerSequenceX++ = fX+fScaleX * fHalf;
    1609         102 :             *pInnerSequenceY++ = fY-fScaleY * fTwoY;
    1610             :             // 18 as 1
    1611         102 :             *pInnerSequenceX++ = fX+fScaleX * fHalf;
    1612         102 :             *pInnerSequenceY++ = fY-fHeightH;
    1613             :             // 19 = 1, closing
    1614         102 :             *pInnerSequenceX++ = fX-fScaleX * fHalf;
    1615         102 :             *pInnerSequenceY++ = fY-fHeightH;
    1616         102 :             break;
    1617             :         }
    1618             :         default: //case Symbol_Square:
    1619             :         {
    1620           0 :             *pInnerSequenceX++ = fX-fWidthH;
    1621           0 :             *pInnerSequenceY++ = fY-fHeightH;
    1622             : 
    1623           0 :             *pInnerSequenceX++ = fX-fWidthH;
    1624           0 :             *pInnerSequenceY++ = fY+fHeightH;
    1625             : 
    1626           0 :             *pInnerSequenceX++ = fX+fWidthH;
    1627           0 :             *pInnerSequenceY++ = fY+fHeightH;
    1628             : 
    1629           0 :             *pInnerSequenceX++ = fX+fWidthH;
    1630           0 :             *pInnerSequenceY++ = fY-fHeightH;
    1631             : 
    1632           0 :             *pInnerSequenceX++ = fX-fWidthH;
    1633           0 :             *pInnerSequenceY++ = fY-fHeightH;
    1634           0 :             break;
    1635             :         }
    1636             :     }
    1637             : 
    1638         446 :     return aPP;
    1639             : }
    1640             : 
    1641             : uno::Reference< drawing::XShape >
    1642         446 :         ShapeFactory::createSymbol2D(
    1643             :                       const uno::Reference< drawing::XShapes >& xTarget
    1644             :                     , const drawing::Position3D& rPosition
    1645             :                     , const drawing::Direction3D& rSize
    1646             :                     , sal_Int32 nStandardSymbol
    1647             :                     , sal_Int32 nBorderColor
    1648             :                     , sal_Int32 nFillColor )
    1649             : {
    1650         446 :     if( !xTarget.is() )
    1651           0 :         return 0;
    1652             : 
    1653             :     //create shape
    1654             :     uno::Reference< drawing::XShape > xShape(
    1655         446 :         m_xShapeFactory->createInstance(
    1656         446 :             "com.sun.star.drawing.PolyPolygonShape" ), uno::UNO_QUERY );
    1657         446 :     xTarget->add(xShape);
    1658             : 
    1659             :     //set properties
    1660         892 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
    1661             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
    1662         446 :     if( xProp.is())
    1663             :     {
    1664             :         try
    1665             :         {
    1666             :             drawing::PointSequenceSequence aPoints( PolyToPointSequence(
    1667         446 :                 createPolyPolygon_Symbol( rPosition, rSize, nStandardSymbol ) ));
    1668             : 
    1669             :             //Polygon
    1670         446 :             xProp->setPropertyValue( UNO_NAME_POLYPOLYGON
    1671         446 :                 , uno::makeAny( aPoints ) );
    1672             : 
    1673             :             //LineColor
    1674         446 :             xProp->setPropertyValue( UNO_NAME_LINECOLOR
    1675         446 :                 , uno::makeAny( nBorderColor ) );
    1676             : 
    1677             :             //FillColor
    1678         446 :             xProp->setPropertyValue( UNO_NAME_FILLCOLOR
    1679         446 :                 , uno::makeAny( nFillColor ) );
    1680             :         }
    1681           0 :         catch( const uno::Exception& e )
    1682             :         {
    1683             :             ASSERT_EXCEPTION( e );
    1684             :         }
    1685             :     }
    1686         892 :     return xShape;
    1687             : }
    1688             : 
    1689             : uno::Reference< drawing::XShape >
    1690           0 :         ShapeFactory::createGraphic2D(
    1691             :                       const uno::Reference< drawing::XShapes >& xTarget
    1692             :                     , const drawing::Position3D& rPosition
    1693             :                     , const drawing::Direction3D& rSize
    1694             :                     , const uno::Reference< graphic::XGraphic >& xGraphic )
    1695             : {
    1696           0 :     if( !xTarget.is() || !xGraphic.is() )
    1697           0 :         return 0;
    1698             : 
    1699             :     // @todo: change this to a rectangle shape with a fill bitmap for
    1700             :     // performance reasons (ask AW, said CL)
    1701             : 
    1702             :     //create shape
    1703             :     uno::Reference< drawing::XShape > xShape(
    1704           0 :         m_xShapeFactory->createInstance(
    1705           0 :             "com.sun.star.drawing.GraphicObjectShape" ), uno::UNO_QUERY );
    1706           0 :     xTarget->add(xShape);
    1707             : 
    1708             :     try
    1709             :     {
    1710             :         // assume position is upper left corner. Transform to center.
    1711             :         drawing::Position3D aCenterPosition(
    1712           0 :             rPosition.PositionX - (rSize.DirectionX / 2.0),
    1713           0 :             rPosition.PositionY - (rSize.DirectionY / 2.0),
    1714           0 :             rPosition.PositionZ );
    1715           0 :         xShape->setPosition( Position3DToAWTPoint( aCenterPosition ));
    1716           0 :         xShape->setSize( Direction3DToAWTSize( rSize ));
    1717             :     }
    1718           0 :     catch( const uno::Exception & e )
    1719             :     {
    1720             :         ASSERT_EXCEPTION( e );
    1721             :     }
    1722           0 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
    1723             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
    1724           0 :     if( xProp.is())
    1725             :     {
    1726             :         try
    1727             :         {
    1728           0 :             xProp->setPropertyValue( "Graphic", uno::makeAny( xGraphic ));
    1729             :         }
    1730           0 :         catch( const uno::Exception& e )
    1731             :         {
    1732             :             ASSERT_EXCEPTION( e );
    1733             :         }
    1734             :     }
    1735           0 :     return xShape;
    1736             : }
    1737             : 
    1738             : uno::Reference< drawing::XShapes >
    1739       19699 :         ShapeFactory::createGroup2D( const uno::Reference< drawing::XShapes >& xTarget
    1740             :         , const OUString& aName )
    1741             : {
    1742       19699 :     if( !xTarget.is() )
    1743           0 :         return 0;
    1744             :     try
    1745             :     {
    1746             :         //create and add to target
    1747             :         uno::Reference< drawing::XShape > xShape(
    1748       19699 :                     m_xShapeFactory->createInstance(
    1749       19699 :                     "com.sun.star.drawing.GroupShape" ), uno::UNO_QUERY );
    1750       19699 :         xTarget->add(xShape);
    1751             : 
    1752             :         //set name
    1753       19699 :         if(!aName.isEmpty())
    1754       11299 :             setShapeName( xShape , aName );
    1755             : 
    1756             :         {//workaround
    1757             :             //need this null size as otherwise empty group shapes where painted with a gray border
    1758       19699 :             xShape->setSize(awt::Size(0,0));
    1759             :         }
    1760             : 
    1761             :         //return
    1762             :         uno::Reference< drawing::XShapes > xShapes =
    1763       39398 :             uno::Reference<drawing::XShapes>( xShape, uno::UNO_QUERY );
    1764       39398 :         return xShapes;
    1765             :     }
    1766           0 :     catch( const uno::Exception& e )
    1767             :     {
    1768             :         ASSERT_EXCEPTION( e );
    1769             :     }
    1770           0 :     return 0;
    1771             : }
    1772             : 
    1773             : uno::Reference< drawing::XShapes >
    1774        1406 :         ShapeFactory::createGroup3D( const uno::Reference< drawing::XShapes >& xTarget
    1775             :         , const OUString& aName )
    1776             : {
    1777        1406 :     if( !xTarget.is() )
    1778           0 :         return 0;
    1779             :     try
    1780             :     {
    1781             :         //create shape
    1782             :         uno::Reference< drawing::XShape > xShape(
    1783        1406 :                 m_xShapeFactory->createInstance(
    1784        1406 :                 "com.sun.star.drawing.Shape3DSceneObject" ), uno::UNO_QUERY );
    1785             : 
    1786        1406 :         xTarget->add(xShape);
    1787             : 
    1788             :         //it is necessary to set the transform matrix to initialize the scene properly
    1789             :         //otherwise all objects which are placed into this Group will not be visible
    1790             :         //the following should be unnecessary after a the bug is fixed
    1791             :         {
    1792             :             //set properties
    1793        1406 :             uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
    1794             :             OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
    1795        1406 :             if( xProp.is())
    1796             :             {
    1797             :                 try
    1798             :                 {
    1799        1406 :                     ::basegfx::B3DHomMatrix aM;
    1800        1406 :                     xProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
    1801        1406 :                         , uno::makeAny(B3DHomMatrixToHomogenMatrix(aM)) );
    1802             :                 }
    1803           0 :                 catch( const uno::Exception& e )
    1804             :                 {
    1805             :                     ASSERT_EXCEPTION( e );
    1806             :                 }
    1807        1406 :             }
    1808             :         }
    1809             : 
    1810             :         //set name
    1811        1406 :         if(!aName.isEmpty())
    1812         992 :             setShapeName( xShape , aName );
    1813             : 
    1814             :         //return
    1815             :         uno::Reference< drawing::XShapes > xShapes =
    1816        2812 :                 uno::Reference<drawing::XShapes>( xShape, uno::UNO_QUERY );
    1817        2812 :         return xShapes;
    1818             :     }
    1819           0 :     catch( const uno::Exception& e )
    1820             :     {
    1821             :         ASSERT_EXCEPTION( e );
    1822             :     }
    1823           0 :     return 0;
    1824             : }
    1825             : 
    1826             : uno::Reference< drawing::XShape >
    1827           0 :         ShapeFactory::createCircle2D( const uno::Reference< drawing::XShapes >& xTarget
    1828             :                     , const drawing::Position3D& rPosition
    1829             :                     , const drawing::Direction3D& rSize )
    1830             : {
    1831           0 :     if( !xTarget.is() )
    1832           0 :         return 0;
    1833             : 
    1834             :     //create shape
    1835             :     uno::Reference< drawing::XShape > xShape(
    1836           0 :         m_xShapeFactory->createInstance(
    1837           0 :             "com.sun.star.drawing.EllipseShape" ), uno::UNO_QUERY );
    1838           0 :     xTarget->add(xShape);
    1839             : 
    1840             :     try
    1841             :     {
    1842             :         drawing::Position3D aCenterPosition(
    1843           0 :             rPosition.PositionX - (rSize.DirectionX / 2.0),
    1844           0 :             rPosition.PositionY - (rSize.DirectionY / 2.0),
    1845           0 :             rPosition.PositionZ );
    1846           0 :         xShape->setPosition( Position3DToAWTPoint( aCenterPosition ));
    1847           0 :         xShape->setSize( Direction3DToAWTSize( rSize ));
    1848             :     }
    1849           0 :     catch( const uno::Exception & e )
    1850             :     {
    1851             :         ASSERT_EXCEPTION( e );
    1852             :     }
    1853             : 
    1854             :     //set properties
    1855           0 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
    1856             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
    1857           0 :     if( xProp.is())
    1858             :     {
    1859             :         try
    1860             :         {
    1861           0 :             drawing::CircleKind eKind = drawing::CircleKind_FULL;
    1862           0 :             xProp->setPropertyValue( UNO_NAME_CIRCKIND
    1863           0 :                 , uno::makeAny( eKind ) );
    1864             :         }
    1865           0 :         catch( const uno::Exception& e )
    1866             :         {
    1867             :             ASSERT_EXCEPTION( e );
    1868             :         }
    1869             :     }
    1870           0 :     return xShape;
    1871             : }
    1872             : 
    1873             : uno::Reference< drawing::XShape >
    1874           0 :     ShapeFactory::createCircle( const uno::Reference< drawing::XShapes >& xTarget
    1875             :                     , const awt::Size& rSize
    1876             :                     , const awt::Point& rPosition )
    1877             : {
    1878             :     uno::Reference< drawing::XShape > xShape(
    1879           0 :         m_xShapeFactory->createInstance(
    1880           0 :             "com.sun.star.drawing.EllipseShape" ), uno::UNO_QUERY );
    1881           0 :     xTarget->add(xShape);
    1882           0 :     xShape->setSize( rSize );
    1883           0 :     xShape->setPosition( rPosition );
    1884             : 
    1885           0 :     return xShape;
    1886             : }
    1887             : 
    1888             : uno::Reference< drawing::XShape >
    1889          22 :         ShapeFactory::createLine3D( const uno::Reference< drawing::XShapes >& xTarget
    1890             :                     , const drawing::PolyPolygonShape3D& rPoints
    1891             :                     , const VLineProperties& rLineProperties )
    1892             : {
    1893          22 :     if( !xTarget.is() )
    1894           0 :         return 0;
    1895             : 
    1896          22 :     if(!rPoints.SequenceX.getLength())
    1897           0 :         return NULL;
    1898             : 
    1899             :     //create shape
    1900             :     uno::Reference< drawing::XShape > xShape(
    1901          22 :         m_xShapeFactory->createInstance(
    1902          22 :             "com.sun.star.drawing.Shape3DPolygonObject" ), uno::UNO_QUERY );
    1903          22 :     xTarget->add(xShape);
    1904             : 
    1905             :     //set properties
    1906          44 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
    1907             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
    1908          22 :     if( xProp.is())
    1909             :     {
    1910             :         try
    1911             :         {
    1912             :             //Polygon
    1913          22 :             xProp->setPropertyValue( UNO_NAME_3D_POLYPOLYGON3D
    1914          22 :                 , uno::makeAny( rPoints ) );
    1915             : 
    1916             :             //LineOnly
    1917          22 :             xProp->setPropertyValue( UNO_NAME_3D_LINEONLY
    1918          22 :                 , uno::makeAny( true ) );
    1919             : 
    1920             :             //Transparency
    1921          22 :             if(rLineProperties.Transparence.hasValue())
    1922          22 :                 xProp->setPropertyValue( UNO_NAME_LINETRANSPARENCE
    1923          22 :                     , rLineProperties.Transparence );
    1924             : 
    1925             :             //LineStyle
    1926          22 :             if(rLineProperties.LineStyle.hasValue())
    1927          22 :                 xProp->setPropertyValue( UNO_NAME_LINESTYLE
    1928          22 :                     , rLineProperties.LineStyle );
    1929             : 
    1930             :             //LineWidth
    1931          22 :             if(rLineProperties.Width.hasValue())
    1932          22 :                 xProp->setPropertyValue( UNO_NAME_LINEWIDTH
    1933          22 :                     , rLineProperties.Width );
    1934             : 
    1935             :             //LineColor
    1936          22 :             if(rLineProperties.Color.hasValue())
    1937          22 :                 xProp->setPropertyValue( UNO_NAME_LINECOLOR
    1938          22 :                     , rLineProperties.Color );
    1939             :                     //, uno::makeAny( sal_Int32( Color(COL_RED).GetColor()) ) );
    1940             :         }
    1941           0 :         catch( const uno::Exception& e )
    1942             :         {
    1943             :             ASSERT_EXCEPTION( e );
    1944             :         }
    1945             :     }
    1946          44 :     return xShape;
    1947             : }
    1948             : 
    1949             : uno::Reference< drawing::XShape >
    1950        3728 :         ShapeFactory::createLine2D( const uno::Reference< drawing::XShapes >& xTarget
    1951             :                     , const drawing::PointSequenceSequence& rPoints
    1952             :                     , const VLineProperties* pLineProperties )
    1953             : {
    1954        3728 :     if( !xTarget.is() )
    1955           0 :         return 0;
    1956             : 
    1957        3728 :     if(!rPoints.getLength())
    1958           0 :         return NULL;
    1959             : 
    1960             :     //create shape
    1961             :     uno::Reference< drawing::XShape > xShape(
    1962        3728 :         m_xShapeFactory->createInstance(
    1963        3728 :             "com.sun.star.drawing.PolyLineShape" ), uno::UNO_QUERY );
    1964        3728 :     xTarget->add(xShape);
    1965             : 
    1966             :     //set properties
    1967        7456 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
    1968             :     OSL_ENSURE(xProp.is(), "created shape offers no XPropertySet");
    1969        3728 :     if( xProp.is())
    1970             :     {
    1971             :         try
    1972             :         {
    1973             :             //Polygon
    1974        3728 :             xProp->setPropertyValue( UNO_NAME_POLYPOLYGON
    1975        3728 :                 , uno::makeAny( rPoints ) );
    1976             : 
    1977        3728 :             if(pLineProperties)
    1978             :             {
    1979             :                 //Transparency
    1980        2930 :                 if(pLineProperties->Transparence.hasValue())
    1981        2930 :                     xProp->setPropertyValue( UNO_NAME_LINETRANSPARENCE
    1982        2930 :                         , pLineProperties->Transparence );
    1983             : 
    1984             :                 //LineStyle
    1985        2930 :                 if(pLineProperties->LineStyle.hasValue())
    1986        2930 :                     xProp->setPropertyValue( UNO_NAME_LINESTYLE
    1987        2930 :                         , pLineProperties->LineStyle );
    1988             : 
    1989             :                 //LineWidth
    1990        2930 :                 if(pLineProperties->Width.hasValue())
    1991        2930 :                     xProp->setPropertyValue( UNO_NAME_LINEWIDTH
    1992        2930 :                         , pLineProperties->Width );
    1993             : 
    1994             :                 //LineColor
    1995        2930 :                 if(pLineProperties->Color.hasValue())
    1996        2930 :                     xProp->setPropertyValue( UNO_NAME_LINECOLOR
    1997        2930 :                         , pLineProperties->Color );
    1998             : 
    1999             :                 //LineDashName
    2000        2930 :                 if(pLineProperties->DashName.hasValue())
    2001           0 :                     xProp->setPropertyValue( "LineDashName"
    2002           0 :                         , pLineProperties->DashName );
    2003             :             }
    2004             :         }
    2005           0 :         catch( const uno::Exception& e )
    2006             :         {
    2007             :             ASSERT_EXCEPTION( e );
    2008             :         }
    2009             :     }
    2010        7456 :     return xShape;
    2011             : }
    2012             : 
    2013             : uno::Reference< drawing::XShape >
    2014         134 :     ShapeFactory::createLine ( const uno::Reference< drawing::XShapes >& xTarget,
    2015             :             const awt::Size& rSize, const awt::Point& rPosition )
    2016             : {
    2017             :     //create shape
    2018             :     uno::Reference< drawing::XShape > xShape(
    2019         134 :         m_xShapeFactory->createInstance(
    2020         134 :             "com.sun.star.drawing.LineShape" ), uno::UNO_QUERY );
    2021         134 :     xTarget->add(xShape);
    2022         134 :     xShape->setSize( rSize );
    2023         134 :     xShape->setPosition( rPosition );
    2024             : 
    2025         134 :     return xShape;
    2026             : }
    2027             : 
    2028        2973 : uno::Reference< drawing::XShape > ShapeFactory::createInvisibleRectangle(
    2029             :             const uno::Reference< drawing::XShapes >& xTarget
    2030             :             , const awt::Size& rSize )
    2031             : {
    2032             :     try
    2033             :     {
    2034        2973 :         if(!xTarget.is())
    2035           0 :             return 0;
    2036             : 
    2037        2973 :         uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
    2038        2973 :                 "com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY );
    2039        2973 :         if( xShape.is())
    2040             :         {
    2041        2973 :             xTarget->add( xShape );
    2042        2973 :             ShapeFactory::makeShapeInvisible( xShape );
    2043        2973 :             xShape->setSize( rSize );
    2044             :         }
    2045        2973 :         return xShape;
    2046             :     }
    2047           0 :     catch( const uno::Exception & ex )
    2048             :     {
    2049             :         ASSERT_EXCEPTION( ex );
    2050             :     }
    2051           0 :     return 0;
    2052             : }
    2053             : 
    2054        2389 : uno::Reference< drawing::XShape > ShapeFactory::createRectangle(
    2055             :     const uno::Reference< drawing::XShapes >& xTarget,
    2056             :     const awt::Size& rSize,
    2057             :     const awt::Point& rPosition,
    2058             :     const tNameSequence& rPropNames,
    2059             :     const tAnySequence& rPropValues,
    2060             :     StackPosition ePos )
    2061             : {
    2062        2389 :     uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
    2063        2389 :                 "com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY );
    2064        2389 :     if( xShape.is())
    2065             :     {
    2066        2389 :         if (ePos == Bottom)
    2067             :         {
    2068         426 :             uno::Reference<drawing::XShapes2> xTarget2(xTarget, uno::UNO_QUERY);
    2069         426 :             if (xTarget2.is())
    2070         426 :                 xTarget2->addBottom(xShape);
    2071             :         }
    2072             :         else
    2073        1963 :             xTarget->add(xShape);
    2074             : 
    2075        2389 :         xShape->setPosition( rPosition );
    2076        2389 :         xShape->setSize( rSize );
    2077        2389 :         uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY_THROW );
    2078        2389 :         PropertyMapper::setMultiProperties( rPropNames, rPropValues, xPropSet );
    2079             :     }
    2080             : 
    2081        2389 :     return xShape;
    2082             : }
    2083             : 
    2084             : uno::Reference< drawing::XShape >
    2085         507 :     ShapeFactory::createRectangle(
    2086             :             const uno::Reference<
    2087             :             drawing::XShapes >& xTarget )
    2088             : {
    2089         507 :     uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
    2090         507 :                 "com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY );
    2091         507 :     xTarget->add( xShape );
    2092             : 
    2093         507 :     return xShape;
    2094             : }
    2095             : 
    2096             : uno::Reference< drawing::XShape >
    2097       13449 :         ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget
    2098             :                     , const OUString& rText
    2099             :                     , const tNameSequence& rPropNames
    2100             :                     , const tAnySequence& rPropValues
    2101             :                     , const uno::Any& rATransformation )
    2102             : {
    2103       13449 :     if( !xTarget.is() )
    2104           0 :         return 0;
    2105             : 
    2106       13449 :     if(rText.isEmpty())
    2107           0 :         return 0;
    2108             : 
    2109             :     //create shape and add to page
    2110             :     uno::Reference< drawing::XShape > xShape(
    2111       13449 :             m_xShapeFactory->createInstance(
    2112       13449 :             "com.sun.star.drawing.TextShape" ), uno::UNO_QUERY );
    2113       13449 :     xTarget->add(xShape);
    2114             : 
    2115             :     //set text
    2116       26898 :     uno::Reference< text::XTextRange > xTextRange( xShape, uno::UNO_QUERY );
    2117       13449 :     if( xTextRange.is() )
    2118       13449 :         xTextRange->setString( rText );
    2119             : 
    2120       26898 :     uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
    2121       13449 :     if( xProp.is() )
    2122             :     {
    2123             :         //set properties
    2124       13449 :         PropertyMapper::setMultiProperties( rPropNames, rPropValues, xProp );
    2125             : 
    2126             :         //set position matrix
    2127             :         //the matrix needs to be set at the end behind autogrow and such position influencing properties
    2128             :         try
    2129             :         {
    2130       14650 :             xProp->setPropertyValue( "Transformation", rATransformation );
    2131             :         }
    2132        1201 :         catch( const uno::Exception& e )
    2133             :         {
    2134             :             ASSERT_EXCEPTION( e );
    2135             :         }
    2136             :     }
    2137       26898 :     return xShape;
    2138             : }
    2139             : 
    2140             : uno::Reference< drawing::XShape >
    2141         314 :         ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget,
    2142             :                 const awt::Size& rSize,
    2143             :                 const awt::Point& rPos,
    2144             :                 uno::Sequence< uno::Reference< chart2::XFormattedString > >& xFormattedString,
    2145             :                 const uno::Reference<
    2146             :                 beans::XPropertySet > & xTextProperties,
    2147             :                 double nRotation, const OUString& aName )
    2148             : {
    2149             :     //create shape and add to page
    2150             :     uno::Reference< drawing::XShape > xShape(
    2151         314 :             m_xShapeFactory->createInstance(
    2152         314 :                 "com.sun.star.drawing.TextShape" ), uno::UNO_QUERY );
    2153             :     try
    2154             :     {
    2155         314 :         xTarget->add(xShape);
    2156             : 
    2157             :         //set text and text properties
    2158         314 :         uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
    2159         628 :         uno::Reference< text::XTextCursor > xTextCursor( xText->createTextCursor() );
    2160         628 :         uno::Reference< text::XTextRange > xTextRange( xTextCursor, uno::UNO_QUERY );
    2161         628 :         uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
    2162         314 :         if( !xText.is() || !xTextRange.is() || !xTextCursor.is() || !xShapeProp.is() || !xTextProperties.is() )
    2163           0 :             return xShape;
    2164             : 
    2165         628 :         tPropertyNameValueMap aValueMap;
    2166             :         //fill line-, fill- and paragraph-properties into the ValueMap
    2167             :         {
    2168         314 :             tMakePropertyNameMap aNameMap = PropertyMapper::getPropertyNameMapForParagraphProperties();
    2169         314 :             aNameMap( PropertyMapper::getPropertyNameMapForFillAndLineProperties() );
    2170             : 
    2171         314 :             PropertyMapper::getValueMap( aValueMap, aNameMap, xTextProperties );
    2172             :         }
    2173             : 
    2174             :         //fill some more shape properties into the ValueMap
    2175             :         {
    2176         314 :             drawing::TextHorizontalAdjust eHorizontalAdjust = drawing::TextHorizontalAdjust_CENTER;
    2177         314 :             drawing::TextVerticalAdjust eVerticalAdjust = drawing::TextVerticalAdjust_CENTER;
    2178             : 
    2179         314 :             aValueMap.insert( tPropertyNameValueMap::value_type( "TextHorizontalAdjust", uno::makeAny(eHorizontalAdjust) ) ); // drawing::TextHorizontalAdjust
    2180         314 :             aValueMap.insert( tPropertyNameValueMap::value_type( "TextVerticalAdjust", uno::makeAny(eVerticalAdjust) ) ); //drawing::TextVerticalAdjust
    2181         314 :             aValueMap.insert( tPropertyNameValueMap::value_type( "TextAutoGrowHeight", uno::makeAny(sal_True) ) ); // sal_Bool
    2182         314 :             aValueMap.insert( tPropertyNameValueMap::value_type( "TextAutoGrowWidth", uno::makeAny(sal_True) ) ); // sal_Bool
    2183             : 
    2184             :             //set name/classified ObjectID (CID)
    2185         314 :             if( !aName.isEmpty() )
    2186         314 :                 aValueMap.insert( tPropertyNameValueMap::value_type( "Name", uno::makeAny( aName ) ) ); //CID OUString
    2187             :         }
    2188             : 
    2189             :         //set global title properties
    2190             :         {
    2191         314 :             tNameSequence aPropNames;
    2192         628 :             tAnySequence aPropValues;
    2193         314 :             PropertyMapper::getMultiPropertyListsFromValueMap( aPropNames, aPropValues, aValueMap );
    2194         628 :             PropertyMapper::setMultiProperties( aPropNames, aPropValues, xShapeProp );
    2195             :         }
    2196             : 
    2197         314 :         bool bStackCharacters(false);
    2198             :         try
    2199             :         {
    2200         314 :             xTextProperties->getPropertyValue( "StackCharacters" ) >>= bStackCharacters;
    2201             :         }
    2202           0 :         catch( const uno::Exception& e )
    2203             :         {
    2204             :             ASSERT_EXCEPTION( e );
    2205             :         }
    2206             : 
    2207         314 :         if(bStackCharacters)
    2208             :         {
    2209             :             //if the characters should be stacked we use only the first character properties for code simplicity
    2210          15 :             if( xFormattedString.getLength()>0 )
    2211             :             {
    2212          15 :                 OUString aLabel;
    2213          30 :                 for( sal_Int32 nN=0; nN<xFormattedString.getLength();nN++ )
    2214          15 :                     aLabel += xFormattedString[nN]->getString();
    2215          15 :                 aLabel = ShapeFactory::getStackedString( aLabel, bStackCharacters );
    2216             : 
    2217          15 :                 xTextCursor->gotoEnd(false);
    2218          15 :                 xText->insertString( xTextRange, aLabel, false );
    2219          15 :                 xTextCursor->gotoEnd(true);
    2220          30 :                 uno::Reference< beans::XPropertySet > xTargetProps( xShape, uno::UNO_QUERY );
    2221          30 :                 uno::Reference< beans::XPropertySet > xSourceProps( xFormattedString[0], uno::UNO_QUERY );
    2222             : 
    2223             :                 PropertyMapper::setMappedProperties( xTargetProps, xSourceProps
    2224          15 :                         , PropertyMapper::getPropertyNameMapForCharacterProperties() );
    2225             : 
    2226             :                 // adapt font size according to page size
    2227          15 :                 awt::Size aOldRefSize;
    2228          15 :                 if( xTextProperties->getPropertyValue( "ReferencePageSize") >>= aOldRefSize )
    2229             :                 {
    2230           0 :                     RelativeSizeHelper::adaptFontSizes( xTargetProps, aOldRefSize, rSize );
    2231          15 :                 }
    2232             :             }
    2233             :         }
    2234             :         else
    2235             :         {
    2236         299 :             uno::Sequence< uno::Reference< text::XTextCursor > > aCursorList( xFormattedString.getLength() );
    2237         299 :             sal_Int32 nN = 0;
    2238         604 :             for( nN=0; nN<xFormattedString.getLength();nN++ )
    2239             :             {
    2240         305 :                 xTextCursor->gotoEnd(false);
    2241         305 :                 xText->insertString( xTextRange, xFormattedString[nN]->getString(), false );
    2242         305 :                 xTextCursor->gotoEnd(true);
    2243         305 :                 aCursorList[nN] = xText->createTextCursorByRange( uno::Reference< text::XTextRange >(xTextCursor,uno::UNO_QUERY) );
    2244             :             }
    2245         299 :             awt::Size aOldRefSize;
    2246             :             bool bHasRefPageSize =
    2247         299 :                 ( xTextProperties->getPropertyValue( "ReferencePageSize") >>= aOldRefSize );
    2248             : 
    2249         299 :             if( xFormattedString.getLength()>0 )
    2250             :             {
    2251         299 :                 uno::Reference< beans::XPropertySet > xTargetProps( xShape, uno::UNO_QUERY );
    2252         598 :                 uno::Reference< beans::XPropertySet > xSourceProps( xFormattedString[0], uno::UNO_QUERY );
    2253         299 :                 PropertyMapper::setMappedProperties( xTargetProps, xSourceProps, PropertyMapper::getPropertyNameMapForCharacterProperties() );
    2254             : 
    2255             :                 // adapt font size according to page size
    2256         299 :                 if( bHasRefPageSize )
    2257             :                 {
    2258           0 :                     RelativeSizeHelper::adaptFontSizes( xTargetProps, aOldRefSize, rSize );
    2259         299 :                 }
    2260         299 :             }
    2261             :         }
    2262             : 
    2263             :         // #i109336# Improve auto positioning in chart
    2264         314 :         float fFontHeight = 0.0;
    2265         314 :         if ( xShapeProp.is() && ( xShapeProp->getPropertyValue( "CharHeight" ) >>= fFontHeight ) )
    2266             :         {
    2267         314 :             fFontHeight *= ( 2540.0f / 72.0f );  // pt -> 1/100 mm
    2268         314 :             float fXFraction = 0.18f;
    2269         314 :             sal_Int32 nXDistance = static_cast< sal_Int32 >( ::rtl::math::round( fFontHeight * fXFraction ) );
    2270         314 :             float fYFraction = 0.30f;
    2271         314 :             sal_Int32 nYDistance = static_cast< sal_Int32 >( ::rtl::math::round( fFontHeight * fYFraction ) );
    2272         314 :             xShapeProp->setPropertyValue( "TextLeftDistance", uno::makeAny( nXDistance ) );
    2273         314 :             xShapeProp->setPropertyValue( "TextRightDistance", uno::makeAny( nXDistance ) );
    2274         314 :             xShapeProp->setPropertyValue( "TextUpperDistance", uno::makeAny( nYDistance ) );
    2275         314 :             xShapeProp->setPropertyValue( "TextLowerDistance", uno::makeAny( nYDistance ) );
    2276             :         }
    2277         314 :         sal_Int32 nXPos = rPos.X;
    2278         314 :         sal_Int32 nYPos = rPos.Y;
    2279             : 
    2280             :         //set position matrix
    2281             :         //the matrix needs to be set at the end behind autogrow and such position influencing properties
    2282         628 :         ::basegfx::B2DHomMatrix aM;
    2283         314 :         aM.rotate( -nRotation*F_PI/180.0 );//#i78696#->#i80521#
    2284         314 :         aM.translate( nXPos, nYPos );
    2285         628 :         xShapeProp->setPropertyValue( "Transformation", uno::makeAny( B2DHomMatrixToHomogenMatrix3(aM) ) );
    2286             :     }
    2287           0 :     catch( const uno::Exception& e )
    2288             :     {
    2289             :         ASSERT_EXCEPTION( e );
    2290             :     }
    2291         314 :     return xShape;
    2292             : }
    2293             : 
    2294         108 : } //namespace chart
    2295             : 
    2296             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10