LCOV - code coverage report
Current view: top level - oox/source/drawingml - customshapeproperties.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 66 202 32.7 %
Date: 2012-08-25 Functions: 11 14 78.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 71 454 15.6 %

           Branch data     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/customshapeproperties.hxx"
      21                 :            : #include "oox/helper/helper.hxx"
      22                 :            : #include "oox/helper/propertymap.hxx"
      23                 :            : #include "oox/helper/propertyset.hxx"
      24                 :            : #include "oox/token/tokenmap.hxx"
      25                 :            : #include <com/sun/star/awt/Rectangle.hpp>
      26                 :            : #include <com/sun/star/awt/Size.hpp>
      27                 :            : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      28                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      29                 :            : #include <com/sun/star/graphic/XGraphicTransformer.hpp>
      30                 :            : #include <com/sun/star/drawing/XShape.hpp>
      31                 :            : #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
      32                 :            : #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
      33                 :            : 
      34                 :            : using rtl::OUString;
      35                 :            : using namespace ::oox::core;
      36                 :            : using namespace ::com::sun::star;
      37                 :            : using namespace ::com::sun::star::uno;
      38                 :            : using namespace ::com::sun::star::beans;
      39                 :            : using namespace ::com::sun::star::graphic;
      40                 :            : using namespace ::com::sun::star::drawing;
      41                 :            : 
      42                 :            : # define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr()
      43                 :            : 
      44                 :            : namespace oox { namespace drawingml {
      45                 :            : 
      46                 :        537 : CustomShapeProperties::CustomShapeProperties()
      47                 :            : : mnShapePresetType ( -1 )
      48                 :            : , mbMirroredX   ( sal_False )
      49                 :            : , mbMirroredY   ( sal_False )
      50                 :            : , mnTextRotateAngle ( 0 )
      51 [ +  - ][ +  - ]:        537 : , mnArcNum ( 0 )
         [ +  - ][ +  - ]
                 [ +  - ]
      52                 :            : {
      53                 :        537 : }
      54                 :        579 : CustomShapeProperties::~CustomShapeProperties()
      55                 :            : {
      56         [ -  + ]:       1158 : }
      57                 :            : 
      58                 :          0 : ::rtl::OUString CustomShapeProperties::getShapePresetTypeName() const
      59                 :            : {
      60                 :          0 :     return StaticTokenMap::get().getUnicodeTokenName( mnShapePresetType );
      61                 :            : }
      62                 :            : 
      63                 :          0 : sal_Int32 CustomShapeProperties::SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide )
      64                 :            : {
      65                 :          0 :     sal_uInt32 nIndex = 0;
      66         [ #  # ]:          0 :     for( ; nIndex < rGuideList.size(); nIndex++ )
      67                 :            :     {
      68         [ #  # ]:          0 :         if ( rGuideList[ nIndex ].maName == rGuide.maName )
      69                 :          0 :             break;
      70                 :            :     }
      71         [ #  # ]:          0 :     if ( nIndex == rGuideList.size() )
      72                 :          0 :         rGuideList.push_back( rGuide );
      73                 :          0 :     return static_cast< sal_Int32 >( nIndex );
      74                 :            : }
      75                 :            : 
      76                 :            : // returns the index into the guidelist for a given formula name,
      77                 :            : // if the return value is < 0 then the guide value could not be found
      78                 :          0 : sal_Int32 CustomShapeProperties::GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const rtl::OUString& rFormulaName )
      79                 :            : {
      80                 :            :     // traverse the list from the end, because guide names can be reused
      81                 :            :     // and current is the last one
      82                 :            :     // see a1 guide in gear6 custom shape preset as example
      83                 :          0 :     sal_Int32 nIndex = static_cast< sal_Int32 >( rGuideList.size() ) - 1;
      84         [ #  # ]:          0 :     for( ; nIndex >= 0; nIndex-- )
      85                 :            :     {
      86         [ #  # ]:          0 :         if ( rGuideList[ nIndex ].maName == rFormulaName )
      87                 :          0 :             break;
      88                 :            :     }
      89                 :            : 
      90                 :          0 :     return nIndex;
      91                 :            : }
      92                 :            : 
      93         [ +  - ]:         95 : CustomShapeProperties::PresetsMap CustomShapeProperties::maPresetsMap;
      94                 :            : 
      95                 :         30 : static OUString GetConnectorShapeType( sal_Int32 nType )
      96                 :            : {
      97                 :            :     OSL_TRACE("GetConnectorShapeType preset: %d %d", nType, XML_straightConnector1);
      98                 :            : 
      99                 :         30 :     OUString sType;
     100         [ +  + ]:         30 :     switch( nType )
     101                 :            :     {
     102                 :            :         case XML_straightConnector1: {
     103 [ +  + ][ +  - ]:         12 :             static const OUString sStraightConnector1 = CREATE_OUSTRING( "mso-spt32" );
         [ +  - ][ #  # ]
     104                 :         12 :             sType = sStraightConnector1;
     105                 :         12 :             } break;
     106                 :            :         default:
     107                 :         18 :             break;
     108                 :            :     }
     109                 :         30 :     return sType;
     110                 :            : }
     111                 :            : 
     112                 :            : 
     113                 :         30 : void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFilterBase */,
     114                 :            :     const Reference < XPropertySet >& xPropSet, const Reference < XShape > & xShape )
     115                 :            : {
     116         [ +  - ]:         30 :     if ( mnShapePresetType >= 0 )
     117                 :            :     {
     118                 :            :         OSL_TRACE("preset: %d", mnShapePresetType);
     119                 :            : 
     120         [ +  + ]:         30 :         if (maPresetsMap.empty())
     121         [ +  - ]:          9 :             initializePresetsMap();
     122                 :            : 
     123         [ +  - ]:         30 :         PropertyMap aPropertyMap;
     124         [ +  - ]:         30 :         PropertySet aPropSet( xPropSet );
     125                 :            : 
     126         [ +  - ]:         30 :         OUString sConnectorShapeType = GetConnectorShapeType( mnShapePresetType );
     127                 :            : 
     128         [ +  + ]:         30 :         if (sConnectorShapeType.getLength() > 0)
     129                 :            :         {
     130                 :            :             OSL_TRACE("connector shape: %s (%d)", USS(sConnectorShapeType), mnShapePresetType);
     131                 :            :             //const uno::Reference < drawing::XShape > xShape( xPropSet, UNO_QUERY );
     132         [ +  - ]:         12 :             Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY );
     133         [ +  - ]:         12 :             if( xDefaulter.is() ) {
     134 [ +  - ][ +  - ]:         12 :                 xDefaulter->createCustomShapeDefaults( sConnectorShapeType );
     135 [ +  - ][ +  - ]:         12 :                 aPropertyMap[ PROP_Type ] <<= Any( sConnectorShapeType );
                 [ +  - ]
     136                 :         12 :             }
     137                 :            :         }
     138 [ +  - ][ +  - ]:         18 :         else if (maPresetsMap.find(mnShapePresetType) != maPresetsMap.end())
                 [ +  - ]
     139                 :            :         {
     140                 :            :             OSL_TRACE("found property map for preset: %s (%d)", USS(getShapePresetTypeName()), mnShapePresetType);
     141                 :            : 
     142         [ +  - ]:         18 :             CustomShapeProvider *pProvider = maPresetsMap[ mnShapePresetType ];
     143         [ +  - ]:         18 :             if (pProvider)
     144 [ +  - ][ +  - ]:         18 :                 aPropertyMap = pProvider->getProperties();
     145                 :            : #ifdef DEBUG
     146                 :            :             aPropertyMap.dumpCode();
     147                 :            : #endif
     148                 :            :         }
     149                 :            : 
     150 [ +  - ][ +  - ]:         30 :         aPropertyMap[ PROP_MirroredX ] <<= Any( mbMirroredX );
                 [ +  - ]
     151 [ +  - ][ +  - ]:         30 :         aPropertyMap[ PROP_MirroredY ] <<= Any( mbMirroredY );
                 [ +  - ]
     152 [ +  - ][ +  - ]:         30 :         aPropertyMap[ PROP_TextPreRotateAngle ] <<= Any( mnTextRotateAngle );
                 [ +  - ]
     153 [ +  - ][ +  - ]:         30 :         aPropertyMap[ PROP_IsPostRotateAngle ] <<= true; // For OpenXML Imports
     154         [ +  - ]:         30 :         Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence();
     155         [ +  - ]:         30 :         aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq );
     156                 :            : 
     157         [ -  + ]:         30 :         if ( maAdjustmentGuideList.size() )
     158                 :            :         {
     159         [ #  # ]:          0 :             const OUString sType = CREATE_OUSTRING( "Type" );
     160         [ #  # ]:          0 :             const OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
     161 [ #  # ][ #  # ]:          0 :             uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry );
     162         [ #  # ]:          0 :             uno::Sequence< beans::PropertyValue > aGeoPropSeq;
     163 [ #  # ][ #  # ]:          0 :             if ( aGeoPropSet >>= aGeoPropSeq )
     164                 :            :             {
     165                 :          0 :                 sal_Int32 i, nCount = aGeoPropSeq.getLength();
     166         [ #  # ]:          0 :                 for ( i = 0; i < nCount; i++ )
     167                 :            :                 {
     168         [ #  # ]:          0 :                     const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM( "AdjustmentValues" ) );
     169 [ #  # ][ #  # ]:          0 :                     if ( aGeoPropSeq[ i ].Name.equals( sAdjustmentValues ) )
     170                 :            :                     {
     171         [ #  # ]:          0 :                         uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
     172 [ #  # ][ #  # ]:          0 :                         if ( aGeoPropSeq[ i ].Value >>= aAdjustmentSeq )
                 [ #  # ]
     173                 :            :                         {
     174         [ #  # ]:          0 :                             std::vector< CustomShapeGuide >::const_iterator aIter( maAdjustmentGuideList.begin() );
     175 [ #  # ][ #  # ]:          0 :                             while( aIter != maAdjustmentGuideList.end() )
     176                 :            :                             {
     177         [ #  # ]:          0 :                                 if ( (*aIter).maName.getLength() > 3 )
     178                 :            :                                 {
     179                 :          0 :                                     sal_Int32 nAdjustmentIndex = (*aIter).maName.copy( 3 ).toInt32() - 1;
     180 [ #  # ][ #  # ]:          0 :                                     if ( ( nAdjustmentIndex >= 0 ) && ( nAdjustmentIndex < aAdjustmentSeq.getLength() ) )
                 [ #  # ]
     181                 :            :                                     {
     182                 :          0 :                                         EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
     183         [ #  # ]:          0 :                                         aAdjustmentVal.Value <<= (*aIter).maFormula.toInt32();
     184                 :          0 :                                         aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
     185         [ #  # ]:          0 :                                         aAdjustmentSeq[ nAdjustmentIndex ] = aAdjustmentVal;
     186                 :            :                                     }
     187         [ #  # ]:          0 :                                 } else if ( aAdjustmentSeq.getLength() > 0 ) {
     188                 :          0 :                                     EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
     189         [ #  # ]:          0 :                                     aAdjustmentVal.Value <<= (*aIter).maFormula.toInt32();
     190                 :          0 :                                     aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
     191         [ #  # ]:          0 :                                     aAdjustmentSeq[ 0 ] = aAdjustmentVal;
     192                 :            :                                 }
     193         [ #  # ]:          0 :                                 aIter++;
     194                 :            :                             }
     195 [ #  # ][ #  # ]:          0 :                             aGeoPropSeq[ i ].Value <<= aAdjustmentSeq;
     196 [ #  # ][ #  # ]:          0 :                             xPropSet->setPropertyValue( sCustomShapeGeometry, Any( aGeoPropSeq ) );
                 [ #  # ]
     197         [ #  # ]:          0 :                         }
     198                 :            :                     }
     199 [ #  # ][ #  # ]:          0 :                     else if ( aGeoPropSeq[ i ].Name.equals( sType ) )
     200                 :            :                     {
     201         [ #  # ]:          0 :                         if ( sConnectorShapeType.getLength() > 0 )
     202 [ #  # ][ #  # ]:          0 :                             aGeoPropSeq[ i ].Value <<= sConnectorShapeType;
     203                 :            :                         else
     204 [ #  # ][ #  # ]:          0 :                             aGeoPropSeq[ i ].Value <<= CREATE_OUSTRING( "ooxml-CustomShape" );
                 [ #  # ]
     205                 :            :                     }
     206                 :          0 :                 }
     207         [ #  # ]:          0 :             }
     208 [ +  - ][ +  - ]:         30 :         }
     209                 :            :     }
     210                 :            :     else
     211                 :            :     {
     212                 :            :         sal_uInt32 i;
     213         [ #  # ]:          0 :         PropertyMap aPropertyMap;
     214 [ #  # ][ #  # ]:          0 :         aPropertyMap[ PROP_Type ] <<= CREATE_OUSTRING( "ooxml-non-primitive" );
                 [ #  # ]
     215 [ #  # ][ #  # ]:          0 :         aPropertyMap[ PROP_MirroredX ] <<= Any( mbMirroredX );
                 [ #  # ]
     216 [ #  # ][ #  # ]:          0 :         aPropertyMap[ PROP_MirroredY ] <<= Any( mbMirroredY );
                 [ #  # ]
     217                 :          0 :         awt::Size aSize;
     218                 :          0 :         awt::Rectangle aViewBox( 0, 0, aSize.Width * 360, aSize.Height * 360 );
     219 [ #  # ][ #  # ]:          0 :         aPropertyMap[ PROP_ViewBox ] <<= aViewBox;
     220                 :            : 
     221         [ #  # ]:          0 :         Sequence< EnhancedCustomShapeAdjustmentValue > aAdjustmentValues( maAdjustmentGuideList.size() );
     222         [ #  # ]:          0 :         for ( i = 0; i < maAdjustmentGuideList.size(); i++ )
     223                 :            :         {
     224                 :          0 :             EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
     225         [ #  # ]:          0 :             aAdjustmentVal.Value <<= maAdjustmentGuideList[ i ].maFormula.toInt32();
     226                 :          0 :             aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
     227         [ #  # ]:          0 :             aAdjustmentValues[ i ] = aAdjustmentVal;
     228                 :          0 :         }
     229 [ #  # ][ #  # ]:          0 :         aPropertyMap[ PROP_AdjustmentValues ] <<= aAdjustmentValues;
     230                 :            : 
     231         [ #  # ]:          0 :         PropertyMap aPath;
     232                 :            : 
     233         [ #  # ]:          0 :         Sequence< EnhancedCustomShapeSegment > aSegments( maSegments.size() );
     234         [ #  # ]:          0 :         for ( i = 0; i < maSegments.size(); i++ )
     235         [ #  # ]:          0 :             aSegments[ i ] = maSegments[ i ];
     236 [ #  # ][ #  # ]:          0 :         aPath[ PROP_Segments ] <<= aSegments;
     237                 :            : 
     238         [ #  # ]:          0 :         if ( maTextRect.has() ) {
     239         [ #  # ]:          0 :             Sequence< EnhancedCustomShapeTextFrame > aTextFrames(1);
     240         [ #  # ]:          0 :             aTextFrames[0].TopLeft.First = maTextRect.get().l;
     241         [ #  # ]:          0 :             aTextFrames[0].TopLeft.Second = maTextRect.get().t;
     242         [ #  # ]:          0 :             aTextFrames[0].BottomRight.First = maTextRect.get().r;
     243         [ #  # ]:          0 :             aTextFrames[0].BottomRight.Second = maTextRect.get().b;
     244 [ #  # ][ #  # ]:          0 :             aPath[ PROP_TextFrames ] <<= aTextFrames;
                 [ #  # ]
     245                 :            :         }
     246                 :            : 
     247                 :          0 :         sal_uInt32 j, k, nParameterPairs = 0;
     248         [ #  # ]:          0 :         for ( i = 0; i < maPath2DList.size(); i++ )
     249                 :          0 :             nParameterPairs += maPath2DList[ i ].parameter.size();
     250                 :            : 
     251         [ #  # ]:          0 :         Sequence< EnhancedCustomShapeParameterPair > aParameterPairs( nParameterPairs );
     252         [ #  # ]:          0 :         for ( i = 0, k = 0; i < maPath2DList.size(); i++ )
     253         [ #  # ]:          0 :             for ( j = 0; j < maPath2DList[ i ].parameter.size(); j++ )
     254         [ #  # ]:          0 :                 aParameterPairs[ k++ ] = maPath2DList[ i ].parameter[ j ];
     255 [ #  # ][ #  # ]:          0 :         aPath[ PROP_Coordinates ] <<= aParameterPairs;
     256                 :            : 
     257         [ #  # ]:          0 :         if ( maPath2DList.size() )
     258                 :            :         {
     259                 :          0 :             sal_Bool bAllZero = sal_True;
     260         [ #  # ]:          0 :             for ( i=0; i < maPath2DList.size(); i++ )
     261                 :            :             {
     262 [ #  # ][ #  # ]:          0 :                 if ( maPath2DList[i].w || maPath2DList[i].h ) {
                 [ #  # ]
     263                 :          0 :                     bAllZero = sal_False;
     264                 :          0 :                     break;
     265                 :            :                 }
     266                 :            :             }
     267                 :            : 
     268         [ #  # ]:          0 :             if ( !bAllZero ) {
     269         [ #  # ]:          0 :                 Sequence< awt::Size > aSubViewSize( maPath2DList.size() );
     270         [ #  # ]:          0 :                 for ( i=0; i < maPath2DList.size(); i++ )
     271                 :            :                 {
     272         [ #  # ]:          0 :                     aSubViewSize[i].Width = static_cast< sal_Int32 >( maPath2DList[i].w );
     273         [ #  # ]:          0 :                     aSubViewSize[i].Height = static_cast< sal_Int32 >( maPath2DList[i].h );
     274                 :            :                     OSL_TRACE("set subpath %d size: %d x %d", i, maPath2DList[i].w, maPath2DList[i].h);
     275                 :            :                 }
     276 [ #  # ][ #  # ]:          0 :                 aPath[ PROP_SubViewSize ] <<= aSubViewSize;
                 [ #  # ]
     277                 :            :             }
     278                 :            :         }
     279                 :            : 
     280         [ #  # ]:          0 :         Sequence< PropertyValue > aPathSequence = aPath.makePropertyValueSequence();
     281 [ #  # ][ #  # ]:          0 :         aPropertyMap[ PROP_Path ] <<= aPathSequence;
     282                 :            : 
     283         [ #  # ]:          0 :         Sequence< rtl::OUString > aEquations( maGuideList.size() );
     284         [ #  # ]:          0 :         for ( i = 0; i < maGuideList.size(); i++ )
     285         [ #  # ]:          0 :             aEquations[ i ] = maGuideList[ i ].maFormula;
     286 [ #  # ][ #  # ]:          0 :         aPropertyMap[ PROP_Equations ] <<= aEquations;
     287                 :            : 
     288         [ #  # ]:          0 :         Sequence< PropertyValues > aHandles( maAdjustHandleList.size() );
     289         [ #  # ]:          0 :         for ( i = 0; i < maAdjustHandleList.size(); i++ )
     290                 :            :         {
     291         [ #  # ]:          0 :             PropertyMap aHandle;
     292                 :            :             // maAdjustmentHandle[ i ].gdRef1 ... maAdjustmentHandle[ i ].gdRef2 ... :(
     293                 :            :             // gdRef1 && gdRef2 -> we do not offer such reference, so it is difficult
     294                 :            :             // to determine the correct adjustment handle that should be updated with the adjustment
     295                 :            :             // position. here is the solution: the adjustment value that is used within the position
     296                 :            :             // has to be updated, in case the position is a formula the first usage of a
     297                 :            :             // adjustment value is decisive
     298         [ #  # ]:          0 :             if ( maAdjustHandleList[ i ].polar )
     299                 :            :             {
     300 [ #  # ][ #  # ]:          0 :                 aHandle[ PROP_Position ] <<= maAdjustHandleList[ i ].pos;
     301         [ #  # ]:          0 :                 if ( maAdjustHandleList[ i ].min1.has() )
     302 [ #  # ][ #  # ]:          0 :                     aHandle[ PROP_RadiusRangeMinimum ] <<= maAdjustHandleList[ i ].min1.get();
     303         [ #  # ]:          0 :                 if ( maAdjustHandleList[ i ].max1.has() )
     304 [ #  # ][ #  # ]:          0 :                     aHandle[ PROP_RadiusRangeMaximum ] <<= maAdjustHandleList[ i ].max1.get();
     305                 :            : 
     306                 :            :                 /* TODO: AngleMin & AngleMax
     307                 :            :                 if ( maAdjustHandleList[ i ].min2.has() )
     308                 :            :                     aHandle[ PROP_ ] = maAdjustHandleList[ i ].min2.get();
     309                 :            :                 if ( maAdjustHandleList[ i ].max2.has() )
     310                 :            :                     aHandle[ PROP_ ] = maAdjustHandleList[ i ].max2.get();
     311                 :            :                 */
     312                 :            :             }
     313                 :            :             else
     314                 :            :             {
     315 [ #  # ][ #  # ]:          0 :                 aHandle[ PROP_Position ] <<= maAdjustHandleList[ i ].pos;
     316         [ #  # ]:          0 :                 if ( maAdjustHandleList[ i ].gdRef1.has() )
     317                 :            :                 {
     318                 :            :                     // TODO: PROP_RefX and PROP_RefY are not yet part of our file format,
     319                 :            :                     // so the handles will not work after save/reload
     320         [ #  # ]:          0 :                     sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef1.get() );
     321         [ #  # ]:          0 :                     if ( nIndex >= 0 )
     322 [ #  # ][ #  # ]:          0 :                         aHandle[ PROP_RefX ] <<= nIndex;
     323                 :            :                 }
     324         [ #  # ]:          0 :                 if ( maAdjustHandleList[ i ].gdRef2.has() )
     325                 :            :                 {
     326         [ #  # ]:          0 :                     sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef2.get() );
     327         [ #  # ]:          0 :                     if ( nIndex >= 0 )
     328 [ #  # ][ #  # ]:          0 :                         aHandle[ PROP_RefY ] <<= nIndex;
     329                 :            :                 }
     330         [ #  # ]:          0 :                 if ( maAdjustHandleList[ i ].min1.has() )
     331 [ #  # ][ #  # ]:          0 :                     aHandle[ PROP_RangeXMinimum ] <<= maAdjustHandleList[ i ].min1.get();
     332         [ #  # ]:          0 :                 if ( maAdjustHandleList[ i ].max1.has() )
     333 [ #  # ][ #  # ]:          0 :                     aHandle[ PROP_RangeXMaximum ] <<= maAdjustHandleList[ i ].max1.get();
     334         [ #  # ]:          0 :                 if ( maAdjustHandleList[ i ].min2.has() )
     335 [ #  # ][ #  # ]:          0 :                     aHandle[ PROP_RangeYMinimum ] <<= maAdjustHandleList[ i ].min2.get();
     336         [ #  # ]:          0 :                 if ( maAdjustHandleList[ i ].max2.has() )
     337 [ #  # ][ #  # ]:          0 :                     aHandle[ PROP_RangeYMaximum ] <<= maAdjustHandleList[ i ].max2.get();
     338                 :            :             }
     339 [ #  # ][ #  # ]:          0 :             aHandles[ i ] = aHandle.makePropertyValueSequence();
         [ #  # ][ #  # ]
     340                 :          0 :         }
     341 [ #  # ][ #  # ]:          0 :         aPropertyMap[ PROP_Handles ] <<= aHandles;
     342                 :            : 
     343                 :            : #ifdef DEBUG
     344                 :            :         OSL_TRACE("==cscode== begin");
     345                 :            :         aPropertyMap.dumpCode();
     346                 :            :         OSL_TRACE("==cscode== end");
     347                 :            : #endif
     348                 :            :         // converting the vector to a sequence
     349         [ #  # ]:          0 :         Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence();
     350         [ #  # ]:          0 :         PropertySet aPropSet( xPropSet );
     351 [ #  # ][ #  # ]:          0 :         aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     352                 :            :     }
     353                 :         30 : }
     354                 :            : 
     355                 :         18 : Any CustomShapeProvider::createStringSequence( size_t nStrings, const char **pStrings )
     356                 :            : {
     357         [ +  - ]:         18 :     Sequence< OUString > aStringSequence( nStrings );
     358         [ +  + ]:        267 :     for (size_t i = 0; i < nStrings; i++)
     359         [ +  - ]:        249 :         aStringSequence[i] = ::rtl::OUString::intern(
     360                 :        498 :                                 pStrings[i], strlen( pStrings[i] ),
     361         [ +  - ]:        498 :                                 RTL_TEXTENCODING_ASCII_US );
     362 [ +  - ][ +  - ]:         18 :     return makeAny( aStringSequence );
     363                 :            : }
     364                 :            : 
     365                 :            : com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment >
     366                 :         18 : CustomShapeProvider::createSegmentSequence( size_t nElems, const sal_uInt16 *pValues )
     367                 :            : {
     368                 :         18 :     Sequence< EnhancedCustomShapeSegment > aSequence( (nElems + 1) / 2 );
     369         [ +  + ]:        144 :     for (size_t i = 0, j = 0; i < nElems / 2; i++)
     370                 :            :     {
     371         [ +  - ]:        126 :         aSequence[i].Command = pValues[j++];
     372         [ +  - ]:        126 :         aSequence[i].Count = pValues[j++];
     373                 :            :     }
     374                 :         18 :     return aSequence;
     375                 :            : }
     376                 :            : 
     377                 :            : com::sun::star::drawing::EnhancedCustomShapeParameterPair
     378                 :        204 : CustomShapeProvider::createParameterPair( const ParameterPairData *pData )
     379                 :            : {
     380                 :        204 :     EnhancedCustomShapeParameterPair aParameterPair;
     381                 :        204 :     aParameterPair.First.Type = pData->nFirstType;
     382         [ +  - ]:        204 :     aParameterPair.First.Value = makeAny(pData->nFirstValue);
     383                 :        204 :     aParameterPair.Second.Type = pData->nSecondType;
     384         [ +  - ]:        204 :     aParameterPair.Second.Value = makeAny(pData->nSecondValue);
     385                 :        204 :     return aParameterPair;
     386                 :            : }
     387                 :            : 
     388                 :            : com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >
     389                 :         18 : CustomShapeProvider::createParameterPairSequence( size_t nElems, const ParameterPairData *pData )
     390                 :            : {
     391                 :         18 :     Sequence< EnhancedCustomShapeParameterPair > aSequence( nElems );
     392         [ +  + ]:        171 :     for (size_t i = 0; i < nElems; i++)
     393 [ +  - ][ +  - ]:        153 :         aSequence[i] = createParameterPair( pData + i );
     394                 :         18 :     return aSequence;
     395                 :            : }
     396                 :            : 
     397 [ +  - ][ +  - ]:        285 : } }
     398                 :            : 
     399                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10