LCOV - code coverage report
Current view: top level - oox/source/drawingml - shape.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 556 658 84.5 %
Date: 2014-04-11 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 "oox/drawingml/shape.hxx"
      21             : #include "oox/drawingml/customshapeproperties.hxx"
      22             : #include "oox/drawingml/theme.hxx"
      23             : #include "oox/drawingml/fillproperties.hxx"
      24             : #include "oox/drawingml/lineproperties.hxx"
      25             : #include "oox/drawingml/effectproperties.hxx"
      26             : #include "oox/drawingml/shapepropertymap.hxx"
      27             : #include "oox/drawingml/textbody.hxx"
      28             : #include "oox/drawingml/table/tableproperties.hxx"
      29             : #include "oox/drawingml/chart/chartconverter.hxx"
      30             : #include "oox/drawingml/chart/chartspacefragment.hxx"
      31             : #include "oox/drawingml/chart/chartspacemodel.hxx"
      32             : #include "oox/vml/vmldrawing.hxx"
      33             : #include "oox/vml/vmlshape.hxx"
      34             : #include "oox/vml/vmlshapecontainer.hxx"
      35             : #include "oox/core/xmlfilterbase.hxx"
      36             : #include "oox/helper/graphichelper.hxx"
      37             : #include "oox/helper/propertyset.hxx"
      38             : #include "oox/helper/modelobjecthelper.hxx"
      39             : 
      40             : #include <tools/gen.hxx>
      41             : #include <tools/mapunit.hxx>
      42             : #include <editeng/unoprnms.hxx>
      43             : #include <com/sun/star/awt/Size.hpp>
      44             : #include <com/sun/star/graphic/XGraphic.hpp>
      45             : #include <com/sun/star/container/XNamed.hpp>
      46             : #include <com/sun/star/container/XNameContainer.hpp>
      47             : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      48             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      49             : #include <com/sun/star/xml/AttributeData.hpp>
      50             : #include <com/sun/star/drawing/HomogenMatrix3.hpp>
      51             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      52             : #include <com/sun/star/drawing/GraphicExportFilter.hpp>
      53             : #include <com/sun/star/text/XText.hpp>
      54             : #include <com/sun/star/table/BorderLine2.hpp>
      55             : #include <com/sun/star/table/ShadowFormat.hpp>
      56             : #include <com/sun/star/chart2/XChartDocument.hpp>
      57             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      58             : #include <com/sun/star/io/XOutputStream.hpp>
      59             : 
      60             : #include <basegfx/point/b2dpoint.hxx>
      61             : #include <basegfx/polygon/b2dpolygon.hxx>
      62             : #include <basegfx/matrix/b2dhommatrix.hxx>
      63             : #include <com/sun/star/document/XActionLockable.hpp>
      64             : #include <com/sun/star/chart2/data/XDataReceiver.hpp>
      65             : #include <svl/outstrm.hxx>
      66             : #include <unotools/streamwrap.hxx>
      67             : #include <unotools/fltrcfg.hxx>
      68             : #include <vcl/graph.hxx>
      69             : #include <vcl/graphicfilter.hxx>
      70             : #include <vcl/svapp.hxx>
      71             : 
      72             : using namespace ::oox::core;
      73             : using namespace ::com::sun::star;
      74             : using namespace ::com::sun::star::uno;
      75             : using namespace ::com::sun::star::beans;
      76             : using namespace ::com::sun::star::frame;
      77             : using namespace ::com::sun::star::text;
      78             : using namespace ::com::sun::star::drawing;
      79             : using namespace ::com::sun::star::style;
      80             : 
      81             : namespace oox { namespace drawingml {
      82             : 
      83             : #define PUT_PROP( aProperties, nPos, sPropName, aPropValue ) \
      84             :     aProperties[nPos].Name = sPropName; \
      85             :     aProperties[nPos].Value = Any( aPropValue );
      86             : 
      87        7540 : Shape::Shape( const sal_Char* pServiceName, bool bDefaultHeight )
      88             : : mbIsChild( false )
      89        7540 : , mpLinePropertiesPtr( new LineProperties )
      90        7540 : , mpFillPropertiesPtr( new FillProperties )
      91        7540 : , mpGraphicPropertiesPtr( new GraphicProperties )
      92        7540 : , mpCustomShapePropertiesPtr( new CustomShapeProperties )
      93        7540 : , mpEffectPropertiesPtr( new EffectProperties )
      94        7540 : , mpMasterTextListStyle( new TextListStyle )
      95             : , mnSubType( 0 )
      96             : , meFrameType( FRAMETYPE_GENERIC )
      97             : , mnRotation( 0 )
      98             : , mbFlipH( false )
      99             : , mbFlipV( false )
     100             : , mbHidden( false )
     101             : , mbHiddenMasterShape( false )
     102             : , mbLockedCanvas( false )
     103             : , mbWps( false )
     104       52780 : , maDiagramDoms( 0 )
     105             : {
     106        7540 :     if ( pServiceName )
     107        2464 :         msServiceName = OUString::createFromAscii( pServiceName );
     108        7540 :     setDefaults(bDefaultHeight);
     109        7540 : }
     110             : 
     111           0 : Shape::Shape( const ShapePtr& pSourceShape )
     112             : : maChildren()
     113           0 : , mbIsChild( pSourceShape->mbIsChild )
     114           0 : , mpTextBody(pSourceShape->mpTextBody)
     115           0 : , mpLinePropertiesPtr( pSourceShape->mpLinePropertiesPtr )
     116           0 : , mpFillPropertiesPtr( pSourceShape->mpFillPropertiesPtr )
     117           0 : , mpGraphicPropertiesPtr( pSourceShape->mpGraphicPropertiesPtr )
     118           0 : , mpCustomShapePropertiesPtr( pSourceShape->mpCustomShapePropertiesPtr )
     119           0 : , mpTablePropertiesPtr( pSourceShape->mpTablePropertiesPtr )
     120           0 : , mp3DPropertiesPtr( pSourceShape->mp3DPropertiesPtr )
     121           0 : , mpEffectPropertiesPtr (pSourceShape->mpEffectPropertiesPtr)
     122           0 : , maShapeProperties( pSourceShape->maShapeProperties )
     123           0 : , mpMasterTextListStyle( pSourceShape->mpMasterTextListStyle )
     124             : , mxShape()
     125           0 : , msServiceName( pSourceShape->msServiceName )
     126           0 : , msName( pSourceShape->msName )
     127           0 : , msId( pSourceShape->msId )
     128           0 : , mnSubType( pSourceShape->mnSubType )
     129           0 : , moSubTypeIndex( pSourceShape->moSubTypeIndex )
     130           0 : , maShapeStyleRefs( pSourceShape->maShapeStyleRefs )
     131           0 : , maSize( pSourceShape->maSize )
     132           0 : , maPosition( pSourceShape->maPosition )
     133           0 : , meFrameType( pSourceShape->meFrameType )
     134           0 : , mnRotation( pSourceShape->mnRotation )
     135           0 : , mbFlipH( pSourceShape->mbFlipH )
     136           0 : , mbFlipV( pSourceShape->mbFlipV )
     137           0 : , mbHidden( pSourceShape->mbHidden )
     138           0 : , mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape )
     139           0 : , mbLockedCanvas( pSourceShape->mbLockedCanvas )
     140           0 : , mbWps( pSourceShape->mbWps )
     141           0 : , maDiagramDoms( pSourceShape->maDiagramDoms )
     142           0 : {}
     143             : 
     144             : 
     145       10781 : Shape::~Shape()
     146             : {
     147       10781 : }
     148             : 
     149           0 : table::TablePropertiesPtr Shape::getTableProperties()
     150             : {
     151           0 :     if ( !mpTablePropertiesPtr.get() )
     152           0 :         mpTablePropertiesPtr.reset( new table::TableProperties() );
     153           0 :     return mpTablePropertiesPtr;
     154             : }
     155             : 
     156        7540 : void Shape::setDefaults(bool bHeight)
     157             : {
     158        7540 :     maDefaultShapeProperties.setProperty(PROP_TextAutoGrowHeight, false);
     159        7540 :     maDefaultShapeProperties.setProperty(PROP_TextWordWrap, true);
     160        7540 :     maDefaultShapeProperties.setProperty(PROP_TextLeftDistance, static_cast< sal_Int32 >( 250 ));
     161        7540 :     maDefaultShapeProperties.setProperty(PROP_TextUpperDistance, static_cast< sal_Int32 >( 125 ));
     162        7540 :     maDefaultShapeProperties.setProperty(PROP_TextRightDistance, static_cast< sal_Int32 >( 250 ));
     163        7540 :     maDefaultShapeProperties.setProperty(PROP_TextLowerDistance, static_cast< sal_Int32 >( 125 ));
     164        7540 :     if (bHeight)
     165        7319 :         maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< float >( 18.0 ));
     166        7540 :     maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, TextVerticalAdjust_TOP);
     167        7540 :     maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< sal_Int16 >( ParagraphAdjust_LEFT )); // check for RTL?
     168        7540 : }
     169             : 
     170           0 : ::oox::vml::OleObjectInfo& Shape::setOleObjectType()
     171             : {
     172             :     OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setOleObjectType - multiple frame types" );
     173           0 :     meFrameType = FRAMETYPE_OLEOBJECT;
     174           0 :     mxOleObjectInfo.reset( new ::oox::vml::OleObjectInfo( true ) );
     175           0 :     return *mxOleObjectInfo;
     176             : }
     177             : 
     178          65 : ChartShapeInfo& Shape::setChartType( bool bEmbedShapes )
     179             : {
     180             :     OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setChartType - multiple frame types" );
     181          65 :     meFrameType = FRAMETYPE_CHART;
     182          65 :     msServiceName = "com.sun.star.drawing.OLE2Shape";
     183          65 :     mxChartShapeInfo.reset( new ChartShapeInfo( bEmbedShapes ) );
     184          65 :     return *mxChartShapeInfo;
     185             : }
     186             : 
     187          37 : void Shape::setDiagramType()
     188             : {
     189             :     OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setDiagramType - multiple frame types" );
     190          37 :     meFrameType = FRAMETYPE_DIAGRAM;
     191          37 :     msServiceName = "com.sun.star.drawing.GroupShape";
     192          37 :     mnSubType = 0;
     193          37 : }
     194             : 
     195           0 : void Shape::setTableType()
     196             : {
     197             :     OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setTableType - multiple frame types" );
     198           0 :     meFrameType = FRAMETYPE_TABLE;
     199           0 :     msServiceName = "com.sun.star.drawing.TableShape";
     200           0 :     mnSubType = 0;
     201           0 : }
     202             : 
     203         341 : void Shape::setServiceName( const sal_Char* pServiceName )
     204             : {
     205         341 :     if ( pServiceName )
     206         341 :         msServiceName = OUString::createFromAscii( pServiceName );
     207         341 : }
     208             : 
     209             : 
     210        6155 : const ShapeStyleRef* Shape::getShapeStyleRef( sal_Int32 nRefType ) const
     211             : {
     212        6155 :     ShapeStyleRefMap::const_iterator aIt = maShapeStyleRefs.find( nRefType );
     213        6155 :     return (aIt == maShapeStyleRefs.end()) ? 0 : &aIt->second;
     214             : }
     215             : 
     216        1488 : void Shape::addShape(
     217             :         ::oox::core::XmlFilterBase& rFilterBase,
     218             :         const Theme* pTheme,
     219             :         const Reference< XShapes >& rxShapes,
     220             :         basegfx::B2DHomMatrix& aTransformation,
     221             :         FillProperties& rShapeOrParentShapeFillProps,
     222             :         const awt::Rectangle* pShapeRect,
     223             :         ShapeIdMap* pShapeMap )
     224             : {
     225             :     SAL_INFO("oox.drawingml", OSL_THIS_FUNC << " id: " << msId);
     226             : 
     227             :     try
     228             :     {
     229        1488 :         OUString sServiceName( msServiceName );
     230        1488 :         if( !sServiceName.isEmpty() )
     231             :         {
     232        1488 :             basegfx::B2DHomMatrix aMatrix( aTransformation );
     233        2976 :             Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, pTheme, rxShapes, pShapeRect, false, false, aMatrix, rShapeOrParentShapeFillProps ) );
     234             : 
     235        1488 :             if( pShapeMap && !msId.isEmpty() )
     236             :             {
     237         124 :                 (*pShapeMap)[ msId ] = shared_from_this();
     238             :             }
     239             : 
     240             :             // if this is a group shape, we have to add also each child shape
     241        2976 :             Reference< XShapes > xShapes( xShape, UNO_QUERY );
     242        1488 :             if ( xShapes.is() )
     243          82 :                 addChildren( rFilterBase, *this, pTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap, aMatrix );
     244             : 
     245             : 
     246        1488 :             if( meFrameType == FRAMETYPE_DIAGRAM )
     247             :             {
     248          17 :                 if( !SvtFilterOptions::Get().IsSmartArt2Shape() )
     249          15 :                     keepDiagramCompatibilityInfo( rFilterBase );
     250        1488 :             }
     251        1488 :         }
     252             :     }
     253           0 :     catch( const Exception& e )
     254             :     {
     255             :         SAL_WARN( "oox.drawingml", OSL_THIS_FUNC << "Exception: " << e.Message );
     256             :     }
     257        1488 : }
     258             : 
     259           8 : void Shape::setLockedCanvas(bool bLockedCanvas)
     260             : {
     261           8 :     mbLockedCanvas = bLockedCanvas;
     262           8 : }
     263             : 
     264           1 : bool Shape::getLockedCanvas()
     265             : {
     266           1 :     return mbLockedCanvas;
     267             : }
     268             : 
     269        1032 : void Shape::setWps(bool bWps)
     270             : {
     271        1032 :     mbWps = bWps;
     272        1032 : }
     273             : 
     274         109 : bool Shape::getWps()
     275             : {
     276         109 :     return mbWps;
     277             : }
     278             : 
     279         115 : void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText )
     280             : {
     281             :     SAL_INFO("oox", OSL_THIS_FUNC << "apply shape reference: " << rReferencedShape.msId << " to shape id: " << msId);
     282             : 
     283         115 :     if ( rReferencedShape.mpTextBody.get() && bUseText )
     284         112 :         mpTextBody = TextBodyPtr( new TextBody( *rReferencedShape.mpTextBody.get() ) );
     285             :     else
     286           3 :         mpTextBody.reset();
     287         115 :     maShapeProperties = rReferencedShape.maShapeProperties;
     288         115 :     mpLinePropertiesPtr = LinePropertiesPtr( new LineProperties( *rReferencedShape.mpLinePropertiesPtr.get() ) );
     289         115 :     mpFillPropertiesPtr = FillPropertiesPtr( new FillProperties( *rReferencedShape.mpFillPropertiesPtr.get() ) );
     290         115 :     mpCustomShapePropertiesPtr = CustomShapePropertiesPtr( new CustomShapeProperties( *rReferencedShape.mpCustomShapePropertiesPtr.get() ) );
     291         115 :     mpTablePropertiesPtr = table::TablePropertiesPtr( rReferencedShape.mpTablePropertiesPtr.get() ? new table::TableProperties( *rReferencedShape.mpTablePropertiesPtr.get() ) : NULL );
     292         115 :     mpEffectPropertiesPtr = EffectPropertiesPtr( new EffectProperties( *rReferencedShape.mpEffectPropertiesPtr.get() ) );
     293         115 :     mpMasterTextListStyle = TextListStylePtr( new TextListStyle( *rReferencedShape.mpMasterTextListStyle.get() ) );
     294         115 :     maShapeStyleRefs = rReferencedShape.maShapeStyleRefs;
     295         115 :     maSize = rReferencedShape.maSize;
     296         115 :     maPosition = rReferencedShape.maPosition;
     297         115 :     mnRotation = rReferencedShape.mnRotation;
     298         115 :     mbFlipH = rReferencedShape.mbFlipH;
     299         115 :     mbFlipV = rReferencedShape.mbFlipV;
     300         115 :     mbHidden = rReferencedShape.mbHidden;
     301         115 : }
     302             : 
     303           0 : void Shape::addChildren( ::oox::core::XmlFilterBase& rFilterBase,
     304             :                          const Theme* pTheme,
     305             :                          const Reference< XShapes >& rxShapes,
     306             :                          basegfx::B2DHomMatrix& aTransformation,
     307             :                          const awt::Rectangle* pShapeRect,
     308             :                          ShapeIdMap* pShapeMap )
     309             : {
     310             :     addChildren(rFilterBase, *this, pTheme, rxShapes,
     311             :                 pShapeRect ?
     312             :                  *pShapeRect :
     313             :                  awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ),
     314           0 :                 pShapeMap, aTransformation);
     315           0 : }
     316             : 
     317             : struct ActionLockGuard
     318             : {
     319        1865 :     explicit ActionLockGuard(Reference<drawing::XShape> const& xShape)
     320        1865 :         : m_xLockable(xShape, UNO_QUERY)
     321             :     {
     322        1865 :         if (m_xLockable.is()) {
     323        1577 :             m_xLockable->addActionLock();
     324             :         }
     325        1865 :     }
     326        1865 :     ~ActionLockGuard()
     327        1865 :     {
     328        1865 :         if (m_xLockable.is()) {
     329        1577 :             m_xLockable->removeActionLock();
     330             :         }
     331        1865 :     }
     332             : private:
     333             :     Reference<document::XActionLockable> m_xLockable;
     334             : };
     335             : 
     336             : // for group shapes, the following method is also adding each child
     337          90 : void Shape::addChildren(
     338             :         XmlFilterBase& rFilterBase,
     339             :         Shape& rMaster,
     340             :         const Theme* pTheme,
     341             :         const Reference< XShapes >& rxShapes,
     342             :         const awt::Rectangle&,
     343             :         ShapeIdMap* pShapeMap,
     344             :         basegfx::B2DHomMatrix& aTransformation )
     345             : {
     346          90 :     basegfx::B2DHomMatrix aChildTransformation;
     347             : 
     348          90 :     aChildTransformation.translate(-maChPosition.X, -maChPosition.Y);
     349          90 :     aChildTransformation.scale(1/(maChSize.Width ? maChSize.Width : 1.0), 1/(maChSize.Height ? maChSize.Height : 1.0));
     350             : 
     351             :     // Child position and size is typically non-zero, but it's allowed to have
     352             :     // it like that, and in that case Word ignores the parent transformation
     353             :     // (excluding translate component).
     354          90 :     if (!mbWps || maChPosition.X || maChPosition.Y || maChSize.Width || maChSize.Height)
     355             :     {
     356          61 :         aChildTransformation *= aTransformation;
     357             :     }
     358             :     else
     359             :     {
     360          58 :         basegfx::B2DVector aScale, aTranslate;
     361             :         double fRotate, fShearX;
     362          29 :         aTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
     363          58 :         aChildTransformation.translate(aTranslate.getX(), aTranslate.getY());
     364             :     }
     365             : 
     366             :     SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "parent matrix:\n"
     367             :              << aChildTransformation.get(0, 0) << " "
     368             :              << aChildTransformation.get(0, 1) << " "
     369             :              << aChildTransformation.get(0, 2) << "\n"
     370             :              << aChildTransformation.get(1, 0) << " "
     371             :              << aChildTransformation.get(1, 1) << " "
     372             :              << aChildTransformation.get(1, 2) << "\n"
     373             :              << aChildTransformation.get(2, 0) << " "
     374             :              << aChildTransformation.get(2, 1) << " "
     375             :              << aChildTransformation.get(2, 2));
     376             : 
     377          90 :     std::vector< ShapePtr >::iterator aIter( rMaster.maChildren.begin() );
     378         772 :     while( aIter != rMaster.maChildren.end() ) {
     379         592 :         (*aIter)->setMasterTextListStyle( mpMasterTextListStyle );
     380         592 :         (*aIter++)->addShape( rFilterBase, pTheme, rxShapes, aChildTransformation, getFillProperties(), NULL, pShapeMap );
     381          90 :     }
     382          90 : }
     383             : 
     384        1865 : Reference< XShape > Shape::createAndInsert(
     385             :         ::oox::core::XmlFilterBase& rFilterBase,
     386             :         const OUString& rServiceName,
     387             :         const Theme* pTheme,
     388             :         const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
     389             :         const awt::Rectangle* /* pShapeRect */,
     390             :         bool bClearText,
     391             :         bool bDoNotInsertEmptyTextBody,
     392             :         basegfx::B2DHomMatrix& aParentTransformation,
     393             :         FillProperties& rShapeOrParentShapeFillProps )
     394             : {
     395        1865 :     bool bIsEmbMedia = false;
     396             :     SAL_INFO("oox.drawingml", OSL_THIS_FUNC << " id: " << msId);
     397             : 
     398        1865 :     awt::Rectangle aShapeRectHmm( maPosition.X / 360, maPosition.Y / 360, maSize.Width / 360, maSize.Height / 360 );
     399             : 
     400        1865 :     OUString aServiceName;
     401        3897 :     if( rServiceName == "com.sun.star.drawing.GraphicObjectShape" &&
     402        2032 :         mpGraphicPropertiesPtr && !mpGraphicPropertiesPtr->maAudio.msEmbed.isEmpty() )
     403             :     {
     404           0 :         aServiceName = finalizeServiceName( rFilterBase, "com.sun.star.presentation.MediaShape", aShapeRectHmm );
     405           0 :         bIsEmbMedia = true;
     406             :     }
     407             :     else
     408             :     {
     409        1865 :         aServiceName = finalizeServiceName( rFilterBase, rServiceName, aShapeRectHmm );
     410             :     }
     411        2584 :     sal_Bool bIsCustomShape = ( aServiceName == "com.sun.star.drawing.CustomShape" ||
     412        2584 :                                 aServiceName == "com.sun.star.drawing.ConnectorShape" );
     413             : 
     414        3730 :     basegfx::B2DHomMatrix aTransformation;
     415             : 
     416        1865 :     if( maSize.Width != 1 || maSize.Height != 1)
     417             :     {
     418             :         // take care there are no zeros used by error
     419             :         aTransformation.scale(
     420             :             maSize.Width ? maSize.Width : 1.0,
     421        1865 :             maSize.Height ? maSize.Height : 1.0 );
     422             :     }
     423             : 
     424        1865 :     if( mbFlipH || mbFlipV || mnRotation != 0)
     425             :     {
     426             :         // calculate object's center
     427         118 :         basegfx::B2DPoint aCenter(0.5, 0.5);
     428         118 :         aCenter *= aTransformation;
     429             : 
     430             :         // center object at origin
     431         118 :         aTransformation.translate( -aCenter.getX(), -aCenter.getY() );
     432             : 
     433         118 :         if( !bIsCustomShape && ( mbFlipH || mbFlipV ) )
     434             :         {
     435             :             // mirror around object's center
     436           2 :             aTransformation.scale( mbFlipH ? -1.0 : 1.0, mbFlipV ? -1.0 : 1.0 );
     437             :         }
     438             : 
     439         118 :         if( mnRotation != 0 )
     440             :         {
     441             :             // rotate around object's center
     442          69 :             aTransformation.rotate( F_PI180 * ( (double)mnRotation / 60000.0 ) );
     443             :         }
     444             : 
     445             :         // move object back from center
     446         118 :         aTransformation.translate( aCenter.getX(), aCenter.getY() );
     447             :     }
     448             : 
     449        1865 :     if( maPosition.X != 0 || maPosition.Y != 0)
     450             :     {
     451             :         // if global position is used, add it to transformation
     452        1500 :         aTransformation.translate( maPosition.X, maPosition.Y );
     453             :     }
     454             : 
     455        1865 :     aTransformation = aParentTransformation*aTransformation;
     456        1865 :     aParentTransformation = aTransformation;
     457        1865 :     aTransformation.scale(1/360.0, 1/360.0);
     458             : 
     459             :     // special for lineshape
     460        1865 :     if ( aServiceName == "com.sun.star.drawing.LineShape" )
     461             :     {
     462           8 :         ::basegfx::B2DPolygon aPoly;
     463           8 :         aPoly.insert( 0, ::basegfx::B2DPoint( 0, 0 ) );
     464           8 :         aPoly.insert( 1, ::basegfx::B2DPoint( maSize.Width ? 1 : 0, maSize.Height ? 1 : 0 ) );
     465           8 :         aPoly.transform( aTransformation );
     466             : 
     467             :         // now creating the corresponding PolyPolygon
     468           8 :         sal_Int32 i, nNumPoints = aPoly.count();
     469          16 :         uno::Sequence< awt::Point > aPointSequence( nNumPoints );
     470           8 :         awt::Point* pPoints = aPointSequence.getArray();
     471          24 :         for( i = 0; i < nNumPoints; ++i )
     472             :         {
     473          16 :             const ::basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) );
     474          16 :             pPoints[ i ] = awt::Point( static_cast< sal_Int32 >( aPoint.getX() ), static_cast< sal_Int32 >( aPoint.getY() ) );
     475          16 :         }
     476          16 :         uno::Sequence< uno::Sequence< awt::Point > > aPolyPolySequence( 1 );
     477           8 :         aPolyPolySequence.getArray()[ 0 ] = aPointSequence;
     478             : 
     479          16 :         maShapeProperties.setProperty(PROP_PolyPolygon, aPolyPolySequence);
     480             :     }
     481        1857 :     else if ( aServiceName == "com.sun.star.drawing.ConnectorShape" )
     482             :     {
     483           0 :         ::basegfx::B2DPolygon aPoly;
     484           0 :         aPoly.insert( 0, ::basegfx::B2DPoint( 0, 0 ) );
     485           0 :         aPoly.insert( 1, ::basegfx::B2DPoint( maSize.Width ? 1 : 0, maSize.Height ? 1 : 0 ) );
     486           0 :         aPoly.transform( aTransformation );
     487             : 
     488           0 :         basegfx::B2DPoint aStartPosition( aPoly.getB2DPoint( 0 ) );
     489           0 :         basegfx::B2DPoint aEndPosition( aPoly.getB2DPoint( 1 ) );
     490           0 :         awt::Point aAWTStartPosition( static_cast< sal_Int32 >( aStartPosition.getX() ), static_cast< sal_Int32 >( aStartPosition.getY() ) );
     491           0 :         awt::Point aAWTEndPosition( static_cast< sal_Int32 >( aEndPosition.getX() ), static_cast< sal_Int32 >( aEndPosition.getY() ) );
     492             : 
     493           0 :         maShapeProperties.setProperty(PROP_StartPosition, aAWTStartPosition);
     494           0 :         maShapeProperties.setProperty(PROP_EndPosition, aAWTEndPosition);
     495             :     }
     496             :     else
     497             :     {
     498             :         // now set transformation for this object
     499        1857 :         HomogenMatrix3 aMatrix;
     500             : 
     501             : 
     502        1857 :         aMatrix.Line1.Column1 = aTransformation.get(0,0);
     503        1857 :         aMatrix.Line1.Column2 = aTransformation.get(0,1);
     504        1857 :         aMatrix.Line1.Column3 = aTransformation.get(0,2);
     505             : 
     506        1857 :         aMatrix.Line2.Column1 = aTransformation.get(1,0);
     507        1857 :         aMatrix.Line2.Column2 = aTransformation.get(1,1);
     508        1857 :         aMatrix.Line2.Column3 = aTransformation.get(1,2);
     509             : 
     510        1857 :         aMatrix.Line3.Column1 = aTransformation.get(2,0);
     511        1857 :         aMatrix.Line3.Column2 = aTransformation.get(2,1);
     512        1857 :         aMatrix.Line3.Column3 = aTransformation.get(2,2);
     513             : 
     514        1857 :         maShapeProperties.setProperty(PROP_Transformation, aMatrix);
     515             :     }
     516             : 
     517        3730 :     Reference< lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), UNO_QUERY_THROW );
     518        1865 :     if ( !mxShape.is() )
     519        1865 :         mxShape = Reference< drawing::XShape >( xServiceFact->createInstance( aServiceName ), UNO_QUERY_THROW );
     520             : 
     521        3730 :     Reference< XPropertySet > xSet( mxShape, UNO_QUERY );
     522        1865 :     if( mxShape.is() && xSet.is() )
     523             :     {
     524        1865 :         if( !msName.isEmpty() )
     525             :         {
     526         608 :             Reference< container::XNamed > xNamed( mxShape, UNO_QUERY );
     527         608 :             if( xNamed.is() )
     528         608 :                 xNamed->setName( msName );
     529             :         }
     530        1865 :         if (aServiceName != "com.sun.star.text.TextFrame")
     531        1577 :             rxShapes->add( mxShape );
     532             : 
     533        1865 :         if ( mbHidden || mbHiddenMasterShape )
     534             :         {
     535             :             SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "invisible shape with id: " << msId);
     536           0 :             const OUString sVisible( "Visible" );
     537           0 :             xSet->setPropertyValue( sVisible, Any( sal_False ) );
     538             :         }
     539             : 
     540        1865 :         ActionLockGuard const alg(mxShape);
     541             : 
     542             :         // sj: removing default text of placeholder objects such as SlideNumberShape or HeaderShape
     543        1865 :         if ( bClearText )
     544             :         {
     545          55 :             uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
     546          55 :             if ( xText.is() )
     547             :             {
     548          55 :                 OUString aEmpty;
     549          55 :                 xText->setString( aEmpty );
     550          55 :             }
     551             :         }
     552             : 
     553        1865 :         const GraphicHelper& rGraphicHelper = rFilterBase.getGraphicHelper();
     554             : 
     555        3730 :         LineProperties aLineProperties;
     556        1865 :         aLineProperties.maLineFill.moFillType = XML_noFill;
     557        1865 :         sal_Int32 nLinePhClr = -1;
     558        3730 :         FillProperties aFillProperties;
     559        1865 :         aFillProperties.moFillType = XML_noFill;
     560        1865 :         sal_Int32 nFillPhClr = -1;
     561        3730 :         EffectProperties aEffectProperties;
     562             :         // TODO: use ph color when applying effect properties
     563             :         //sal_Int32 nEffectPhClr = -1;
     564             : 
     565        1865 :         if( pTheme )
     566             :         {
     567        1852 :             if( const ShapeStyleRef* pLineRef = getShapeStyleRef( XML_lnRef ) )
     568             :             {
     569         659 :                 if( const LineProperties* pLineProps = pTheme->getLineStyle( pLineRef->mnThemedIdx ) )
     570         365 :                     aLineProperties.assignUsed( *pLineProps );
     571         659 :                 nLinePhClr = pLineRef->maPhClr.getColor( rGraphicHelper );
     572             : 
     573             :                 // Store style-related properties to InteropGrabBag to be able to export them back
     574         659 :                 Sequence< PropertyValue > aProperties( 7 );
     575         659 :                 PUT_PROP( aProperties, 0, "SchemeClr",      pLineRef->maPhClr.getSchemeName() );
     576         659 :                 PUT_PROP( aProperties, 1, "Idx",            pLineRef->mnThemedIdx );
     577         659 :                 PUT_PROP( aProperties, 2, "Color",          nLinePhClr );
     578         659 :                 PUT_PROP( aProperties, 3, "LineStyle",      aLineProperties.getLineStyle() );
     579         659 :                 PUT_PROP( aProperties, 4, "LineJoint",      aLineProperties.getLineJoint() );
     580         659 :                 PUT_PROP( aProperties, 5, "LineWidth",      aLineProperties.getLineWidth() );
     581         659 :                 PUT_PROP( aProperties, 6, "Transformations", pLineRef->maPhClr.getTransformations() );
     582         659 :                 putPropertyToGrabBag( "StyleLnRef", Any( aProperties ) );
     583             :             }
     584        1852 :             if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) )
     585             :             {
     586         659 :                 if( const FillProperties* pFillProps = pTheme->getFillStyle( pFillRef->mnThemedIdx ) )
     587         381 :                     aFillProperties.assignUsed( *pFillProps );
     588         659 :                 nFillPhClr = pFillRef->maPhClr.getColor( rGraphicHelper );
     589             : 
     590         659 :                 OUString sColorScheme = pFillRef->maPhClr.getSchemeName();
     591         659 :                 if( !sColorScheme.isEmpty() )
     592             :                 {
     593         210 :                     Sequence< PropertyValue > aProperties(4);
     594         210 :                     PUT_PROP( aProperties, 0, "SchemeClr",      sColorScheme );
     595         210 :                     PUT_PROP( aProperties, 1, "Idx",            pFillRef->mnThemedIdx );
     596         210 :                     PUT_PROP( aProperties, 2, "Color",          nFillPhClr );
     597         210 :                     PUT_PROP( aProperties, 3, "Transformations", pFillRef->maPhClr.getTransformations() );
     598             : 
     599         210 :                     putPropertyToGrabBag( "StyleFillRef", Any( aProperties ) );
     600         659 :                 }
     601             :             }
     602        1852 :             if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( XML_effectRef ) )
     603             :             {
     604         659 :                 if( const EffectProperties* pEffectProps = pTheme->getEffectStyle( pEffectRef->mnThemedIdx ) )
     605          72 :                     aEffectProperties.assignUsed( *pEffectProps );
     606             :                 // TODO: use ph color when applying effect properties
     607             :                 // nEffectPhClr = pEffectRef->maPhClr.getColor( rGraphicHelper );
     608             : 
     609             :                 // Store style-related properties to InteropGrabBag to be able to export them back
     610         659 :                 Sequence< PropertyValue > aProperties( 3 );
     611         659 :                 PUT_PROP( aProperties, 0, "SchemeClr",      pEffectRef->maPhClr.getSchemeName() );
     612         659 :                 PUT_PROP( aProperties, 1, "Idx",            pEffectRef->mnThemedIdx );
     613         659 :                 PUT_PROP( aProperties, 2, "Transformations", pEffectRef->maPhClr.getTransformations() );
     614         659 :                 putPropertyToGrabBag( "StyleEffectRef", Any( aProperties ) );
     615             :             }
     616             :         }
     617             : 
     618        1865 :         aLineProperties.assignUsed( getLineProperties() );
     619             : 
     620             :         // group fill inherits from parent
     621        1865 :         if ( getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill )
     622           0 :             getFillProperties().assignUsed( rShapeOrParentShapeFillProps );
     623        1865 :         aFillProperties.assignUsed( getFillProperties() );
     624        1865 :         aEffectProperties.assignUsed ( getEffectProperties() );
     625             : 
     626        3730 :         ShapePropertyMap aShapeProps( rFilterBase.getModelObjectHelper() );
     627             : 
     628             :         // add properties from textbody to shape properties
     629        1865 :         if( mpTextBody.get() )
     630             :         {
     631         628 :             mpTextBody->getTextProperties().pushRotationAdjustments( mnRotation );
     632         628 :             aShapeProps.assignUsed( mpTextBody->getTextProperties().maPropertyMap );
     633             :             // Push char properties as well - specifically useful when this is a placeholder
     634         628 :             if( mpMasterTextListStyle &&  mpMasterTextListStyle->getListStyle()[0]->getTextCharacterProperties().moHeight.has() )
     635         215 :                 aShapeProps.setProperty(PROP_CharHeight, GetFontHeight( mpMasterTextListStyle->getListStyle()[0]->getTextCharacterProperties().moHeight.get() ));
     636             :         }
     637             : 
     638             :         // applying properties
     639        1865 :         aShapeProps.assignUsed( getShapeProperties() );
     640        1865 :         aShapeProps.assignUsed( maDefaultShapeProperties );
     641        1865 :         if ( bIsEmbMedia || aServiceName == "com.sun.star.drawing.GraphicObjectShape" || aServiceName == "com.sun.star.drawing.OLE2Shape" )
     642         179 :             mpGraphicPropertiesPtr->pushToPropMap( aShapeProps, rGraphicHelper );
     643        1865 :         if ( mpTablePropertiesPtr.get() && aServiceName == "com.sun.star.drawing.TableShape" )
     644           0 :             mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );
     645        1865 :         aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr, mbFlipH, mbFlipV );
     646        1865 :         aLineProperties.pushToPropMap( aShapeProps, rGraphicHelper, nLinePhClr );
     647             :         // TODO: use ph color when applying effect properties
     648        1865 :         aEffectProperties.pushToPropMap( aShapeProps, rGraphicHelper );
     649             : 
     650             :         // applying autogrowheight property before setting shape size, because
     651             :         // the shape size might be changed if currently autogrowheight is true
     652             :         // we must also check that the PropertySet supports the property.
     653        3730 :         Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
     654        1865 :         const OUString& rPropName = PropertyMap::getPropertyName( PROP_TextAutoGrowHeight );
     655        1865 :         if( xSetInfo.is() && xSetInfo->hasPropertyByName( rPropName ) )
     656        1483 :             if( aShapeProps.hasProperty( PROP_TextAutoGrowHeight ) )
     657        1483 :                 xSet->setPropertyValue( rPropName, Any( false ) );
     658             : 
     659             :         // do not set properties at a group shape (this causes
     660             :         // assertions from svx) ...
     661        1865 :         if( aServiceName != "com.sun.star.drawing.GroupShape" )
     662             :         {
     663        1775 :             if (aServiceName == "com.sun.star.text.TextFrame")
     664             :             {
     665         288 :                 if (mpCustomShapePropertiesPtr && mpCustomShapePropertiesPtr->getShapeTypeOverride())
     666             :                 {
     667         288 :                     uno::Reference<beans::XPropertySet> propertySet (mxShape, uno::UNO_QUERY);
     668         576 :                     uno::Sequence<beans::PropertyValue> aGrabBag;
     669         288 :                     propertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
     670         288 :                     sal_Int32 length = aGrabBag.getLength();
     671         288 :                     aGrabBag.realloc( length+1);
     672         288 :                     aGrabBag[length].Name = "mso-orig-shape-type";
     673         288 :                     aGrabBag[length].Value = uno::makeAny(mpCustomShapePropertiesPtr->getShapePresetTypeName());
     674         576 :                     propertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag));
     675             :                 }
     676             : 
     677             :                 // TextFrames have BackColor, not FillColor
     678         288 :                 if (aShapeProps.hasProperty(PROP_FillColor))
     679             :                 {
     680         223 :                     aShapeProps.setProperty(PROP_BackColor, aShapeProps.getProperty(PROP_FillColor));
     681         223 :                     aShapeProps.erase(PROP_FillColor);
     682             :                 }
     683             :                 // TextFrames have BackColorTransparency, not FillTransparence
     684         288 :                 if (aShapeProps.hasProperty(PROP_FillTransparence))
     685             :                 {
     686          16 :                     aShapeProps.setProperty(PROP_BackColorTransparency, aShapeProps.getProperty(PROP_FillTransparence));
     687          16 :                     aShapeProps.erase(PROP_FillTransparence);
     688             :                 }
     689             :                 // TextFrames have BackGrahicURL, not FillBitmapURL
     690         288 :                 if (aShapeProps.hasProperty(PROP_FillBitmapURL))
     691             :                 {
     692           0 :                     aShapeProps.setProperty(PROP_BackGraphicURL, aShapeProps.getProperty(PROP_FillBitmapURL));
     693           0 :                     aShapeProps.erase(PROP_FillBitmapURL);
     694             :                 }
     695         288 :                 if (aShapeProps.hasProperty(PROP_FillBitmapName))
     696             :                 {
     697           3 :                     uno::Any aAny = aShapeProps.getProperty(PROP_FillBitmapName);
     698           3 :                     aShapeProps.setProperty(PROP_BackGraphicURL, rFilterBase.getModelObjectHelper().getFillBitmapUrl( aAny.get<OUString>() ));
     699             :                     // aShapeProps.erase(PROP_FillBitmapName);  // Maybe, leave the name as well
     700             :                 }
     701             :                 // And no LineColor property; individual borders can have colors
     702         288 :                 if (aShapeProps.hasProperty(PROP_LineColor))
     703             :                 {
     704         230 :                     uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
     705             :                     static const sal_Int32 aBorders[] =
     706             :                     {
     707             :                         PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder
     708             :                     };
     709        1150 :                     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i)
     710             :                     {
     711         920 :                         css::table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(aBorders[i])).get<css::table::BorderLine2>();
     712         920 :                         aBorderLine.Color = aShapeProps.getProperty(PROP_LineColor).get<sal_Int32>();
     713         920 :                         if (aLineProperties.moLineWidth.has())
     714         916 :                             aBorderLine.LineWidth = convertEmuToHmm(aLineProperties.moLineWidth.get());
     715         920 :                         aShapeProps.setProperty(aBorders[i], uno::makeAny(aBorderLine));
     716             :                     }
     717         230 :                     aShapeProps.erase(PROP_LineColor);
     718             :                 }
     719         288 :                 if(mnRotation)
     720             :                 {
     721           3 :                     uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
     722           6 :                     const OUString aGrabBagPropName = "FrameInteropGrabBag";
     723           6 :                     uno::Sequence<beans::PropertyValue> aGrabBag;
     724           3 :                     xPropertySet->getPropertyValue(aGrabBagPropName) >>= aGrabBag;
     725           6 :                     beans::PropertyValue aPair;
     726           3 :                     aPair.Name = "mso-rotation-angle";
     727           3 :                     aPair.Value = uno::makeAny(mnRotation);
     728           3 :                     if (aGrabBag.hasElements())
     729             :                     {
     730           3 :                         sal_Int32 nLength = aGrabBag.getLength();
     731           3 :                         aGrabBag.realloc(nLength + 1);
     732           3 :                         aGrabBag[nLength] = aPair;
     733             :                     }
     734             :                     else
     735             :                     {
     736           0 :                         aGrabBag.realloc(1);
     737           0 :                         aGrabBag[0] = aPair;
     738             :                     }
     739           6 :                     xPropertySet->setPropertyValue(aGrabBagPropName, uno::makeAny(aGrabBag));
     740             :                 }
     741             :                 // TextFrames have ShadowFormat, not individual shadow properties.
     742         288 :                 boost::optional<sal_Int32> oShadowDistance;
     743         288 :                 if (aShapeProps.hasProperty(PROP_ShadowXDistance))
     744             :                 {
     745          11 :                     oShadowDistance = aShapeProps.getProperty(PROP_ShadowXDistance).get<sal_Int32>();
     746          11 :                     aShapeProps.erase(PROP_ShadowXDistance);
     747             :                 }
     748         288 :                 if (aShapeProps.hasProperty(PROP_ShadowYDistance))
     749             :                 {
     750             :                     // There is a single 'dist' attribute, so no need to count the avg of x and y.
     751          11 :                     aShapeProps.erase(PROP_ShadowYDistance);
     752             :                 }
     753         576 :                 boost::optional<sal_Int32> oShadowColor;
     754         288 :                 if (aShapeProps.hasProperty(PROP_ShadowColor))
     755             :                 {
     756          11 :                     oShadowColor = aShapeProps.getProperty(PROP_ShadowColor).get<sal_Int32>();
     757          11 :                     aShapeProps.erase(PROP_ShadowColor);
     758             :                 }
     759         288 :                 if (aShapeProps.hasProperty(PROP_Shadow))
     760          11 :                     aShapeProps.erase(PROP_Shadow);
     761             : 
     762         288 :                 if (oShadowDistance || oShadowColor || aEffectProperties.maShadow.moShadowDir.has())
     763             :                 {
     764          11 :                     css::table::ShadowFormat aFormat;
     765          11 :                     if (oShadowColor)
     766          11 :                         aFormat.Color = *oShadowColor;
     767          11 :                     if (aEffectProperties.maShadow.moShadowDir.has())
     768             :                     {
     769          11 :                         css::table::ShadowLocation nLocation = css::table::ShadowLocation_NONE;
     770          11 :                         switch (aEffectProperties.maShadow.moShadowDir.get())
     771             :                         {
     772             :                         case 13500000:
     773           0 :                             nLocation = css::table::ShadowLocation_TOP_LEFT;
     774           0 :                             break;
     775             :                         case 18900000:
     776           0 :                             nLocation = css::table::ShadowLocation_TOP_RIGHT;
     777           0 :                             break;
     778             :                         case 8100000:
     779           0 :                             nLocation = css::table::ShadowLocation_BOTTOM_LEFT;
     780           0 :                             break;
     781             :                         case 2700000:
     782           7 :                             nLocation = css::table::ShadowLocation_BOTTOM_RIGHT;
     783           7 :                             break;
     784             :                         }
     785          11 :                         aFormat.Location = nLocation;
     786             :                     }
     787          11 :                     aFormat.ShadowWidth = *oShadowDistance;
     788          11 :                     aShapeProps.setProperty(PROP_ShadowFormat, uno::makeAny(aFormat));
     789         288 :                 }
     790             :             }
     791             : 
     792        1775 :             PropertySet( xSet ).setProperties( aShapeProps );
     793        1775 :             if (mbLockedCanvas)
     794             :             {
     795           4 :                 putPropertyToGrabBag( "LockedCanvas", Any( true ) );
     796           4 :                 if (aServiceName == "com.sun.star.drawing.LineShape")
     797             :                 {
     798             :                     // It seems the position and size for lines inside a locked canvas is absolute.
     799           1 :                     mxShape->setPosition(awt::Point(aShapeRectHmm.X, aShapeRectHmm.Y));
     800           1 :                     mxShape->setSize(awt::Size(aShapeRectHmm.Width, aShapeRectHmm.Height));
     801             :                 }
     802             :             }
     803             : 
     804             :             // Store original fill and line colors of the shape and the theme color name to InteropGrabBag
     805        1775 :             Sequence< PropertyValue > aProperties( 6 );  //allocate the maximum possible number of slots
     806        1775 :             sal_Int32 nSize = 2;
     807        1775 :             PUT_PROP( aProperties, 0, "OriginalSolidFillClr", aShapeProps.getProperty(PROP_FillColor) );
     808        1775 :             PUT_PROP( aProperties, 1, "OriginalLnSolidFillClr", aShapeProps.getProperty(PROP_LineColor) );
     809        3550 :             OUString sColorFillScheme = aFillProperties.maFillColor.getSchemeName();
     810        1775 :             if( !aFillProperties.maFillColor.isPlaceHolder() && !sColorFillScheme.isEmpty() )
     811             :             {
     812         176 :                 PUT_PROP( aProperties, nSize, "SpPrSolidFillSchemeClr", sColorFillScheme );
     813         176 :                 nSize++;
     814         176 :                 PUT_PROP( aProperties, nSize, "SpPrSolidFillSchemeClrTransformations",
     815             :                           aFillProperties.maFillColor.getTransformations() );
     816         176 :                 nSize++;
     817             :             }
     818        3550 :             OUString sLnColorFillScheme = aLineProperties.maLineFill.maFillColor.getSchemeName();
     819        1775 :             if( !aLineProperties.maLineFill.maFillColor.isPlaceHolder() && !sLnColorFillScheme.isEmpty() )
     820             :             {
     821         202 :                 PUT_PROP( aProperties, nSize, "SpPrLnSolidFillSchemeClr", sLnColorFillScheme );
     822         202 :                 nSize++;
     823         202 :                 PUT_PROP( aProperties, nSize, "SpPrLnSolidFillSchemeClrTransformations",
     824             :                           aLineProperties.maLineFill.maFillColor.getTransformations() );
     825         202 :                 nSize++;
     826             :             }
     827        1775 :             aProperties.realloc( nSize ); //shrink the Sequence if we didn't use all the slots
     828        1775 :             putPropertiesToGrabBag( aProperties );
     829             : 
     830             :             // Store original gradient fill of the shape to InteropGrabBag
     831             :             // LibreOffice doesn't support all the kinds of gradient so we save its complete definition
     832        1775 :             if( aShapeProps.hasProperty( PROP_FillGradient ) )
     833             :             {
     834         102 :                 Sequence< PropertyValue > aGradientStops( aFillProperties.maGradientProps.maGradientStops.size() );
     835         102 :                 ::std::map< double, Color >::iterator aIt = aFillProperties.maGradientProps.maGradientStops.begin();
     836         379 :                 for( sal_uInt32 i = 0; i < aFillProperties.maGradientProps.maGradientStops.size(); ++i )
     837             :                 { // for each stop in the gradient definition:
     838             : 
     839             :                     // save position
     840         277 :                     Sequence< PropertyValue > aGradientStop( 3 );
     841         277 :                     PUT_PROP( aGradientStop, 0, "Pos", aIt->first );
     842             : 
     843         554 :                     OUString sStopColorScheme = aIt->second.getSchemeName();
     844         277 :                     if( sStopColorScheme.isEmpty() )
     845             :                     {
     846             :                         // save RGB color
     847          79 :                         PUT_PROP( aGradientStop, 1, "RgbClr", aIt->second.getColor( rGraphicHelper, nFillPhClr ) );
     848             :                         // in the case of a RGB color, transformations are already applied to
     849             :                         // the color with the exception of alpha transformations. We only need
     850             :                         // to keep the transparency value to calculate the alpha value later.
     851          79 :                         if( aIt->second.hasTransparency() )
     852             :                         {
     853          22 :                             PUT_PROP( aGradientStop, 2, "Transparency", aIt->second.getTransparency() );
     854             :                         }
     855             :                     }
     856             :                     else
     857             :                     {
     858             :                         // save color with scheme name
     859         198 :                         PUT_PROP( aGradientStop, 1, "SchemeClr", sStopColorScheme );
     860             :                         // save all color transformations
     861         198 :                         PUT_PROP( aGradientStop, 2, "Transformations", aIt->second.getTransformations() );
     862             :                     }
     863             : 
     864         277 :                     PUT_PROP( aGradientStops, i, OUString::number( i ), aGradientStop );
     865         277 :                     ++aIt;
     866         277 :                 }
     867             :                 // If getFillProperties.moFillType is unused that means gradient is defined by a theme
     868             :                 // which is already saved into StyleFillRef property, so no need to save the explicit values too
     869         102 :                 if( getFillProperties().moFillType.has() )
     870          99 :                     putPropertyToGrabBag( "GradFillDefinition", Any( aGradientStops ) );
     871         102 :                 putPropertyToGrabBag( "OriginalGradFill", aShapeProps.getProperty(PROP_FillGradient) );
     872        1775 :             }
     873             :         }
     874             : 
     875             :         // These can have a custom geometry, so position should be set here,
     876             :         // after creation but before custom shape handling, using the position
     877             :         // we got from the caller.
     878        1865 :         if (mbWps && aServiceName != "com.sun.star.text.TextFrame")
     879         376 :             mxShape->setPosition(maPosition);
     880             : 
     881        1865 :         if( bIsCustomShape )
     882             :         {
     883        1146 :             if ( mbFlipH )
     884          10 :                 mpCustomShapePropertiesPtr->setMirroredX( true );
     885        1146 :             if ( mbFlipV )
     886          73 :                 mpCustomShapePropertiesPtr->setMirroredY( true );
     887        1146 :             if( getTextBody() )
     888             :             {
     889         524 :                 sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) );
     890         524 :                 mpCustomShapePropertiesPtr->setTextRotateAngle( nTextRotateAngle / 60000 );
     891             :             }
     892             : 
     893             :             SAL_INFO("oox.cscode", "==cscode== shape name: '" << msName << "'");
     894        1146 :             mpCustomShapePropertiesPtr->pushToPropSet( rFilterBase, xSet, mxShape, maSize );
     895             :         }
     896         719 :         else if( getTextBody() )
     897         104 :             getTextBody()->getTextProperties().pushVertSimulation();
     898             : 
     899             :         // in some cases, we don't have any text body.
     900        1865 :         if( getTextBody() && ( !bDoNotInsertEmptyTextBody || !mpTextBody->isEmpty() ) )
     901             :         {
     902         599 :             Reference < XText > xText( mxShape, UNO_QUERY );
     903         599 :             if ( xText.is() )   // not every shape is supporting an XText interface (e.g. GroupShape)
     904             :             {
     905         599 :                 TextCharacterProperties aCharStyleProperties;
     906         599 :                 if( const ShapeStyleRef* pFontRef = getShapeStyleRef( XML_fontRef ) )
     907             :                 {
     908         340 :                     if( pTheme )
     909         340 :                         if( const TextCharacterProperties* pCharProps = pTheme->getFontStyle( pFontRef->mnThemedIdx ) )
     910         340 :                             aCharStyleProperties.assignUsed( *pCharProps );
     911             :                     SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "use font color");
     912         340 :                     aCharStyleProperties.maCharColor.assignIfUsed( pFontRef->maPhClr );
     913             :                 }
     914             : 
     915        1198 :                 Reference < XTextCursor > xAt = xText->createTextCursor();
     916        1198 :                 getTextBody()->insertAt( rFilterBase, xText, xAt, aCharStyleProperties, mpMasterTextListStyle );
     917         599 :             }
     918        1865 :         }
     919             :     }
     920             : 
     921        1865 :     if( mxShape.is() )
     922        1865 :         finalizeXShape( rFilterBase, rxShapes );
     923             : 
     924        3730 :     return mxShape;
     925             : }
     926             : 
     927          15 : void Shape::keepDiagramCompatibilityInfo( XmlFilterBase& rFilterBase )
     928             : {
     929             :     try
     930             :     {
     931          15 :         if( !maDiagramDoms.hasElements() )
     932           0 :             return;
     933             : 
     934          15 :         Reference < XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
     935          30 :         Reference < XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
     936          15 :         if ( !xSetInfo.is() )
     937           0 :             return;
     938             : 
     939          30 :         const OUString aGrabBagPropName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
     940          15 :         if( !xSetInfo->hasPropertyByName( aGrabBagPropName ) )
     941           0 :             return;
     942             : 
     943          30 :         Sequence < PropertyValue > aGrabBag;
     944          15 :         xSet->getPropertyValue( aGrabBagPropName ) >>= aGrabBag;
     945             : 
     946             :         // We keep the previous items, if present
     947          15 :         if ( aGrabBag.hasElements() )
     948             :         {
     949           0 :             sal_Int32 length = aGrabBag.getLength();
     950           0 :             aGrabBag.realloc( length+maDiagramDoms.getLength() );
     951             : 
     952           0 :             for( sal_Int32 i = 0; i < maDiagramDoms.getLength(); ++i )
     953           0 :                 aGrabBag[length+i] = maDiagramDoms[i];
     954             : 
     955           0 :             xSet->setPropertyValue( aGrabBagPropName, Any( aGrabBag ) );
     956             :         } else
     957          15 :             xSet->setPropertyValue( aGrabBagPropName, Any( maDiagramDoms ) );
     958             : 
     959          15 :         xSet->setPropertyValue( OUString( "MoveProtect" ), Any( sal_True ) );
     960          15 :         xSet->setPropertyValue( OUString( "SizeProtect" ), Any( sal_True ) );
     961             : 
     962             :         // Replace existing shapes with a new Graphic Object rendered
     963             :         // from them
     964          30 :         Reference < XShape > xShape( renderDiagramToGraphic( rFilterBase ) );
     965          30 :         Reference < XShapes > xShapes( mxShape, UNO_QUERY_THROW );
     966         170 :         while( xShapes->hasElements() )
     967         140 :             xShapes->remove( Reference < XShape > ( xShapes->getByIndex( 0 ),  UNO_QUERY_THROW ) );
     968          30 :         xShapes->add( xShape );
     969             :     }
     970           0 :     catch( const Exception& e )
     971             :     {
     972             :         SAL_WARN( "oox.drawingml", OSL_THIS_FUNC << "Exception: " << e.Message );
     973             :     }
     974             : }
     975             : 
     976          15 : Reference < XShape > Shape::renderDiagramToGraphic( XmlFilterBase& rFilterBase )
     977             : {
     978          15 :     Reference< XShape > xShape;
     979             : 
     980             :     try
     981             :     {
     982          15 :         if( !maDiagramDoms.hasElements() )
     983           5 :             return xShape;
     984             : 
     985             :         // Stream in which to place the rendered shape
     986          15 :         SvMemoryStream mpTempStream;
     987          25 :         Reference < io::XStream > xStream( new utl::OStreamWrapper( mpTempStream ) );
     988          25 :         Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() );
     989             : 
     990             :         // Rendering format
     991          25 :         OUString sFormat( "PNG" );
     992             : 
     993             :         // Size of the rendering
     994          15 :         awt::Size aActualSize = mxShape->getSize();
     995          15 :         Size aResolution( Application::GetDefaultDevice()->LogicToPixel( Size( 100, 100 ), MAP_CM ) );
     996          15 :         double fPixelsPer100thmm = static_cast < double > ( aResolution.Width() ) / 100000.0;
     997          15 :         awt::Size aSize = awt::Size( static_cast < sal_Int32 > ( ( fPixelsPer100thmm * aActualSize.Width ) + 0.5 ),
     998          30 :                                      static_cast < sal_Int32 > ( ( fPixelsPer100thmm * aActualSize.Height ) + 0.5 ) );
     999             : 
    1000          25 :         Sequence< PropertyValue > aFilterData( 7 );
    1001          15 :         aFilterData[ 0 ].Name = "Compression";
    1002          15 :         aFilterData[ 0 ].Value <<= static_cast < sal_Int32 > ( 9 );
    1003          15 :         aFilterData[ 1 ].Name = "Interlaced";
    1004          15 :         aFilterData[ 1 ].Value <<= static_cast < sal_Int32 > ( 1 );
    1005          15 :         aFilterData[ 2 ].Name = "Translucent";
    1006          15 :         aFilterData[ 2 ].Value <<= static_cast < sal_Int32 > ( 1 );
    1007          15 :         aFilterData[ 3 ].Name = "PixelWidth";
    1008          15 :         aFilterData[ 3 ].Value <<= aSize.Width;
    1009          15 :         aFilterData[ 4 ].Name = "PixelHeight";
    1010          15 :         aFilterData[ 4 ].Value <<= aSize.Height;
    1011          15 :         aFilterData[ 5 ].Name = "LogicalWidth";
    1012          15 :         aFilterData[ 5 ].Value <<= aActualSize.Width;
    1013          15 :         aFilterData[ 6 ].Name = "LogicalHeight";
    1014          15 :         aFilterData[ 6 ].Value <<= aActualSize.Height;
    1015             : 
    1016          25 :         Sequence < PropertyValue > aDescriptor( 3 );
    1017          15 :         aDescriptor[ 0 ].Name = "OutputStream";
    1018          15 :         aDescriptor[ 0 ].Value <<= xOutputStream;
    1019          15 :         aDescriptor[ 1 ].Name = "FilterName";
    1020          15 :         aDescriptor[ 1 ].Value <<= sFormat;
    1021          15 :         aDescriptor[ 2 ].Name = "FilterData";
    1022          15 :         aDescriptor[ 2 ].Value <<= aFilterData;
    1023             : 
    1024          25 :         Reference < lang::XComponent > xSourceDoc( mxShape, UNO_QUERY_THROW );
    1025          25 :         Reference < XGraphicExportFilter > xGraphicExporter = GraphicExportFilter::create( rFilterBase.getComponentContext() );
    1026          15 :         xGraphicExporter->setSourceDocument( xSourceDoc );
    1027          15 :         xGraphicExporter->filter( aDescriptor );
    1028             : 
    1029          15 :         mpTempStream.Seek( STREAM_SEEK_TO_BEGIN );
    1030             : 
    1031          25 :         Graphic aGraphic;
    1032          25 :         GraphicFilter aFilter( false );
    1033          15 :         if ( aFilter.ImportGraphic( aGraphic, "", mpTempStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, static_cast < Sequence < PropertyValue >* > ( NULL ), NULL ) != GRFILTER_OK )
    1034             :         {
    1035             :             SAL_WARN( "oox.drawingml", OSL_THIS_FUNC
    1036             :                       << "Unable to import rendered stream into graphic object" );
    1037           5 :             return xShape;
    1038             :         }
    1039             : 
    1040          20 :         Reference < graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
    1041          20 :         Reference < lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), UNO_QUERY_THROW );
    1042          10 :         xShape = Reference < XShape > ( xServiceFact->createInstance( OUString( "com.sun.star.drawing.GraphicObjectShape" ) ), UNO_QUERY_THROW );
    1043          20 :         Reference < XPropertySet > xPropSet( xShape, UNO_QUERY_THROW );
    1044          10 :         xPropSet->setPropertyValue( OUString( "Graphic" ), Any( xGraphic ) );
    1045          10 :         xPropSet->setPropertyValue( OUString( "MoveProtect" ), Any( sal_True ) );
    1046          10 :         xPropSet->setPropertyValue( OUString( "SizeProtect" ), Any( sal_True ) );
    1047          20 :         xPropSet->setPropertyValue( OUString( "Name" ), Any( OUString( "RenderedShapes" ) ) );
    1048             :     }
    1049           0 :     catch( const Exception& e )
    1050             :     {
    1051             :         SAL_WARN( "oox.drawingml", OSL_THIS_FUNC << "Exception: " << e.Message );
    1052             :     }
    1053             : 
    1054          10 :     return xShape;
    1055             : }
    1056             : 
    1057        1713 : void Shape::setTextBody(const TextBodyPtr & pTextBody)
    1058             : {
    1059        1713 :     mpTextBody = pTextBody;
    1060        1713 : }
    1061             : 
    1062             : 
    1063        7713 : TextBodyPtr Shape::getTextBody()
    1064             : {
    1065        7713 :     return mpTextBody;
    1066             : }
    1067             : 
    1068         969 : void Shape::setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle )
    1069             : {
    1070             :     SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "set master text list style to shape id: " << msId);
    1071             : 
    1072         969 :     mpMasterTextListStyle = pMasterTextListStyle;
    1073         969 : }
    1074             : 
    1075        1865 : OUString Shape::finalizeServiceName( XmlFilterBase& rFilter, const OUString& rServiceName, const awt::Rectangle& rShapeRect )
    1076             : {
    1077        1865 :     OUString aServiceName = rServiceName;
    1078        1865 :     switch( meFrameType )
    1079             :     {
    1080             :         case FRAMETYPE_OLEOBJECT:
    1081             :         {
    1082           0 :             awt::Size aOleSize( rShapeRect.Width, rShapeRect.Height );
    1083           0 :             if( rFilter.getOleObjectHelper().importOleObject( maShapeProperties, *mxOleObjectInfo, aOleSize ) )
    1084           0 :                 aServiceName = "com.sun.star.drawing.OLE2Shape";
    1085             : 
    1086             :             // get the path to the representation graphic
    1087           0 :             OUString aGraphicPath;
    1088           0 :             if( !mxOleObjectInfo->maShapeId.isEmpty() )
    1089           0 :                 if( ::oox::vml::Drawing* pVmlDrawing = rFilter.getVmlDrawing() )
    1090           0 :                     if( const ::oox::vml::ShapeBase* pVmlShape = pVmlDrawing->getShapes().getShapeById( mxOleObjectInfo->maShapeId, true ) )
    1091           0 :                         aGraphicPath = pVmlShape->getGraphicPath();
    1092             : 
    1093             :             // import and store the graphic
    1094           0 :             if( !aGraphicPath.isEmpty() )
    1095             :             {
    1096           0 :                 Reference< graphic::XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath );
    1097           0 :                 if( xGraphic.is() )
    1098           0 :                     maShapeProperties.setProperty(PROP_Graphic, xGraphic);
    1099           0 :             }
    1100             :         }
    1101           0 :         break;
    1102             : 
    1103             :         default:;
    1104             :     }
    1105        1865 :     return aServiceName;
    1106             : }
    1107             : 
    1108        1865 : void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >& rxShapes )
    1109             : {
    1110        1865 :     switch( meFrameType )
    1111             :     {
    1112             :         case FRAMETYPE_CHART:
    1113             :         {
    1114             :             OSL_ENSURE( !mxChartShapeInfo->maFragmentPath.isEmpty(), "Shape::finalizeXShape - missing chart fragment" );
    1115          65 :             if( mxShape.is() && !mxChartShapeInfo->maFragmentPath.isEmpty() ) try
    1116             :             {
    1117             :                 // set the chart2 OLE class ID at the OLE shape
    1118          65 :                 PropertySet aShapeProp( mxShape );
    1119          65 :                 aShapeProp.setProperty( PROP_CLSID, OUString( "12dcae26-281f-416f-a234-c3086127382e" ) );
    1120             : 
    1121             :                 // get the XModel interface of the embedded object from the OLE shape
    1122         130 :                 Reference< frame::XModel > xDocModel;
    1123          65 :                 aShapeProp.getProperty( xDocModel, PROP_Model );
    1124         130 :                 Reference< chart2::XChartDocument > xChartDoc( xDocModel, UNO_QUERY_THROW );
    1125             : 
    1126             :                 // load the chart data from the XML fragment
    1127         130 :                 chart::ChartSpaceModel aModel;
    1128          65 :                 rFilter.importFragment( new chart::ChartSpaceFragment( rFilter, mxChartShapeInfo->maFragmentPath, aModel ) );
    1129             : 
    1130             :                 // convert imported chart model to chart document
    1131         130 :                 Reference< drawing::XShapes > xExternalPage;
    1132          65 :                 if( !mxChartShapeInfo->mbEmbedShapes )
    1133           0 :                     xExternalPage = rxShapes;
    1134          65 :                 if( rFilter.getChartConverter() )
    1135             :                 {
    1136          65 :                     rFilter.getChartConverter()->convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() );
    1137          65 :                     if( !xChartDoc->hasInternalDataProvider() )
    1138             :                     {
    1139          10 :                         Reference< chart2::data::XDataReceiver > xDataRec( xChartDoc, UNO_QUERY );
    1140          20 :                         Reference< chart2::data::XDataSource > xData( xDataRec->getUsedData(), UNO_QUERY );
    1141          10 :                         if( xData->getDataSequences().getLength() <= 0 || xData->getDataSequences()[0]->getValues()->getData().getLength() <= 0 )
    1142             :                         {
    1143           0 :                             rFilter.useInternalChartDataTable( true );
    1144           0 :                             rFilter.getChartConverter()->convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() );
    1145           0 :                             rFilter.useInternalChartDataTable( false );
    1146          10 :                         }
    1147             :                     }
    1148             : 
    1149          65 :                 }
    1150             :             }
    1151           0 :             catch( Exception& )
    1152             :             {
    1153             :             }
    1154             :         }
    1155          65 :         break;
    1156             : 
    1157             :         default:;
    1158             :     }
    1159        1865 : }
    1160             : 
    1161        1733 : void Shape::putPropertyToGrabBag( const OUString& sPropertyName, const Any& aPropertyValue )
    1162             : {
    1163        1733 :     PropertyValue pNewProperty;
    1164        1733 :     pNewProperty.Name = sPropertyName;
    1165        1733 :     pNewProperty.Value = aPropertyValue;
    1166        1733 :     putPropertyToGrabBag( pNewProperty );
    1167        1733 : }
    1168             : 
    1169        1733 : void Shape::putPropertyToGrabBag( const PropertyValue& pProperty )
    1170             : {
    1171        1733 :     Reference< XPropertySet > xSet( mxShape, UNO_QUERY );
    1172        3466 :     Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
    1173        3466 :     const OUString& aGrabBagPropName = OUString( UNO_NAME_MISC_OBJ_INTEROPGRABBAG );
    1174        1733 :     if( mxShape.is() && xSet.is() && xSetInfo.is() && xSetInfo->hasPropertyByName( aGrabBagPropName ) )
    1175             :     {
    1176        1545 :         Sequence< PropertyValue > aGrabBag;
    1177        1545 :         xSet->getPropertyValue( aGrabBagPropName ) >>= aGrabBag;
    1178             : 
    1179        1545 :         sal_Int32 length = aGrabBag.getLength();
    1180        1545 :         aGrabBag.realloc( length + 1 );
    1181        1545 :         aGrabBag[length] = pProperty;
    1182             : 
    1183        1545 :         xSet->setPropertyValue( aGrabBagPropName, Any( aGrabBag ) );
    1184        1733 :     }
    1185        1733 : }
    1186             : 
    1187        1775 : void Shape::putPropertiesToGrabBag( const Sequence< PropertyValue >& aProperties )
    1188             : {
    1189        1775 :     Reference< XPropertySet > xSet( mxShape, UNO_QUERY );
    1190        3550 :     Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
    1191        3550 :     const OUString& aGrabBagPropName = OUString( UNO_NAME_MISC_OBJ_INTEROPGRABBAG );
    1192        1775 :     if( mxShape.is() && xSet.is() && xSetInfo.is() && xSetInfo->hasPropertyByName( aGrabBagPropName ) )
    1193             :     {
    1194             :         // get existing grab bag
    1195        1386 :         Sequence< PropertyValue > aGrabBag;
    1196        1386 :         xSet->getPropertyValue( aGrabBagPropName ) >>= aGrabBag;
    1197        1386 :         sal_Int32 length = aGrabBag.getLength();
    1198             : 
    1199             :         // update grab bag size to contain the new items
    1200        1386 :         aGrabBag.realloc( length + aProperties.getLength() );
    1201             : 
    1202             :         // put the new items
    1203        4896 :         for( sal_Int32 i=0; i < aProperties.getLength(); ++i )
    1204             :         {
    1205        3510 :             aGrabBag[length + i].Name = aProperties[i].Name;
    1206        3510 :             aGrabBag[length + i].Value = aProperties[i].Value;
    1207             :         }
    1208             : 
    1209             :         // put it back to the shape
    1210        1386 :         xSet->setPropertyValue( aGrabBagPropName, Any( aGrabBag ) );
    1211        1775 :     }
    1212        1775 : }
    1213             : 
    1214          37 : uno::Sequence< uno::Sequence< uno::Any > >  Shape::resolveRelationshipsOfTypeFromOfficeDoc(core::XmlFilterBase& rFilter, const OUString& sFragment, const OUString& sType )
    1215             : {
    1216          37 :     uno::Sequence< uno::Sequence< uno::Any > > xRelListTemp;
    1217          37 :     sal_Int32 counter = 0;
    1218             : 
    1219          74 :     core::RelationsRef xRels = rFilter.importRelations( sFragment );
    1220          37 :     if ( xRels )
    1221             :     {
    1222          37 :         core::RelationsRef xImageRels = xRels->getRelationsFromTypeFromOfficeDoc( sType );
    1223          37 :         if ( xImageRels )
    1224             :         {
    1225          37 :             xRelListTemp.realloc( xImageRels->size() );
    1226          61 :             for( ::std::map< OUString, core::Relation >::const_iterator aIt = xImageRels->begin(), aEnd = xImageRels->end(); aIt != aEnd; ++aIt )
    1227             :             {
    1228          24 :                 uno::Sequence< uno::Any > diagramRelTuple (3);
    1229             :                 // [0] => RID, [1] => InputStream [2] => extension
    1230          48 :                 OUString sRelId = aIt->second.maId;
    1231             : 
    1232          24 :                 diagramRelTuple[0] = uno::makeAny ( sRelId );
    1233          48 :                 OUString sTarget = xImageRels->getFragmentPathFromRelId( sRelId );
    1234             : 
    1235          48 :                 uno::Reference< io::XInputStream > xImageInputStrm( rFilter.openInputStream( sTarget ), uno::UNO_SET_THROW );
    1236          48 :                 StreamDataSequence dataSeq;
    1237          24 :                 if ( rFilter.importBinaryData( dataSeq, sTarget ) )
    1238             :                 {
    1239          24 :                     diagramRelTuple[1] = uno::makeAny( dataSeq );
    1240             :                 }
    1241             : 
    1242          24 :                 diagramRelTuple[2] = uno::makeAny( sTarget.copy( sTarget.lastIndexOf(".") ) );
    1243             : 
    1244          24 :                 xRelListTemp[counter] = diagramRelTuple;
    1245          24 :                 ++counter;
    1246          24 :             }
    1247          37 :             xRelListTemp.realloc(counter);
    1248             : 
    1249          37 :         }
    1250             :     }
    1251          74 :     return xRelListTemp;
    1252             : }
    1253             : 
    1254         177 : } }
    1255             : 
    1256             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10