LCOV - code coverage report
Current view: top level - svx/source/svdraw - svdoashp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 625 1828 34.2 %
Date: 2012-08-25 Functions: 56 97 57.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 548 3097 17.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <svx/svdoashp.hxx>
      30                 :            : #include "svx/unoapi.hxx"
      31                 :            : #include <svx/unoshape.hxx>
      32                 :            : #include <ucbhelper/content.hxx>
      33                 :            : #include <ucbhelper/contentbroker.hxx>
      34                 :            : #include <unotools/datetime.hxx>
      35                 :            : #include <sfx2/lnkbase.hxx>
      36                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      37                 :            : #include <com/sun/star/drawing/XShape.hpp>
      38                 :            : #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
      39                 :            : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      40                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      41                 :            : #include <com/sun/star/awt/Rectangle.hpp>
      42                 :            : #include <comphelper/processfactory.hxx>
      43                 :            : #include <svl/urihelper.hxx>
      44                 :            : #include <com/sun/star/uno/Sequence.h>
      45                 :            : #include <svx/svdogrp.hxx>
      46                 :            : #include <tools/helpers.hxx>
      47                 :            : #include <svx/svddrag.hxx>
      48                 :            : #include <svx/xpool.hxx>
      49                 :            : #include <svx/xpoly.hxx>
      50                 :            : #include <svx/svdmodel.hxx>
      51                 :            : #include <svx/svdpage.hxx>
      52                 :            : #include "svx/svditer.hxx"
      53                 :            : #include <svx/svdobj.hxx>
      54                 :            : #include <svx/svdtrans.hxx>
      55                 :            : #include <svx/svdetc.hxx>
      56                 :            : #include <svx/svdattrx.hxx>  // NotPersistItems
      57                 :            : #include <svx/svdoedge.hxx>  // for broadcasting connectors to Move
      58                 :            : #include "svx/svdglob.hxx"   // StringCache
      59                 :            : #include "svx/svdstr.hrc"    // the object's name
      60                 :            : #include <editeng/eeitem.hxx>
      61                 :            : #include "editeng/editstat.hxx"
      62                 :            : #include <svx/svdoutl.hxx>
      63                 :            : #include <editeng/outlobj.hxx>
      64                 :            : #include <svx/sdtfchim.hxx>
      65                 :            : #include "../svx/EnhancedCustomShapeGeometry.hxx"
      66                 :            : #include "../svx/EnhancedCustomShapeTypeNames.hxx"
      67                 :            : #include "../svx/EnhancedCustomShape2d.hxx"
      68                 :            : #include <com/sun/star/beans/PropertyValues.hpp>
      69                 :            : #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
      70                 :            : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      71                 :            : #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
      72                 :            : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
      73                 :            : #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
      74                 :            : #include <editeng/writingmodeitem.hxx>
      75                 :            : #include <svx/xlnclit.hxx>
      76                 :            : #include <svx/svxids.hrc>
      77                 :            : #include <svl/whiter.hxx>
      78                 :            : #include <svx/sdr/properties/customshapeproperties.hxx>
      79                 :            : #include <svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx>
      80                 :            : #include <svx/xlntrit.hxx>
      81                 :            : #include <svx/xfltrit.hxx>
      82                 :            : #include <svx/xflclit.hxx>
      83                 :            : #include <svx/xflgrit.hxx>
      84                 :            : #include <svx/xflhtit.hxx>
      85                 :            : #include <svx/xbtmpit.hxx>
      86                 :            : #include <vcl/bmpacc.hxx>
      87                 :            : #include <svx/svdview.hxx>
      88                 :            : #include <basegfx/polygon/b2dpolypolygontools.hxx>
      89                 :            : #include <basegfx/matrix/b2dhommatrix.hxx>
      90                 :            : #include <basegfx/matrix/b2dhommatrixtools.hxx>
      91                 :            : #include <basegfx/tools/unotools.hxx>
      92                 :            : #include "svdconv.hxx"
      93                 :            : 
      94                 :            : using namespace ::com::sun::star;
      95                 :            : using namespace ::com::sun::star::uno;
      96                 :            : using namespace ::com::sun::star::lang;
      97                 :            : using namespace ::com::sun::star::beans;
      98                 :            : using namespace ::com::sun::star::drawing;
      99                 :            : 
     100                 :            : 
     101                 :        396 : static void lcl_ShapeSegmentFromBinary( EnhancedCustomShapeSegment& rSegInfo, sal_uInt16 nSDat )
     102                 :            : {
     103   [ +  -  +  +  :        396 :     switch( nSDat >> 8 )
          +  -  +  -  -  
          +  -  +  +  -  
                   -  - ]
     104                 :            :     {
     105                 :            :         case 0x00 :
     106                 :         99 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::LINETO;
     107                 :         99 :             rSegInfo.Count   = nSDat & 0xff;
     108         [ -  + ]:         99 :             if ( !rSegInfo.Count )
     109                 :          0 :                 rSegInfo.Count = 1;
     110                 :         99 :             break;
     111                 :            :         case 0x20 :
     112                 :          0 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CURVETO;
     113                 :          0 :             rSegInfo.Count   = nSDat & 0xff;
     114         [ #  # ]:          0 :             if ( !rSegInfo.Count )
     115                 :          0 :                 rSegInfo.Count = 1;
     116                 :          0 :             break;
     117                 :            :         case 0x40 :
     118                 :         84 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::MOVETO;
     119                 :         84 :             rSegInfo.Count   = nSDat & 0xff;
     120         [ +  - ]:         84 :             if ( !rSegInfo.Count )
     121                 :         84 :                 rSegInfo.Count = 1;
     122                 :         84 :             break;
     123                 :            :         case 0x60 :
     124                 :         57 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
     125                 :         57 :             rSegInfo.Count   = 0;
     126                 :         57 :             break;
     127                 :            :         case 0x80 :
     128                 :        102 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
     129                 :        102 :             rSegInfo.Count   = 0;
     130                 :        102 :             break;
     131                 :            :         case 0xa1 :
     132                 :          0 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO;
     133                 :          0 :             rSegInfo.Count   = ( nSDat & 0xff ) / 3;
     134                 :          0 :             break;
     135                 :            :         case 0xa2 :
     136                 :          9 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE;
     137                 :          9 :             rSegInfo.Count   = ( nSDat & 0xff ) / 3;
     138                 :          9 :             break;
     139                 :            :         case 0xa3 :
     140                 :          0 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ARCTO;
     141                 :          0 :             rSegInfo.Count   = ( nSDat & 0xff ) >> 2;
     142                 :          0 :             break;
     143                 :            :         case 0xa4 :
     144                 :          0 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ARC;
     145                 :          0 :             rSegInfo.Count   = ( nSDat & 0xff ) >> 2;
     146                 :          0 :             break;
     147                 :            :         case 0xa5 :
     148                 :          9 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO;
     149                 :          9 :             rSegInfo.Count   = ( nSDat & 0xff ) >> 2;
     150                 :          9 :             break;
     151                 :            :         case 0xa6 :
     152                 :          0 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOCKWISEARC;
     153                 :          0 :             rSegInfo.Count   = ( nSDat & 0xff ) >> 2;
     154                 :          0 :             break;
     155                 :            :         case 0xa7 :
     156                 :         12 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX;
     157                 :         12 :             rSegInfo.Count   = nSDat & 0xff;
     158                 :         12 :             break;
     159                 :            :         case 0xa8 :
     160                 :         24 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY;
     161                 :         24 :             rSegInfo.Count   = nSDat & 0xff;
     162                 :         24 :             break;
     163                 :            :         case 0xaa :
     164                 :          0 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::NOFILL;
     165                 :          0 :             rSegInfo.Count   = 0;
     166                 :          0 :             break;
     167                 :            :         case 0xab :
     168                 :          0 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::NOSTROKE;
     169                 :          0 :             rSegInfo.Count   = 0;
     170                 :          0 :             break;
     171                 :            :         default:
     172                 :            :         case 0xf8 :
     173                 :          0 :             rSegInfo.Command = EnhancedCustomShapeSegmentCommand::UNKNOWN;
     174                 :          0 :             rSegInfo.Count   = nSDat;
     175                 :          0 :             break;
     176                 :            :     }
     177                 :        396 :     return;
     178                 :            : }
     179                 :            : 
     180                 :          0 : static MSO_SPT ImpGetCustomShapeType( const SdrObjCustomShape& rCustoShape )
     181                 :            : {
     182                 :          0 :     MSO_SPT eRetValue = mso_sptNil;
     183                 :            : 
     184 [ #  # ][ #  # ]:          0 :     rtl::OUString aEngine( ( (SdrCustomShapeEngineItem&)rCustoShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ) ).GetValue() );
     185 [ #  # ][ #  # ]:          0 :     if ( aEngine.isEmpty() || aEngine == "com.sun.star.drawing.EnhancedCustomShapeEngine" )
                 [ #  # ]
     186                 :            :     {
     187                 :          0 :         rtl::OUString sShapeType;
     188         [ #  # ]:          0 :         const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
     189         [ #  # ]:          0 :         SdrCustomShapeGeometryItem& rGeometryItem( (SdrCustomShapeGeometryItem&)rCustoShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     190         [ #  # ]:          0 :         Any* pAny = rGeometryItem.GetPropertyValueByName( sType );
     191 [ #  # ][ #  # ]:          0 :         if ( pAny && ( *pAny >>= sShapeType ) )
                 [ #  # ]
     192         [ #  # ]:          0 :             eRetValue = EnhancedCustomShapeTypeNames::Get( sShapeType );
     193                 :            :     }
     194                 :          0 :     return eRetValue;
     195                 :            : };
     196                 :            : 
     197                 :          0 : static sal_Bool ImpVerticalSwitch( const SdrObjCustomShape& rCustoShape )
     198                 :            : {
     199                 :          0 :     sal_Bool bRet = sal_False;
     200                 :          0 :     MSO_SPT eShapeType( ImpGetCustomShapeType( rCustoShape ) );
     201         [ #  # ]:          0 :     switch( eShapeType )
     202                 :            :     {
     203                 :            :         case mso_sptAccentBorderCallout90 :     // 2 ortho
     204                 :            :         case mso_sptBorderCallout1 :            // 2 diag
     205                 :            :         case mso_sptBorderCallout2 :            // 3
     206                 :            :         {
     207                 :          0 :             bRet = sal_True;
     208                 :            :         }
     209                 :          0 :         break;
     210                 :          0 :         default: break;
     211                 :            :     }
     212                 :          0 :     return bRet;
     213                 :            : }
     214                 :            : 
     215                 :            : // #i37011# create a clone with all attributes changed to shadow attributes
     216                 :            : // and translation executed, too.
     217                 :          0 : SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemSet& rOriginalSet)
     218                 :            : {
     219                 :          0 :     SdrObject* pRetval = 0L;
     220                 :          0 :     const sal_Bool bShadow(((SdrShadowItem&)rOriginalSet.Get(SDRATTR_SHADOW)).GetValue());
     221                 :            : 
     222         [ #  # ]:          0 :     if(bShadow)
     223                 :            :     {
     224                 :            :         // create a shadow representing object
     225         [ #  # ]:          0 :         const sal_Int32 nXDist(((SdrShadowXDistItem&)(rOriginalSet.Get(SDRATTR_SHADOWXDIST))).GetValue());
     226         [ #  # ]:          0 :         const sal_Int32 nYDist(((SdrShadowYDistItem&)(rOriginalSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
     227 [ #  # ][ #  # ]:          0 :         const ::Color aShadowColor(((SdrShadowColorItem&)(rOriginalSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
     228         [ #  # ]:          0 :         const sal_uInt16 nShadowTransparence(((SdrShadowTransparenceItem&)(rOriginalSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue());
     229         [ #  # ]:          0 :         pRetval = rOriginal.Clone();
     230                 :            :         DBG_ASSERT(pRetval, "ImpCreateShadowObjectClone: Could not clone object (!)");
     231                 :            : 
     232                 :            :         // look for used stuff
     233         [ #  # ]:          0 :         SdrObjListIter aIterator(rOriginal);
     234                 :          0 :         sal_Bool bLineUsed(sal_False);
     235                 :          0 :         sal_Bool bAllFillUsed(sal_False);
     236                 :          0 :         sal_Bool bSolidFillUsed(sal_False);
     237                 :          0 :         sal_Bool bGradientFillUsed(sal_False);
     238                 :          0 :         sal_Bool bHatchFillUsed(sal_False);
     239                 :          0 :         sal_Bool bBitmapFillUsed(sal_False);
     240                 :            : 
     241         [ #  # ]:          0 :         while(aIterator.IsMore())
     242                 :            :         {
     243         [ #  # ]:          0 :             SdrObject* pObj = aIterator.Next();
     244         [ #  # ]:          0 :             XFillStyle eFillStyle = ((XFillStyleItem&)(pObj->GetMergedItem(XATTR_FILLSTYLE))).GetValue();
     245                 :            : 
     246         [ #  # ]:          0 :             if(!bLineUsed)
     247                 :            :             {
     248         [ #  # ]:          0 :                 XLineStyle eLineStyle = ((XLineStyleItem&)(pObj->GetMergedItem(XATTR_LINESTYLE))).GetValue();
     249                 :            : 
     250         [ #  # ]:          0 :                 if(XLINE_NONE != eLineStyle)
     251                 :            :                 {
     252                 :          0 :                     bLineUsed = sal_True;
     253                 :            :                 }
     254                 :            :             }
     255                 :            : 
     256         [ #  # ]:          0 :             if(!bAllFillUsed)
     257                 :            :             {
     258 [ #  # ][ #  # ]:          0 :                 if(!bSolidFillUsed && XFILL_SOLID == eFillStyle)
     259                 :            :                 {
     260                 :          0 :                     bSolidFillUsed = sal_True;
     261 [ #  # ][ #  # ]:          0 :                     bAllFillUsed = (bSolidFillUsed || bGradientFillUsed || bHatchFillUsed || bBitmapFillUsed);
         [ #  # ][ #  # ]
     262                 :            :                 }
     263 [ #  # ][ #  # ]:          0 :                 if(!bGradientFillUsed && XFILL_GRADIENT == eFillStyle)
     264                 :            :                 {
     265                 :          0 :                     bGradientFillUsed = sal_True;
     266 [ #  # ][ #  # ]:          0 :                     bAllFillUsed = (bSolidFillUsed || bGradientFillUsed || bHatchFillUsed || bBitmapFillUsed);
         [ #  # ][ #  # ]
     267                 :            :                 }
     268 [ #  # ][ #  # ]:          0 :                 if(!bHatchFillUsed && XFILL_HATCH == eFillStyle)
     269                 :            :                 {
     270                 :          0 :                     bHatchFillUsed = sal_True;
     271 [ #  # ][ #  # ]:          0 :                     bAllFillUsed = (bSolidFillUsed || bGradientFillUsed || bHatchFillUsed || bBitmapFillUsed);
         [ #  # ][ #  # ]
     272                 :            :                 }
     273 [ #  # ][ #  # ]:          0 :                 if(!bBitmapFillUsed && XFILL_BITMAP == eFillStyle)
     274                 :            :                 {
     275                 :          0 :                     bBitmapFillUsed = sal_True;
     276 [ #  # ][ #  # ]:          0 :                     bAllFillUsed = (bSolidFillUsed || bGradientFillUsed || bHatchFillUsed || bBitmapFillUsed);
         [ #  # ][ #  # ]
     277                 :            :                 }
     278                 :            :             }
     279                 :            :         }
     280                 :            : 
     281                 :            :         // translate to shadow coordinates
     282         [ #  # ]:          0 :         pRetval->NbcMove(Size(nXDist, nYDist));
     283                 :            : 
     284                 :            :         // set items as needed
     285         [ #  # ]:          0 :         SfxItemSet aTempSet(rOriginalSet);
     286                 :            : 
     287                 :            :         // if a SvxWritingModeItem (Top->Bottom) is set the text object
     288                 :            :         // is creating a paraobject, but paraobjects can not be created without model. So
     289                 :            :         // we are preventing the crash by setting the writing mode always left to right,
     290                 :            :         // this is not bad since our shadow geometry does not contain text.
     291 [ #  # ][ #  # ]:          0 :         aTempSet.Put( SvxWritingModeItem( com::sun::star::text::WritingMode_LR_TB, SDRATTR_TEXTDIRECTION ) );
                 [ #  # ]
     292                 :            : 
     293                 :            :         // no shadow
     294 [ #  # ][ #  # ]:          0 :         aTempSet.Put(SdrShadowItem(sal_False));
                 [ #  # ]
     295 [ #  # ][ #  # ]:          0 :         aTempSet.Put(SdrShadowXDistItem(0L));
                 [ #  # ]
     296 [ #  # ][ #  # ]:          0 :         aTempSet.Put(SdrShadowYDistItem(0L));
                 [ #  # ]
     297                 :            : 
     298                 :            :         // line color and transparency like shadow
     299         [ #  # ]:          0 :         if(bLineUsed)
     300                 :            :         {
     301 [ #  # ][ #  # ]:          0 :             aTempSet.Put(XLineColorItem(String(), aShadowColor));
         [ #  # ][ #  # ]
                 [ #  # ]
     302 [ #  # ][ #  # ]:          0 :             aTempSet.Put(XLineTransparenceItem(nShadowTransparence));
                 [ #  # ]
     303                 :            :         }
     304                 :            : 
     305                 :            :         // fill color and transparency like shadow
     306         [ #  # ]:          0 :         if(bSolidFillUsed)
     307                 :            :         {
     308 [ #  # ][ #  # ]:          0 :             aTempSet.Put(XFillColorItem(String(), aShadowColor));
         [ #  # ][ #  # ]
                 [ #  # ]
     309 [ #  # ][ #  # ]:          0 :             aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
                 [ #  # ]
     310                 :            :         }
     311                 :            : 
     312                 :            :         // gradient and transparency like shadow
     313         [ #  # ]:          0 :         if(bGradientFillUsed)
     314                 :            :         {
     315 [ #  # ][ #  # ]:          0 :             XGradient aGradient(((XFillGradientItem&)(rOriginalSet.Get(XATTR_FILLGRADIENT))).GetGradientValue());
     316         [ #  # ]:          0 :             sal_uInt8 nStartLuminance(aGradient.GetStartColor().GetLuminance());
     317         [ #  # ]:          0 :             sal_uInt8 nEndLuminance(aGradient.GetEndColor().GetLuminance());
     318                 :            : 
     319         [ #  # ]:          0 :             if(aGradient.GetStartIntens() != 100)
     320                 :            :             {
     321                 :          0 :                 nStartLuminance = (sal_uInt8)(nStartLuminance * ((double)aGradient.GetStartIntens() / 100.0));
     322                 :            :             }
     323                 :            : 
     324         [ #  # ]:          0 :             if(aGradient.GetEndIntens() != 100)
     325                 :            :             {
     326                 :          0 :                 nEndLuminance = (sal_uInt8)(nEndLuminance * ((double)aGradient.GetEndIntens() / 100.0));
     327                 :            :             }
     328                 :            : 
     329                 :            :             ::Color aStartColor(
     330                 :          0 :                 (sal_uInt8)((nStartLuminance * aShadowColor.GetRed()) / 256),
     331                 :          0 :                 (sal_uInt8)((nStartLuminance * aShadowColor.GetGreen()) / 256),
     332                 :          0 :                 (sal_uInt8)((nStartLuminance * aShadowColor.GetBlue()) / 256));
     333                 :            : 
     334                 :            :             ::Color aEndColor(
     335                 :          0 :                 (sal_uInt8)((nEndLuminance * aShadowColor.GetRed()) / 256),
     336                 :          0 :                 (sal_uInt8)((nEndLuminance * aShadowColor.GetGreen()) / 256),
     337                 :          0 :                 (sal_uInt8)((nEndLuminance * aShadowColor.GetBlue()) / 256));
     338                 :            : 
     339                 :          0 :             aGradient.SetStartColor(aStartColor);
     340                 :          0 :             aGradient.SetEndColor(aEndColor);
     341 [ #  # ][ #  # ]:          0 :             aTempSet.Put(XFillGradientItem(aGradient));
                 [ #  # ]
     342 [ #  # ][ #  # ]:          0 :             aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
                 [ #  # ]
     343                 :            :         }
     344                 :            : 
     345                 :            :         // hatch and transparency like shadow
     346         [ #  # ]:          0 :         if(bHatchFillUsed)
     347                 :            :         {
     348 [ #  # ][ #  # ]:          0 :             XHatch aHatch(((XFillHatchItem&)(rOriginalSet.Get(XATTR_FILLHATCH))).GetHatchValue());
     349                 :          0 :             aHatch.SetColor(aShadowColor);
     350 [ #  # ][ #  # ]:          0 :             aTempSet.Put(XFillHatchItem(aTempSet.GetPool(), aHatch));
                 [ #  # ]
     351 [ #  # ][ #  # ]:          0 :             aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
                 [ #  # ]
     352                 :            :         }
     353                 :            : 
     354                 :            :         // bitmap and transparency like shadow
     355         [ #  # ]:          0 :         if(bBitmapFillUsed)
     356                 :            :         {
     357 [ #  # ][ #  # ]:          0 :             XOBitmap aFillBitmap(((XFillBitmapItem&)(rOriginalSet.Get(XATTR_FILLBITMAP))).GetBitmapValue());
                 [ #  # ]
     358         [ #  # ]:          0 :             Bitmap aSourceBitmap(aFillBitmap.GetBitmap());
     359         [ #  # ]:          0 :             BitmapReadAccess* pReadAccess = aSourceBitmap.AcquireReadAccess();
     360                 :            : 
     361         [ #  # ]:          0 :             if(!aSourceBitmap.IsEmpty())
     362                 :            :             {
     363         [ #  # ]:          0 :                 if(pReadAccess)
     364                 :            :                 {
     365 [ #  # ][ #  # ]:          0 :                     Bitmap aDestBitmap(aSourceBitmap.GetSizePixel(), 24L);
     366         [ #  # ]:          0 :                     BitmapWriteAccess* pWriteAccess = aDestBitmap.AcquireWriteAccess();
     367                 :            : 
     368         [ #  # ]:          0 :                     if(pWriteAccess)
     369                 :            :                     {
     370         [ #  # ]:          0 :                         for(sal_Int32 y(0L); y < pReadAccess->Height(); y++)
     371                 :            :                         {
     372         [ #  # ]:          0 :                             for(sal_Int32 x(0L); x < pReadAccess->Width(); x++)
     373                 :            :                             {
     374         [ #  # ]:          0 :                                 sal_uInt16 nLuminance((sal_uInt16)pReadAccess->GetLuminance(y, x) + 1);
     375                 :            :                                 const BitmapColor aDestColor(
     376                 :          0 :                                     (sal_uInt8)((nLuminance * (sal_uInt16)aShadowColor.GetRed()) >> 8L),
     377                 :          0 :                                     (sal_uInt8)((nLuminance * (sal_uInt16)aShadowColor.GetGreen()) >> 8L),
     378                 :          0 :                                     (sal_uInt8)((nLuminance * (sal_uInt16)aShadowColor.GetBlue()) >> 8L));
     379         [ #  # ]:          0 :                                 pWriteAccess->SetPixel(y, x, aDestColor);
     380                 :          0 :                             }
     381                 :            :                         }
     382                 :            : 
     383         [ #  # ]:          0 :                         aDestBitmap.ReleaseAccess(pWriteAccess);
     384         [ #  # ]:          0 :                         aFillBitmap.SetBitmap(aDestBitmap);
     385                 :            :                     }
     386                 :            : 
     387 [ #  # ][ #  # ]:          0 :                     aSourceBitmap.ReleaseAccess(pReadAccess);
     388                 :            :                 }
     389                 :            :             }
     390                 :            : 
     391 [ #  # ][ #  # ]:          0 :             aTempSet.Put(XFillBitmapItem(aTempSet.GetPool(), aFillBitmap));
                 [ #  # ]
     392 [ #  # ][ #  # ]:          0 :             aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
         [ #  # ][ #  # ]
                 [ #  # ]
     393                 :            :         }
     394                 :            : 
     395                 :            :         // set attributes and paint shadow object
     396 [ #  # ][ #  # ]:          0 :         pRetval->SetMergedItemSet( aTempSet );
     397                 :            :     }
     398                 :          0 :     return pRetval;
     399                 :            : }
     400                 :            : 
     401                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     402                 :            : 
     403                 :       4485 : Reference< XCustomShapeEngine > SdrObjCustomShape::GetCustomShapeEngine( const SdrObjCustomShape* pCustomShape )
     404                 :            : {
     405                 :       4485 :     Reference< XCustomShapeEngine > xCustomShapeEngine;
     406 [ +  - ][ +  - ]:       4485 :     String aEngine(((SdrCustomShapeEngineItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE )).GetValue());
     407         [ +  - ]:       4485 :     if ( !aEngine.Len() )
     408 [ +  - ][ +  - ]:       4485 :         aEngine = String( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) );
                 [ +  - ]
     409                 :            : 
     410         [ +  - ]:       4485 :     Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
     411                 :            : 
     412                 :       4485 :     Reference< XShape > aXShape = GetXShapeForSdrObject( (SdrObjCustomShape*)pCustomShape );
     413         [ +  - ]:       4485 :     if ( aXShape.is() )
     414                 :            :     {
     415 [ +  - ][ +  - ]:       4485 :         if ( aEngine.Len() && xFactory.is() )
                 [ +  - ]
     416                 :            :         {
     417         [ +  - ]:       4485 :             Sequence< Any > aArgument( 1 );
     418         [ +  - ]:       4485 :             Sequence< PropertyValue > aPropValues( 1 );
     419         [ +  - ]:       4485 :             aPropValues[ 0 ].Name = rtl::OUString("CustomShape");
     420 [ +  - ][ +  - ]:       4485 :             aPropValues[ 0 ].Value <<= aXShape;
     421 [ +  - ][ +  - ]:       4485 :             aArgument[ 0 ] <<= aPropValues;
     422 [ +  - ][ +  - ]:       4485 :             Reference< XInterface > xInterface( xFactory->createInstanceWithArguments( aEngine, aArgument ) );
                 [ +  - ]
     423         [ -  + ]:       4485 :             if ( xInterface.is() )
     424 [ #  # ][ #  # ]:       4485 :                 xCustomShapeEngine = Reference< XCustomShapeEngine >( xInterface, UNO_QUERY );
         [ +  - ][ +  - ]
     425                 :            :         }
     426                 :            :     }
     427         [ +  - ]:       4485 :     return xCustomShapeEngine;
     428                 :            : }
     429                 :        372 : const SdrObject* SdrObjCustomShape::GetSdrObjectFromCustomShape() const
     430                 :            : {
     431         [ +  - ]:        372 :     if ( !mXRenderedCustomShape.is() )
     432                 :            :     {
     433         [ +  - ]:        372 :         Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( this ) );
     434         [ -  + ]:        372 :         if ( xCustomShapeEngine.is() )
     435 [ #  # ][ #  # ]:        372 :             ((SdrObjCustomShape*)this)->mXRenderedCustomShape = xCustomShapeEngine->render();
                 [ #  # ]
     436                 :            :     }
     437                 :        372 :     SdrObject* pRenderedCustomShape = mXRenderedCustomShape.is()
     438         [ -  + ]:        372 :                 ? GetSdrObjectFromXShape( mXRenderedCustomShape )
     439         [ -  + ]:        372 :                 : NULL;
     440                 :        372 :     return pRenderedCustomShape;
     441                 :            : }
     442                 :            : 
     443                 :            : // #i37011# Shadow geometry creation
     444                 :          0 : const SdrObject* SdrObjCustomShape::GetSdrObjectShadowFromCustomShape() const
     445                 :            : {
     446         [ #  # ]:          0 :     if(!mpLastShadowGeometry)
     447                 :            :     {
     448                 :          0 :         const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
     449         [ #  # ]:          0 :         if(pSdrObject)
     450                 :            :         {
     451                 :          0 :             const SfxItemSet& rOriginalSet = GetObjectItemSet();
     452                 :          0 :             const sal_Bool bShadow(((SdrShadowItem&)rOriginalSet.Get( SDRATTR_SHADOW )).GetValue());
     453                 :            : 
     454         [ #  # ]:          0 :             if(bShadow)
     455                 :            :             {
     456                 :            :                 // create a clone with all attributes changed to shadow attributes
     457                 :            :                 // and translation executed, too.
     458                 :          0 :                 ((SdrObjCustomShape*)this)->mpLastShadowGeometry = ImpCreateShadowObjectClone(*pSdrObject, rOriginalSet);
     459                 :            :             }
     460                 :            :         }
     461                 :            :     }
     462                 :            : 
     463                 :          0 :     return mpLastShadowGeometry;
     464                 :            : }
     465                 :            : 
     466                 :        309 : sal_Bool SdrObjCustomShape::IsTextPath() const
     467                 :            : {
     468         [ +  - ]:        309 :     const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
     469                 :        309 :     sal_Bool bTextPathOn = sal_False;
     470         [ +  - ]:        309 :     SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
     471         [ +  - ]:        309 :     Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
     472         [ -  + ]:        309 :     if ( pAny )
     473                 :          0 :         *pAny >>= bTextPathOn;
     474                 :        309 :     return bTextPathOn;
     475                 :            : }
     476                 :            : 
     477                 :          0 : sal_Bool SdrObjCustomShape::UseNoFillStyle() const
     478                 :            : {
     479                 :          0 :     sal_Bool bRet = sal_False;
     480                 :          0 :     rtl::OUString sShapeType;
     481         [ #  # ]:          0 :     const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
     482         [ #  # ]:          0 :     SdrCustomShapeGeometryItem& rGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     483         [ #  # ]:          0 :     Any* pAny = rGeometryItem.GetPropertyValueByName( sType );
     484         [ #  # ]:          0 :     if ( pAny )
     485                 :          0 :         *pAny >>= sShapeType;
     486 [ #  # ][ #  # ]:          0 :     bRet = IsCustomShapeFilledByDefault( EnhancedCustomShapeTypeNames::Get( sType ) ) == 0;
     487                 :            : 
     488                 :          0 :     return bRet;
     489                 :            : }
     490                 :            : 
     491                 :       1308 : sal_Bool SdrObjCustomShape::IsMirroredX() const
     492                 :            : {
     493                 :       1308 :     sal_Bool bMirroredX = sal_False;
     494 [ +  - ][ +  - ]:       1308 :     SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     495         [ +  - ]:       1308 :     const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
     496         [ +  - ]:       1308 :     com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredX );
     497         [ +  + ]:       1308 :     if ( pAny )
     498                 :        102 :         *pAny >>= bMirroredX;
     499         [ +  - ]:       1308 :     return bMirroredX;
     500                 :            : }
     501                 :       1308 : sal_Bool SdrObjCustomShape::IsMirroredY() const
     502                 :            : {
     503                 :       1308 :     sal_Bool bMirroredY = sal_False;
     504 [ +  - ][ +  - ]:       1308 :     SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     505         [ +  - ]:       1308 :     const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
     506         [ +  - ]:       1308 :     com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredY );
     507         [ +  + ]:       1308 :     if ( pAny )
     508                 :         90 :         *pAny >>= bMirroredY;
     509         [ +  - ]:       1308 :     return bMirroredY;
     510                 :            : }
     511                 :          9 : void SdrObjCustomShape::SetMirroredX( const sal_Bool bMirrorX )
     512                 :            : {
     513 [ +  - ][ +  - ]:          9 :     SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     514         [ +  - ]:          9 :     const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
     515                 :          9 :     PropertyValue aPropVal;
     516                 :          9 :     aPropVal.Name = sMirroredX;
     517         [ +  - ]:          9 :     aPropVal.Value <<= bMirrorX;
     518         [ +  - ]:          9 :     aGeometryItem.SetPropertyValue( aPropVal );
     519 [ +  - ][ +  - ]:          9 :     SetMergedItem( aGeometryItem );
     520                 :          9 : }
     521                 :          0 : void SdrObjCustomShape::SetMirroredY( const sal_Bool bMirrorY )
     522                 :            : {
     523 [ #  # ][ #  # ]:          0 :     SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     524         [ #  # ]:          0 :     const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
     525                 :          0 :     PropertyValue aPropVal;
     526                 :          0 :     aPropVal.Name = sMirroredY;
     527         [ #  # ]:          0 :     aPropVal.Value <<= bMirrorY;
     528         [ #  # ]:          0 :     aGeometryItem.SetPropertyValue( aPropVal );
     529 [ #  # ][ #  # ]:          0 :     SetMergedItem( aGeometryItem );
     530                 :          0 : }
     531                 :            : 
     532                 :        402 : double SdrObjCustomShape::GetObjectRotation() const
     533                 :            : {
     534                 :        402 :     return fObjectRotation;
     535                 :            : }
     536                 :            : 
     537                 :          0 : bool SdrObjCustomShape::IsPostRotate() const
     538                 :            : {
     539                 :            :     const com::sun::star::uno::Any* pAny;
     540                 :          0 :     bool bPostRotate = false;
     541         [ #  # ]:          0 :     SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
     542         [ #  # ]:          0 :     pAny = rGeometryItem.GetPropertyValueByName( "IsPostRotateAngle" );
     543         [ #  # ]:          0 :     if ( pAny )
     544                 :          0 :         *pAny >>= bPostRotate;
     545                 :          0 :     return bPostRotate;
     546                 :            : }
     547                 :            : 
     548                 :         36 : double SdrObjCustomShape::GetExtraTextRotation( const bool bPreRotation ) const
     549                 :            : {
     550                 :            :     const com::sun::star::uno::Any* pAny;
     551         [ +  - ]:         36 :     SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
     552         [ +  - ]:         36 :     const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) );
     553         [ +  - ]:         36 :     const rtl::OUString sTextPreRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextPreRotateAngle" ) );
     554 [ +  + ][ +  - ]:         36 :     pAny = rGeometryItem.GetPropertyValueByName( bPreRotation ? sTextPreRotateAngle : sTextRotateAngle );
     555                 :         36 :     double fExtraTextRotateAngle = 0.0;
     556         [ +  + ]:         36 :     if ( pAny )
     557                 :         18 :         *pAny >>= fExtraTextRotateAngle;
     558                 :         36 :     return fExtraTextRotateAngle;
     559                 :            : }
     560                 :       4101 : sal_Bool SdrObjCustomShape::GetTextBounds( Rectangle& rTextBound ) const
     561                 :            : {
     562                 :       4101 :     sal_Bool bRet = sal_False;
     563         [ +  - ]:       4101 :     Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( this ) ); // a candidate for being cached
     564         [ -  + ]:       4101 :     if ( xCustomShapeEngine.is() )
     565                 :            :     {
     566 [ #  # ][ #  # ]:          0 :         awt::Rectangle aR( xCustomShapeEngine->getTextBounds() );
     567 [ #  # ][ #  # ]:          0 :         if ( aR.Width > 1 && aR.Height > 1 )
     568                 :            :         {
     569         [ #  # ]:          0 :             rTextBound = Rectangle( Point( aR.X, aR.Y ), Size( aR.Width, aR.Height ) );
     570                 :          0 :             bRet = sal_True;
     571                 :            :         }
     572                 :            :     }
     573                 :       4101 :     return bRet;
     574                 :            : }
     575                 :          0 : basegfx::B2DPolyPolygon SdrObjCustomShape::GetLineGeometry( const SdrObjCustomShape* pCustomShape, const sal_Bool bBezierAllowed )
     576                 :            : {
     577         [ #  # ]:          0 :     basegfx::B2DPolyPolygon aRetval;
     578         [ #  # ]:          0 :     Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( pCustomShape ) );
     579         [ #  # ]:          0 :     if ( xCustomShapeEngine.is() )
     580                 :            :     {
     581 [ #  # ][ #  # ]:          0 :         com::sun::star::drawing::PolyPolygonBezierCoords aBezierCoords = xCustomShapeEngine->getLineGeometry();
     582                 :            :         try
     583                 :            :         {
     584 [ #  # ][ #  # ]:          0 :             aRetval = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( aBezierCoords );
                 [ #  # ]
     585 [ #  # ][ #  # ]:          0 :             if ( !bBezierAllowed && aRetval.areControlPointsUsed())
         [ #  # ][ #  # ]
     586                 :            :             {
     587 [ #  # ][ #  # ]:          0 :                 aRetval = basegfx::tools::adaptiveSubdivideByAngle(aRetval);
         [ #  # ][ #  # ]
     588                 :            :             }
     589                 :            :         }
     590         [ #  # ]:          0 :         catch ( const com::sun::star::lang::IllegalArgumentException & )
     591                 :            :         {
     592         [ #  # ]:          0 :         }
     593                 :            :     }
     594                 :          0 :     return aRetval;
     595                 :            : }
     596                 :            : 
     597                 :         12 : std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandles( const SdrObjCustomShape* pCustomShape ) const
     598                 :            : {
     599                 :         12 :     std::vector< SdrCustomShapeInteraction > xRet;
     600                 :            :     try
     601                 :            :     {
     602         [ +  - ]:         12 :         Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( pCustomShape ) );
     603         [ -  + ]:         12 :         if ( xCustomShapeEngine.is() )
     604                 :            :         {
     605                 :            :             int i;
     606 [ #  # ][ #  # ]:          0 :             Sequence< Reference< XCustomShapeHandle > > xInteractionHandles( xCustomShapeEngine->getInteraction() );
     607         [ #  # ]:          0 :             for ( i = 0; i < xInteractionHandles.getLength(); i++ )
     608                 :            :             {
     609 [ #  # ][ #  # ]:          0 :                 if ( xInteractionHandles[ i ].is() )
     610                 :            :                 {
     611         [ #  # ]:          0 :                     SdrCustomShapeInteraction aSdrCustomShapeInteraction;
     612 [ #  # ][ #  # ]:          0 :                     aSdrCustomShapeInteraction.xInteraction = xInteractionHandles[ i ];
     613 [ #  # ][ #  # ]:          0 :                     aSdrCustomShapeInteraction.aPosition = xInteractionHandles[ i ]->getPosition();
                 [ #  # ]
     614                 :            : 
     615                 :          0 :                     sal_Int32 nMode = 0;
     616 [ #  # ][ #  #  :          0 :                     switch( ImpGetCustomShapeType( *this ) )
             #  #  #  # ]
     617                 :            :                     {
     618                 :            :                         case mso_sptAccentBorderCallout90 :     // 2 ortho
     619                 :            :                         {
     620         [ #  # ]:          0 :                             if ( !i )
     621                 :          0 :                                 nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED;
     622         [ #  # ]:          0 :                             else if ( i == 1)
     623                 :          0 :                                 nMode |= CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X | CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y | CUSTOMSHAPE_HANDLE_MOVE_SHAPE | CUSTOMSHAPE_HANDLE_ORTHO4;
     624                 :            :                         }
     625                 :          0 :                         break;
     626                 :            : 
     627                 :            :                         case mso_sptWedgeRectCallout :
     628                 :            :                         case mso_sptWedgeRRectCallout :
     629                 :            :                         case mso_sptCloudCallout :
     630                 :            :                         case mso_sptWedgeEllipseCallout :
     631                 :            :                         {
     632         [ #  # ]:          0 :                             if ( !i )
     633                 :          0 :                                 nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED;
     634                 :            :                         }
     635                 :          0 :                         break;
     636                 :            : 
     637                 :            :                         case mso_sptBorderCallout1 :            // 2 diag
     638                 :            :                         {
     639         [ #  # ]:          0 :                             if ( !i )
     640                 :          0 :                                 nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED;
     641         [ #  # ]:          0 :                             else if ( i == 1 )
     642                 :          0 :                                 nMode |= CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X | CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y | CUSTOMSHAPE_HANDLE_MOVE_SHAPE;
     643                 :            :                         }
     644                 :          0 :                         break;
     645                 :            :                         case mso_sptBorderCallout2 :            // 3
     646                 :            :                         {
     647         [ #  # ]:          0 :                             if ( !i )
     648                 :          0 :                                 nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED;
     649         [ #  # ]:          0 :                             else if ( i == 2 )
     650                 :          0 :                                 nMode |= CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X | CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y | CUSTOMSHAPE_HANDLE_MOVE_SHAPE;
     651                 :            :                         }
     652                 :          0 :                         break;
     653                 :            :                         case mso_sptCallout90 :
     654                 :            :                         case mso_sptAccentCallout90 :
     655                 :            :                         case mso_sptBorderCallout90 :
     656                 :            :                         case mso_sptCallout1 :
     657                 :            :                         case mso_sptCallout2 :
     658                 :            :                         case mso_sptCallout3 :
     659                 :            :                         case mso_sptAccentCallout1 :
     660                 :            :                         case mso_sptAccentCallout2 :
     661                 :            :                         case mso_sptAccentCallout3 :
     662                 :            :                         case mso_sptBorderCallout3 :
     663                 :            :                         case mso_sptAccentBorderCallout1 :
     664                 :            :                         case mso_sptAccentBorderCallout2 :
     665                 :            :                         case mso_sptAccentBorderCallout3 :
     666                 :            :                         {
     667         [ #  # ]:          0 :                             if ( !i )
     668                 :          0 :                                 nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED;
     669                 :            :                         }
     670                 :          0 :                         break;
     671                 :          0 :                         default: break;
     672                 :            :                     }
     673                 :          0 :                     aSdrCustomShapeInteraction.nMode = nMode;
     674 [ #  # ][ #  # ]:          0 :                     xRet.push_back( aSdrCustomShapeInteraction );
     675                 :            :                 }
     676         [ #  # ]:          0 :             }
     677         [ #  # ]:         12 :         }
     678                 :            :     }
     679         [ #  # ]:          0 :     catch( const uno::RuntimeException& )
     680                 :            :     {
     681                 :            :     }
     682                 :         12 :     return xRet;
     683                 :            : }
     684                 :            : 
     685                 :            : //////////////////////////////////////////////////////////////////////////////
     686                 :            : // BaseProperties section
     687                 :            : #define DEFAULT_MINIMUM_SIGNED_COMPARE  ((sal_Int32)0x80000000)
     688                 :            : #define DEFAULT_MAXIMUM_SIGNED_COMPARE  ((sal_Int32)0x7fffffff)
     689                 :            : 
     690                 :         27 : static sal_Int32 GetNumberOfProperties ( const SvxMSDffHandle* pData )
     691                 :            : {
     692                 :         27 :     sal_Int32     nPropertiesNeeded=1;  // position is always needed
     693                 :         27 :     sal_Int32     nFlags = pData->nFlags;
     694                 :            : 
     695         [ -  + ]:         27 :     if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_X )
     696                 :          0 :         nPropertiesNeeded++;
     697         [ -  + ]:         27 :     if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_Y )
     698                 :          0 :         nPropertiesNeeded++;
     699         [ -  + ]:         27 :     if ( nFlags & MSDFF_HANDLE_FLAGS_SWITCHED )
     700                 :          0 :         nPropertiesNeeded++;
     701         [ -  + ]:         27 :     if ( nFlags & MSDFF_HANDLE_FLAGS_POLAR )
     702                 :            :     {
     703                 :          0 :         nPropertiesNeeded++;
     704         [ #  # ]:          0 :         if ( nFlags & MSDFF_HANDLE_FLAGS_RADIUS_RANGE )
     705                 :            :         {
     706         [ #  # ]:          0 :             if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
     707                 :          0 :                 nPropertiesNeeded++;
     708         [ #  # ]:          0 :             if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
     709                 :          0 :                 nPropertiesNeeded++;
     710                 :            :         }
     711                 :            :     }
     712         [ +  + ]:         27 :     else if ( nFlags & MSDFF_HANDLE_FLAGS_RANGE )
     713                 :            :     {
     714         [ +  - ]:          6 :         if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
     715                 :          6 :             nPropertiesNeeded++;
     716         [ +  - ]:          6 :         if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
     717                 :          6 :             nPropertiesNeeded++;
     718         [ -  + ]:          6 :         if ( pData->nRangeYMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
     719                 :          0 :             nPropertiesNeeded++;
     720         [ -  + ]:          6 :         if ( pData->nRangeYMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
     721                 :          0 :             nPropertiesNeeded++;
     722                 :            :     }
     723                 :            : 
     724                 :         27 :     return nPropertiesNeeded;
     725                 :            : }
     726                 :            : 
     727                 :         27 : static void lcl_ShapePropertiesFromDFF( const SvxMSDffHandle* pData, com::sun::star::beans::PropertyValues& rPropValues )
     728                 :            : {
     729                 :         27 :     sal_Int32 nFlags = pData->nFlags, n=0;
     730                 :            : 
     731                 :            :     // POSITION
     732                 :            :     {
     733         [ +  - ]:         27 :         const rtl::OUString sPosition( RTL_CONSTASCII_USTRINGPARAM ( "Position" ) );
     734                 :         27 :         ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition;
     735         [ +  - ]:         27 :         EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.First, pData->nPositionX, sal_True, sal_True );
     736         [ +  - ]:         27 :         EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.Second, pData->nPositionY, sal_True, sal_False );
     737         [ +  - ]:         27 :         rPropValues[ n ].Name = sPosition;
     738 [ +  - ][ +  - ]:         27 :         rPropValues[ n++ ].Value <<= aPosition;
     739                 :            :     }
     740         [ -  + ]:         27 :     if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_X )
     741                 :            :     {
     742         [ #  # ]:          0 :         const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
     743                 :          0 :         sal_Bool bMirroredX = sal_True;
     744         [ #  # ]:          0 :         rPropValues[ n ].Name = sMirroredX;
     745 [ #  # ][ #  # ]:          0 :         rPropValues[ n++ ].Value <<= bMirroredX;
     746                 :            :     }
     747         [ -  + ]:         27 :     if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_Y )
     748                 :            :     {
     749         [ #  # ]:          0 :         const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
     750                 :          0 :         sal_Bool bMirroredY = sal_True;
     751         [ #  # ]:          0 :         rPropValues[ n ].Name = sMirroredY;
     752 [ #  # ][ #  # ]:          0 :         rPropValues[ n++ ].Value <<= bMirroredY;
     753                 :            :     }
     754         [ -  + ]:         27 :     if ( nFlags & MSDFF_HANDLE_FLAGS_SWITCHED )
     755                 :            :     {
     756         [ #  # ]:          0 :         const rtl::OUString sSwitched( RTL_CONSTASCII_USTRINGPARAM ( "Switched" ) );
     757                 :          0 :         sal_Bool bSwitched = sal_True;
     758         [ #  # ]:          0 :         rPropValues[ n ].Name = sSwitched;
     759 [ #  # ][ #  # ]:          0 :         rPropValues[ n++ ].Value <<= bSwitched;
     760                 :            :     }
     761         [ -  + ]:         27 :     if ( nFlags & MSDFF_HANDLE_FLAGS_POLAR )
     762                 :            :     {
     763         [ #  # ]:          0 :         const rtl::OUString sPolar( RTL_CONSTASCII_USTRINGPARAM ( "Polar" ) );
     764                 :          0 :         ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aCenter;
     765                 :            :         EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aCenter.First, pData->nCenterX,
     766         [ #  # ]:          0 :                            ( nFlags & MSDFF_HANDLE_FLAGS_CENTER_X_IS_SPECIAL ) != 0, sal_True  );
     767                 :            :         EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aCenter.Second, pData->nCenterY,
     768         [ #  # ]:          0 :                            ( nFlags & MSDFF_HANDLE_FLAGS_CENTER_Y_IS_SPECIAL ) != 0, sal_False );
     769         [ #  # ]:          0 :         rPropValues[ n ].Name = sPolar;
     770 [ #  # ][ #  # ]:          0 :         rPropValues[ n++ ].Value <<= aCenter;
     771         [ #  # ]:          0 :         if ( nFlags & MSDFF_HANDLE_FLAGS_RADIUS_RANGE )
     772                 :            :         {
     773         [ #  # ]:          0 :             if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
     774                 :            :             {
     775         [ #  # ]:          0 :                 const rtl::OUString sRadiusRangeMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RadiusRangeMinimum" ) );
     776                 :          0 :                 ::com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
     777                 :            :                 EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMinimum, pData->nRangeXMin,
     778         [ #  # ]:          0 :                            ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL ) != 0, sal_True  );
     779         [ #  # ]:          0 :                 rPropValues[ n ].Name = sRadiusRangeMinimum;
     780 [ #  # ][ #  # ]:          0 :                 rPropValues[ n++ ].Value <<= aRadiusRangeMinimum;
     781                 :            :             }
     782         [ #  # ]:          0 :             if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
     783                 :            :             {
     784         [ #  # ]:          0 :                 const rtl::OUString sRadiusRangeMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RadiusRangeMaximum" ) );
     785                 :          0 :                 ::com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
     786                 :            :                 EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMaximum, pData->nRangeXMax,
     787         [ #  # ]:          0 :                            ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL ) != 0, sal_False );
     788         [ #  # ]:          0 :                 rPropValues[ n ].Name = sRadiusRangeMaximum;
     789 [ #  # ][ #  # ]:          0 :                 rPropValues[ n++ ].Value <<= aRadiusRangeMaximum;
     790                 :            :             }
     791                 :          0 :         }
     792                 :            :     }
     793         [ +  + ]:         27 :     else if ( nFlags & MSDFF_HANDLE_FLAGS_RANGE )
     794                 :            :     {
     795         [ +  - ]:          6 :         if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
     796                 :            :         {
     797         [ +  - ]:          6 :             const rtl::OUString sRangeXMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RangeXMinimum" ) );
     798                 :          6 :             ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeXMinimum;
     799                 :            :             EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMinimum, pData->nRangeXMin,
     800         [ +  - ]:          6 :                            ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL ) != 0, sal_True  );
     801         [ +  - ]:          6 :             rPropValues[ n ].Name = sRangeXMinimum;
     802 [ +  - ][ +  - ]:          6 :             rPropValues[ n++ ].Value <<= aRangeXMinimum;
     803                 :            :         }
     804         [ +  - ]:          6 :         if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
     805                 :            :         {
     806         [ +  - ]:          6 :             const rtl::OUString sRangeXMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RangeXMaximum" ) );
     807                 :          6 :             ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeXMaximum;
     808                 :            :             EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMaximum, pData->nRangeXMax,
     809         [ +  - ]:          6 :                            ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL ) != 0, sal_False );
     810         [ +  - ]:          6 :             rPropValues[ n ].Name = sRangeXMaximum;
     811 [ +  - ][ +  - ]:          6 :             rPropValues[ n++ ].Value <<= aRangeXMaximum;
     812                 :            :         }
     813         [ -  + ]:          6 :         if ( pData->nRangeYMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
     814                 :            :         {
     815         [ #  # ]:          0 :             const rtl::OUString sRangeYMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RangeYMinimum" ) );
     816                 :          0 :             ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeYMinimum;
     817                 :            :             EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMinimum, pData->nRangeYMin,
     818         [ #  # ]:          0 :                              ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL ) != 0, sal_True );
     819         [ #  # ]:          0 :             rPropValues[ n ].Name = sRangeYMinimum;
     820 [ #  # ][ #  # ]:          0 :             rPropValues[ n++ ].Value <<= aRangeYMinimum;
     821                 :            :         }
     822         [ -  + ]:          6 :         if ( pData->nRangeYMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
     823                 :            :         {
     824         [ #  # ]:          0 :             const rtl::OUString sRangeYMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RangeYMaximum" ) );
     825                 :          0 :             ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeYMaximum;
     826                 :            :             EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMaximum, pData->nRangeYMax,
     827         [ #  # ]:          0 :                              ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL ) != 0, sal_False );
     828         [ #  # ]:          0 :             rPropValues[ n ].Name = sRangeYMaximum;
     829 [ #  # ][ #  # ]:          0 :             rPropValues[ n++ ].Value <<= aRangeYMaximum;
     830                 :            :         }
     831                 :            :     }
     832                 :         27 :     return;
     833                 :            : }
     834                 :            : 
     835                 :        642 : sdr::properties::BaseProperties* SdrObjCustomShape::CreateObjectSpecificProperties()
     836                 :            : {
     837         [ +  - ]:        642 :     return new sdr::properties::CustomShapeProperties(*this);
     838                 :            : }
     839                 :            : 
     840 [ +  + ][ +  + ]:      54426 : TYPEINIT1(SdrObjCustomShape,SdrTextObj);
     841                 :        642 : SdrObjCustomShape::SdrObjCustomShape() :
     842                 :            :     SdrTextObj(),
     843                 :            :     fObjectRotation( 0.0 ),
     844         [ +  - ]:        642 :     mpLastShadowGeometry(0L)
     845                 :            : {
     846                 :        642 :     bTextFrame = sal_True;
     847                 :        642 : }
     848                 :            : 
     849         [ +  - ]:        630 : SdrObjCustomShape::~SdrObjCustomShape()
     850                 :            : {
     851                 :            :     // delete buffered display geometry
     852         [ +  - ]:        630 :     InvalidateRenderGeometry();
     853         [ -  + ]:       1260 : }
     854                 :            : 
     855                 :        657 : void SdrObjCustomShape::MergeDefaultAttributes( const rtl::OUString* pType )
     856                 :            : {
     857                 :        657 :     PropertyValue aPropVal;
     858                 :        657 :     rtl::OUString sShapeType;
     859         [ +  - ]:        657 :     const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
     860 [ +  - ][ +  - ]:        657 :     SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     861 [ +  + ][ +  - ]:        657 :     if ( pType && !pType->isEmpty() )
                 [ +  + ]
     862                 :            :     {
     863                 :         42 :         sal_Int32 nType = pType->toInt32();
     864         [ +  + ]:         42 :         if ( nType )
     865         [ +  - ]:         27 :             sShapeType = EnhancedCustomShapeTypeNames::Get( static_cast< MSO_SPT >( nType ) );
     866                 :            :         else
     867                 :         15 :             sShapeType = *pType;
     868                 :            : 
     869                 :         42 :         aPropVal.Name = sType;
     870         [ +  - ]:         42 :         aPropVal.Value <<= sShapeType;
     871         [ +  - ]:         42 :         aGeometryItem.SetPropertyValue( aPropVal );
     872                 :            :     }
     873                 :            :     else
     874                 :            :     {
     875         [ +  - ]:        615 :         Any *pAny = aGeometryItem.GetPropertyValueByName( sType );
     876         [ +  + ]:        615 :         if ( pAny )
     877                 :        612 :             *pAny >>= sShapeType;
     878                 :            :     }
     879         [ +  - ]:        657 :     MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType );
     880                 :            : 
     881                 :        657 :     const sal_Int32* pDefData = NULL;
     882         [ +  - ]:        657 :     const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType );
     883         [ +  + ]:        657 :     if ( pDefCustomShape )
     884                 :        585 :         pDefData = pDefCustomShape->pDefData;
     885                 :            : 
     886         [ +  - ]:        657 :     com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > seqAdjustmentValues;
     887                 :            : 
     888                 :            :     //////////////////////
     889                 :            :     // AdjustmentValues //
     890                 :            :     //////////////////////
     891         [ +  - ]:        657 :     const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
     892         [ +  - ]:        657 :     const Any* pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sAdjustmentValues );
     893         [ +  + ]:        657 :     if ( pAny )
     894         [ +  - ]:        162 :         *pAny >>= seqAdjustmentValues;
     895 [ +  + ][ +  + ]:        657 :     if ( pDefCustomShape && pDefData )  // now check if we have to default some adjustment values
     896                 :            :     {
     897                 :            :         // first check if there are adjustment values are to be appended
     898                 :        129 :         sal_Int32 i, nAdjustmentValues = seqAdjustmentValues.getLength();
     899                 :        129 :         sal_Int32 nAdjustmentDefaults = *pDefData++;
     900         [ +  + ]:        129 :         if ( nAdjustmentDefaults > nAdjustmentValues )
     901                 :            :         {
     902         [ +  - ]:          6 :             seqAdjustmentValues.realloc( nAdjustmentDefaults );
     903         [ +  + ]:         12 :             for ( i = nAdjustmentValues; i < nAdjustmentDefaults; i++ )
     904                 :            :             {
     905 [ +  - ][ +  - ]:          6 :                 seqAdjustmentValues[ i ].Value <<= pDefData[ i ];
     906         [ +  - ]:          6 :                 seqAdjustmentValues[ i ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
     907                 :            :             }
     908                 :            :         }
     909                 :            :         // check if there are defaulted adjustment values that should be filled the hard coded defaults (pDefValue)
     910         [ +  + ]:        129 :         sal_Int32 nCount = nAdjustmentValues > nAdjustmentDefaults ? nAdjustmentDefaults : nAdjustmentValues;
     911         [ +  + ]:        288 :         for ( i = 0; i < nCount; i++ )
     912                 :            :         {
     913 [ +  - ][ +  + ]:        159 :             if ( seqAdjustmentValues[ i ].State != com::sun::star::beans::PropertyState_DIRECT_VALUE )
     914                 :            :             {
     915 [ +  - ][ +  - ]:          3 :                 seqAdjustmentValues[ i ].Value <<= pDefData[ i ];
     916         [ +  - ]:          3 :                 seqAdjustmentValues[ i ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
     917                 :            :             }
     918                 :            :         }
     919                 :            :     }
     920                 :        657 :     aPropVal.Name = sAdjustmentValues;
     921         [ +  - ]:        657 :     aPropVal.Value <<= seqAdjustmentValues;
     922         [ +  - ]:        657 :     aGeometryItem.SetPropertyValue( aPropVal );
     923                 :            : 
     924                 :            :     ///////////////
     925                 :            :     // Coordsize //
     926                 :            :     ///////////////
     927         [ +  - ]:        657 :     const rtl::OUString sViewBox( RTL_CONSTASCII_USTRINGPARAM ( "ViewBox" ) );
     928         [ +  - ]:        657 :     const Any* pViewBox = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sViewBox );
     929                 :        657 :     com::sun::star::awt::Rectangle aViewBox;
     930 [ +  - ][ -  + ]:        657 :     if ( !pViewBox || !(*pViewBox >>= aViewBox ) )
         [ +  + ][ +  + ]
     931                 :            :     {
     932         [ +  + ]:        450 :         if ( pDefCustomShape )
     933                 :            :         {
     934                 :        444 :             aViewBox.X = 0;
     935                 :        444 :             aViewBox.Y = 0;
     936                 :        444 :             aViewBox.Width = pDefCustomShape->nCoordWidth;
     937                 :        444 :             aViewBox.Height= pDefCustomShape->nCoordHeight;
     938                 :        444 :             aPropVal.Name = sViewBox;
     939         [ +  - ]:        444 :             aPropVal.Value <<= aViewBox;
     940         [ +  - ]:        444 :             aGeometryItem.SetPropertyValue( aPropVal );
     941                 :            :         }
     942                 :            :     }
     943                 :            : 
     944         [ +  - ]:        657 :     const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
     945                 :            : 
     946                 :            :     //////////////////////
     947                 :            :     // Path/Coordinates //
     948                 :            :     //////////////////////
     949         [ +  - ]:        657 :     const rtl::OUString sCoordinates( RTL_CONSTASCII_USTRINGPARAM ( "Coordinates" ) );
     950         [ +  - ]:        657 :     pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
     951 [ +  + ][ +  + ]:        657 :     if ( !pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices )
         [ +  - ][ +  - ]
     952                 :            :     {
     953         [ +  - ]:        444 :         com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqCoordinates;
     954                 :            : 
     955                 :        444 :         sal_Int32 i, nCount = pDefCustomShape->nVertices;
     956         [ +  - ]:        444 :         seqCoordinates.realloc( nCount );
     957         [ +  + ]:       2790 :         for ( i = 0; i < nCount; i++ )
     958                 :            :         {
     959 [ +  - ][ +  - ]:       2346 :             EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates[ i ].First, pDefCustomShape->pVertices[ i ].nValA );
     960 [ +  - ][ +  - ]:       2346 :             EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates[ i ].Second, pDefCustomShape->pVertices[ i ].nValB );
     961                 :            :         }
     962                 :        444 :         aPropVal.Name = sCoordinates;
     963         [ +  - ]:        444 :         aPropVal.Value <<= seqCoordinates;
     964 [ +  - ][ +  - ]:        444 :         aGeometryItem.SetPropertyValue( sPath, aPropVal );
     965                 :            :     }
     966                 :            : 
     967                 :            :     // Path/GluePoints //
     968         [ +  - ]:        657 :     const rtl::OUString sGluePoints( RTL_CONSTASCII_USTRINGPARAM ( "GluePoints" ) );
     969         [ +  - ]:        657 :     pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sGluePoints );
     970 [ +  + ][ +  + ]:        657 :     if ( !pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints )
         [ +  + ][ +  - ]
     971                 :            :     {
     972         [ +  - ]:         18 :         com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqGluePoints;
     973                 :         18 :         sal_Int32 i, nCount = pDefCustomShape->nGluePoints;
     974         [ +  - ]:         18 :         seqGluePoints.realloc( nCount );
     975         [ +  + ]:        159 :         for ( i = 0; i < nCount; i++ )
     976                 :            :         {
     977 [ +  - ][ +  - ]:        141 :             EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints[ i ].First, pDefCustomShape->pGluePoints[ i ].nValA );
     978 [ +  - ][ +  - ]:        141 :             EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints[ i ].Second, pDefCustomShape->pGluePoints[ i ].nValB );
     979                 :            :         }
     980                 :         18 :         aPropVal.Name = sGluePoints;
     981         [ +  - ]:         18 :         aPropVal.Value <<= seqGluePoints;
     982 [ +  - ][ +  - ]:         18 :         aGeometryItem.SetPropertyValue( sPath, aPropVal );
     983                 :            :     }
     984                 :            : 
     985                 :            :     // Path/Segments //
     986         [ +  - ]:        657 :     const rtl::OUString sSegments( RTL_CONSTASCII_USTRINGPARAM ( "Segments" ) );
     987         [ +  - ]:        657 :     pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sSegments );
     988 [ +  + ][ +  + ]:        657 :     if ( !pAny && pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements )
         [ +  + ][ +  - ]
     989                 :            :     {
     990         [ +  - ]:         54 :         com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments;
     991                 :            : 
     992                 :         54 :         sal_Int32 i, nCount = pDefCustomShape->nElements;
     993         [ +  - ]:         54 :         seqSegments.realloc( nCount );
     994         [ +  + ]:        450 :         for ( i = 0; i < nCount; i++ )
     995                 :            :         {
     996         [ +  - ]:        396 :             EnhancedCustomShapeSegment& rSegInfo = seqSegments[ i ];
     997                 :        396 :             sal_uInt16 nSDat = pDefCustomShape->pElements[ i ];
     998                 :        396 :             lcl_ShapeSegmentFromBinary( rSegInfo, nSDat );
     999                 :            :         }
    1000                 :         54 :         aPropVal.Name = sSegments;
    1001         [ +  - ]:         54 :         aPropVal.Value <<= seqSegments;
    1002 [ +  - ][ +  - ]:         54 :         aGeometryItem.SetPropertyValue( sPath, aPropVal );
    1003                 :            :     }
    1004                 :            : 
    1005                 :            :     // Path/StretchX //
    1006         [ +  - ]:        657 :     const rtl::OUString sStretchX( RTL_CONSTASCII_USTRINGPARAM ( "StretchX" ) );
    1007         [ +  - ]:        657 :     pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchX );
    1008 [ +  + ][ +  + ]:        657 :     if ( !pAny && pDefCustomShape )
    1009                 :            :     {
    1010                 :        540 :         sal_Int32 nXRef = pDefCustomShape->nXRef;
    1011         [ +  + ]:        540 :         if ( ( nXRef != DEFAULT_MINIMUM_SIGNED_COMPARE ) )
    1012                 :            :         {
    1013                 :          3 :             aPropVal.Name = sStretchX;
    1014         [ +  - ]:          3 :             aPropVal.Value <<= nXRef;
    1015         [ +  - ]:        540 :             aGeometryItem.SetPropertyValue( sPath, aPropVal );
    1016                 :            :         }
    1017                 :            :     }
    1018                 :            : 
    1019                 :            :     // Path/StretchY //
    1020         [ +  - ]:        657 :     const rtl::OUString sStretchY( RTL_CONSTASCII_USTRINGPARAM ( "StretchY" ) );
    1021         [ +  - ]:        657 :     pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchY );
    1022 [ +  + ][ +  + ]:        657 :     if ( !pAny && pDefCustomShape )
    1023                 :            :     {
    1024                 :        546 :         sal_Int32 nYRef = pDefCustomShape->nYRef;
    1025         [ +  + ]:        546 :         if ( ( nYRef != DEFAULT_MINIMUM_SIGNED_COMPARE ) )
    1026                 :            :         {
    1027                 :          3 :             aPropVal.Name = sStretchY;
    1028         [ +  - ]:          3 :             aPropVal.Value <<= nYRef;
    1029         [ +  - ]:        546 :             aGeometryItem.SetPropertyValue( sPath, aPropVal );
    1030                 :            :         }
    1031                 :            :     }
    1032                 :            : 
    1033                 :            :     // Path/TextFrames //
    1034         [ +  - ]:        657 :     const rtl::OUString sTextFrames( RTL_CONSTASCII_USTRINGPARAM ( "TextFrames" ) );
    1035         [ +  - ]:        657 :     pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sTextFrames );
    1036 [ +  + ][ +  + ]:        657 :     if ( !pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect )
         [ +  + ][ +  - ]
    1037                 :            :     {
    1038         [ +  - ]:         27 :         com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > seqTextFrames;
    1039                 :            : 
    1040                 :         27 :         sal_Int32 i, nCount = pDefCustomShape->nTextRect;
    1041         [ +  - ]:         27 :         seqTextFrames.realloc( nCount );
    1042                 :         27 :         const SvxMSDffTextRectangles* pRectangles = pDefCustomShape->pTextRect;
    1043         [ +  + ]:         54 :         for ( i = 0; i < nCount; i++, pRectangles++ )
    1044                 :            :         {
    1045 [ +  - ][ +  - ]:         27 :             EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].TopLeft.First,     pRectangles->nPairA.nValA );
    1046 [ +  - ][ +  - ]:         27 :             EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].TopLeft.Second,    pRectangles->nPairA.nValB );
    1047 [ +  - ][ +  - ]:         27 :             EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].BottomRight.First,  pRectangles->nPairB.nValA );
    1048 [ +  - ][ +  - ]:         27 :             EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].BottomRight.Second, pRectangles->nPairB.nValB );
    1049                 :            :         }
    1050                 :         27 :         aPropVal.Name = sTextFrames;
    1051         [ +  - ]:         27 :         aPropVal.Value <<= seqTextFrames;
    1052 [ +  - ][ +  - ]:         27 :         aGeometryItem.SetPropertyValue( sPath, aPropVal );
    1053                 :            :     }
    1054                 :            : 
    1055                 :            :     // Equations //
    1056                 :        657 :     const rtl::OUString sEquations(  "Equations"  );
    1057         [ +  - ]:        657 :     pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sEquations );
    1058 [ +  + ][ +  + ]:        657 :     if ( !pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
         [ +  + ][ +  - ]
    1059                 :            :     {
    1060         [ +  - ]:         21 :         com::sun::star::uno::Sequence< rtl::OUString > seqEquations;
    1061                 :            : 
    1062                 :         21 :         sal_Int32 i, nCount = pDefCustomShape->nCalculation;
    1063         [ +  - ]:         21 :         seqEquations.realloc( nCount );
    1064                 :         21 :         const SvxMSDffCalculationData* pData = pDefCustomShape->pCalculation;
    1065         [ +  + ]:        594 :         for ( i = 0; i < nCount; i++, pData++ )
    1066 [ +  - ][ +  - ]:        573 :             seqEquations[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] );
    1067                 :         21 :         aPropVal.Name = sEquations;
    1068         [ +  - ]:         21 :         aPropVal.Value <<= seqEquations;
    1069 [ +  - ][ +  - ]:         21 :         aGeometryItem.SetPropertyValue( aPropVal );
    1070                 :            :     }
    1071                 :            : 
    1072                 :            :     // Handles //
    1073                 :        657 :     const rtl::OUString sHandles(  "Handles"  );
    1074         [ +  - ]:        657 :     pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sHandles );
    1075 [ +  + ][ +  + ]:        657 :     if ( !pAny && pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles )
         [ +  + ][ +  - ]
    1076                 :            :     {
    1077         [ +  - ]:         21 :         com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValues > seqHandles;
    1078                 :            : 
    1079                 :         21 :         sal_Int32 i, nCount = pDefCustomShape->nHandles;
    1080                 :         21 :         const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
    1081         [ +  - ]:         21 :         seqHandles.realloc( nCount );
    1082         [ +  + ]:         48 :         for ( i = 0; i < nCount; i++, pData++ )
    1083                 :            :         {
    1084                 :            :             sal_Int32 nPropertiesNeeded;
    1085         [ +  - ]:         27 :             com::sun::star::beans::PropertyValues& rPropValues = seqHandles[ i ];
    1086                 :         27 :             nPropertiesNeeded = GetNumberOfProperties( pData );
    1087         [ +  - ]:         27 :             rPropValues.realloc( nPropertiesNeeded );
    1088         [ +  - ]:         27 :             lcl_ShapePropertiesFromDFF( pData, rPropValues );
    1089                 :            :         }
    1090                 :         21 :         aPropVal.Name = sHandles;
    1091         [ +  - ]:         21 :         aPropVal.Value <<= seqHandles;
    1092 [ +  - ][ +  - ]:         21 :         aGeometryItem.SetPropertyValue( aPropVal );
    1093                 :            :     }
    1094 [ +  - ][ +  - ]:        657 :     SetMergedItem( aGeometryItem );
                 [ +  - ]
    1095                 :        657 : }
    1096                 :            : 
    1097                 :          3 : sal_Bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) const
    1098                 :            : {
    1099                 :          3 :     sal_Bool bIsDefaultGeometry = sal_False;
    1100                 :            : 
    1101                 :          3 :     PropertyValue aPropVal;
    1102                 :          3 :     rtl::OUString sShapeType;
    1103         [ +  - ]:          3 :     const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
    1104 [ +  - ][ +  - ]:          3 :     SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
    1105                 :            : 
    1106         [ +  - ]:          3 :     Any *pAny = aGeometryItem.GetPropertyValueByName( sType );
    1107         [ +  - ]:          3 :     if ( pAny )
    1108                 :          3 :         *pAny >>= sShapeType;
    1109                 :            : 
    1110         [ +  - ]:          3 :     MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType );
    1111                 :            : 
    1112         [ +  - ]:          3 :     const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType );
    1113         [ +  - ]:          3 :     const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
    1114   [ -  -  -  -  :          3 :     switch( eDefaultType )
          -  -  +  -  -  
                      - ]
    1115                 :            :     {
    1116                 :            :         case DEFAULT_VIEWBOX :
    1117                 :            :         {
    1118         [ #  # ]:          0 :             const rtl::OUString sViewBox( RTL_CONSTASCII_USTRINGPARAM ( "ViewBox" ) );
    1119         [ #  # ]:          0 :             const Any* pViewBox = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sViewBox );
    1120                 :          0 :             com::sun::star::awt::Rectangle aViewBox;
    1121 [ #  # ][ #  # ]:          0 :             if ( pViewBox && ( *pViewBox >>= aViewBox ) )
         [ #  # ][ #  # ]
    1122                 :            :             {
    1123 [ #  # ][ #  # ]:          0 :                 if ( ( aViewBox.Width == pDefCustomShape->nCoordWidth )
    1124                 :            :                     && ( aViewBox.Height == pDefCustomShape->nCoordHeight ) )
    1125                 :          0 :                     bIsDefaultGeometry = sal_True;
    1126                 :          0 :             }
    1127                 :            :         }
    1128                 :          0 :         break;
    1129                 :            : 
    1130                 :            :         case DEFAULT_PATH :
    1131                 :            :         {
    1132         [ #  # ]:          0 :             const rtl::OUString sCoordinates( RTL_CONSTASCII_USTRINGPARAM ( "Coordinates" ) );
    1133         [ #  # ]:          0 :             pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
    1134 [ #  # ][ #  # ]:          0 :             if ( pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices )
         [ #  # ][ #  # ]
    1135                 :            :             {
    1136 [ #  # ][ #  # ]:          0 :                 com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqCoordinates1, seqCoordinates2;
    1137 [ #  # ][ #  # ]:          0 :                 if ( *pAny >>= seqCoordinates1 )
    1138                 :            :                 {
    1139                 :          0 :                     sal_Int32 i, nCount = pDefCustomShape->nVertices;
    1140         [ #  # ]:          0 :                     seqCoordinates2.realloc( nCount );
    1141         [ #  # ]:          0 :                     for ( i = 0; i < nCount; i++ )
    1142                 :            :                     {
    1143 [ #  # ][ #  # ]:          0 :                         EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates2[ i ].First, pDefCustomShape->pVertices[ i ].nValA );
    1144 [ #  # ][ #  # ]:          0 :                         EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates2[ i ].Second, pDefCustomShape->pVertices[ i ].nValB );
    1145                 :            :                     }
    1146 [ #  # ][ #  # ]:          0 :                     if ( seqCoordinates1 == seqCoordinates2 )
    1147                 :          0 :                         bIsDefaultGeometry = sal_True;
    1148 [ #  # ][ #  # ]:          0 :                 }
    1149                 :            :             }
    1150 [ #  # ][ #  # ]:          0 :             else if ( pDefCustomShape && ( ( pDefCustomShape->nVertices == 0 ) || ( pDefCustomShape->pVertices == 0 ) ) )
                 [ #  # ]
    1151                 :          0 :                 bIsDefaultGeometry = sal_True;
    1152                 :            :         }
    1153                 :          0 :         break;
    1154                 :            : 
    1155                 :            :         case DEFAULT_GLUEPOINTS :
    1156                 :            :         {
    1157         [ #  # ]:          0 :             const rtl::OUString sGluePoints( RTL_CONSTASCII_USTRINGPARAM ( "GluePoints" ) );
    1158         [ #  # ]:          0 :             pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sGluePoints );
    1159 [ #  # ][ #  # ]:          0 :             if ( pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints )
         [ #  # ][ #  # ]
    1160                 :            :             {
    1161 [ #  # ][ #  # ]:          0 :                 com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqGluePoints1, seqGluePoints2;
    1162 [ #  # ][ #  # ]:          0 :                 if ( *pAny >>= seqGluePoints1 )
    1163                 :            :                 {
    1164                 :          0 :                     sal_Int32 i, nCount = pDefCustomShape->nGluePoints;
    1165         [ #  # ]:          0 :                     seqGluePoints2.realloc( nCount );
    1166         [ #  # ]:          0 :                     for ( i = 0; i < nCount; i++ )
    1167                 :            :                     {
    1168 [ #  # ][ #  # ]:          0 :                         EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints2[ i ].First, pDefCustomShape->pGluePoints[ i ].nValA );
    1169 [ #  # ][ #  # ]:          0 :                         EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints2[ i ].Second, pDefCustomShape->pGluePoints[ i ].nValB );
    1170                 :            :                     }
    1171 [ #  # ][ #  # ]:          0 :                     if ( seqGluePoints1 == seqGluePoints2 )
    1172                 :          0 :                         bIsDefaultGeometry = sal_True;
    1173 [ #  # ][ #  # ]:          0 :                 }
    1174                 :            :             }
    1175 [ #  # ][ #  # ]:          0 :             else if ( pDefCustomShape && ( pDefCustomShape->nGluePoints == 0 ) )
    1176                 :          0 :                 bIsDefaultGeometry = sal_True;
    1177                 :            :         }
    1178                 :          0 :         break;
    1179                 :            : 
    1180                 :            :         case DEFAULT_SEGMENTS :
    1181                 :            :         {
    1182                 :            :             // Path/Segments //
    1183         [ #  # ]:          0 :             const rtl::OUString sSegments( RTL_CONSTASCII_USTRINGPARAM ( "Segments" ) );
    1184         [ #  # ]:          0 :             pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sSegments );
    1185         [ #  # ]:          0 :             if ( pAny )
    1186                 :            :             {
    1187 [ #  # ][ #  # ]:          0 :                 com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments1, seqSegments2;
    1188 [ #  # ][ #  # ]:          0 :                 if ( *pAny >>= seqSegments1 )
    1189                 :            :                 {
    1190 [ #  # ][ #  # ]:          0 :                     if ( pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements )
                 [ #  # ]
    1191                 :            :                     {
    1192                 :          0 :                         sal_Int32 i, nCount = pDefCustomShape->nElements;
    1193         [ #  # ]:          0 :                         if ( nCount )
    1194                 :            :                         {
    1195         [ #  # ]:          0 :                             seqSegments2.realloc( nCount );
    1196         [ #  # ]:          0 :                             for ( i = 0; i < nCount; i++ )
    1197                 :            :                             {
    1198         [ #  # ]:          0 :                                 EnhancedCustomShapeSegment& rSegInfo = seqSegments2[ i ];
    1199                 :          0 :                                 sal_uInt16 nSDat = pDefCustomShape->pElements[ i ];
    1200                 :          0 :                                 lcl_ShapeSegmentFromBinary( rSegInfo, nSDat );
    1201                 :            :                             }
    1202 [ #  # ][ #  # ]:          0 :                             if ( seqSegments1 == seqSegments2 )
    1203                 :          0 :                                 bIsDefaultGeometry = sal_True;
    1204                 :          0 :                         }
    1205                 :            :                     }
    1206                 :            :                     else
    1207                 :            :                     {
    1208                 :            :                         // check if its the default segment description ( M L Z N )
    1209         [ #  # ]:          0 :                         if ( seqSegments1.getLength() == 4 )
    1210                 :            :                         {
    1211 [ #  # ][ #  # ]:          0 :                             if ( ( seqSegments1[ 0 ].Command == EnhancedCustomShapeSegmentCommand::MOVETO )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1212         [ #  # ]:          0 :                                 && ( seqSegments1[ 1 ].Command == EnhancedCustomShapeSegmentCommand::LINETO )
    1213         [ #  # ]:          0 :                                 && ( seqSegments1[ 2 ].Command == EnhancedCustomShapeSegmentCommand::CLOSESUBPATH )
    1214         [ #  # ]:          0 :                                 && ( seqSegments1[ 3 ].Command == EnhancedCustomShapeSegmentCommand::ENDSUBPATH ) )
    1215                 :          0 :                                 bIsDefaultGeometry = sal_True;
    1216                 :            :                         }
    1217                 :            :                     }
    1218 [ #  # ][ #  # ]:          0 :                 }
    1219                 :            :             }
    1220 [ #  # ][ #  # ]:          0 :             else if ( pDefCustomShape && ( ( pDefCustomShape->nElements == 0 ) || ( pDefCustomShape->pElements == 0 ) ) )
                 [ #  # ]
    1221                 :          0 :                 bIsDefaultGeometry = sal_True;
    1222                 :            :         }
    1223                 :          0 :         break;
    1224                 :            : 
    1225                 :            :         case DEFAULT_STRETCHX :
    1226                 :            :         {
    1227         [ #  # ]:          0 :             const rtl::OUString sStretchX( RTL_CONSTASCII_USTRINGPARAM ( "StretchX" ) );
    1228         [ #  # ]:          0 :             pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchX );
    1229 [ #  # ][ #  # ]:          0 :             if ( pAny && pDefCustomShape )
    1230                 :            :             {
    1231                 :          0 :                 sal_Int32 nStretchX = 0;
    1232         [ #  # ]:          0 :                 if ( *pAny >>= nStretchX )
    1233                 :            :                 {
    1234         [ #  # ]:          0 :                     if ( pDefCustomShape->nXRef == nStretchX )
    1235                 :          0 :                         bIsDefaultGeometry = sal_True;
    1236                 :          0 :                 }
    1237                 :            :             }
    1238 [ #  # ][ #  # ]:          0 :             else if ( pDefCustomShape && ( pDefCustomShape->nXRef == DEFAULT_MINIMUM_SIGNED_COMPARE ) )
    1239                 :          0 :                 bIsDefaultGeometry = sal_True;
    1240                 :            :         }
    1241                 :          0 :         break;
    1242                 :            : 
    1243                 :            :         case DEFAULT_STRETCHY :
    1244                 :            :         {
    1245         [ #  # ]:          0 :             const rtl::OUString sStretchY( RTL_CONSTASCII_USTRINGPARAM ( "StretchY" ) );
    1246         [ #  # ]:          0 :             pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchY );
    1247 [ #  # ][ #  # ]:          0 :             if ( pAny && pDefCustomShape )
    1248                 :            :             {
    1249                 :          0 :                 sal_Int32 nStretchY = 0;
    1250         [ #  # ]:          0 :                 if ( *pAny >>= nStretchY )
    1251                 :            :                 {
    1252         [ #  # ]:          0 :                     if ( pDefCustomShape->nYRef == nStretchY )
    1253                 :          0 :                         bIsDefaultGeometry = sal_True;
    1254                 :          0 :                 }
    1255                 :            :             }
    1256 [ #  # ][ #  # ]:          0 :             else if ( pDefCustomShape && ( pDefCustomShape->nYRef == DEFAULT_MINIMUM_SIGNED_COMPARE ) )
    1257                 :          0 :                 bIsDefaultGeometry = sal_True;
    1258                 :            :         }
    1259                 :          0 :         break;
    1260                 :            : 
    1261                 :            :         case DEFAULT_EQUATIONS :
    1262                 :            :         {
    1263                 :          3 :             const rtl::OUString sEquations(  "Equations"  );
    1264         [ +  - ]:          3 :             pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sEquations );
    1265 [ -  + ][ #  # ]:          3 :             if ( pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
         [ #  # ][ #  # ]
    1266                 :            :             {
    1267 [ #  # ][ #  # ]:          0 :                 com::sun::star::uno::Sequence< rtl::OUString > seqEquations1, seqEquations2;
    1268 [ #  # ][ #  # ]:          0 :                 if ( *pAny >>= seqEquations1 )
    1269                 :            :                 {
    1270                 :          0 :                     sal_Int32 i, nCount = pDefCustomShape->nCalculation;
    1271         [ #  # ]:          0 :                     seqEquations2.realloc( nCount );
    1272                 :            : 
    1273                 :          0 :                     const SvxMSDffCalculationData* pData = pDefCustomShape->pCalculation;
    1274         [ #  # ]:          0 :                     for ( i = 0; i < nCount; i++, pData++ )
    1275 [ #  # ][ #  # ]:          0 :                         seqEquations2[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] );
    1276                 :            : 
    1277 [ #  # ][ #  # ]:          0 :                     if ( seqEquations1 == seqEquations2 )
    1278                 :          0 :                         bIsDefaultGeometry = sal_True;
    1279 [ #  # ][ #  # ]:          0 :                 }
    1280                 :            :             }
    1281 [ -  + ][ #  # ]:          3 :             else if ( pDefCustomShape && ( ( pDefCustomShape->nCalculation == 0 ) || ( pDefCustomShape->pCalculation == 0 ) ) )
                 [ #  # ]
    1282                 :          3 :                 bIsDefaultGeometry = sal_True;
    1283                 :            :         }
    1284                 :          3 :         break;
    1285                 :            : 
    1286                 :            :         case DEFAULT_TEXTFRAMES :
    1287                 :            :         {
    1288                 :          0 :             const rtl::OUString sTextFrames(  "TextFrames"  );
    1289         [ #  # ]:          0 :             pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sTextFrames );
    1290 [ #  # ][ #  # ]:          0 :             if ( pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect )
         [ #  # ][ #  # ]
    1291                 :            :             {
    1292 [ #  # ][ #  # ]:          0 :                 com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > seqTextFrames1, seqTextFrames2;
    1293 [ #  # ][ #  # ]:          0 :                 if ( *pAny >>= seqTextFrames1 )
    1294                 :            :                 {
    1295                 :          0 :                     sal_Int32 i, nCount = pDefCustomShape->nTextRect;
    1296         [ #  # ]:          0 :                     seqTextFrames2.realloc( nCount );
    1297                 :          0 :                     const SvxMSDffTextRectangles* pRectangles = pDefCustomShape->pTextRect;
    1298         [ #  # ]:          0 :                     for ( i = 0; i < nCount; i++, pRectangles++ )
    1299                 :            :                     {
    1300 [ #  # ][ #  # ]:          0 :                         EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].TopLeft.First,    pRectangles->nPairA.nValA );
    1301 [ #  # ][ #  # ]:          0 :                         EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].TopLeft.Second,   pRectangles->nPairA.nValB );
    1302 [ #  # ][ #  # ]:          0 :                         EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].BottomRight.First,  pRectangles->nPairB.nValA );
    1303 [ #  # ][ #  # ]:          0 :                         EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].BottomRight.Second, pRectangles->nPairB.nValB );
    1304                 :            :                     }
    1305 [ #  # ][ #  # ]:          0 :                     if ( seqTextFrames1 == seqTextFrames2 )
    1306                 :          0 :                         bIsDefaultGeometry = sal_True;
    1307 [ #  # ][ #  # ]:          0 :                 }
    1308                 :            :             }
    1309 [ #  # ][ #  # ]:          0 :             else if ( pDefCustomShape && ( ( pDefCustomShape->nTextRect == 0 ) || ( pDefCustomShape->pTextRect == 0 ) ) )
                 [ #  # ]
    1310                 :          0 :                 bIsDefaultGeometry = sal_True;
    1311                 :            :         }
    1312                 :          0 :         break;
    1313                 :            : 
    1314                 :            :         case DEFAULT_HANDLES :
    1315                 :            :         {
    1316                 :          0 :             const rtl::OUString sHandles(  "Handles"  );
    1317         [ #  # ]:          0 :             pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sHandles );
    1318 [ #  # ][ #  # ]:          0 :             if ( pAny && pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles )
         [ #  # ][ #  # ]
    1319                 :            :             {
    1320 [ #  # ][ #  # ]:          0 :                 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValues > seqHandles1, seqHandles2;
    1321 [ #  # ][ #  # ]:          0 :                 if ( *pAny >>= seqHandles1 )
    1322                 :            :                 {
    1323                 :          0 :                     sal_Int32 i, nCount = pDefCustomShape->nHandles;
    1324                 :          0 :                     const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
    1325         [ #  # ]:          0 :                     seqHandles2.realloc( nCount );
    1326         [ #  # ]:          0 :                     for ( i = 0; i < nCount; i++, pData++ )
    1327                 :            :                     {
    1328                 :            :                         sal_Int32 nPropertiesNeeded;
    1329         [ #  # ]:          0 :                         com::sun::star::beans::PropertyValues& rPropValues = seqHandles2[ i ];
    1330                 :          0 :                         nPropertiesNeeded = GetNumberOfProperties( pData );
    1331         [ #  # ]:          0 :                         rPropValues.realloc( nPropertiesNeeded );
    1332         [ #  # ]:          0 :                         lcl_ShapePropertiesFromDFF( pData, rPropValues );
    1333                 :            :                     }
    1334 [ #  # ][ #  # ]:          0 :                     if ( seqHandles1 == seqHandles2 )
    1335                 :          0 :                         bIsDefaultGeometry = sal_True;
    1336 [ #  # ][ #  # ]:          0 :                 }
    1337                 :            :             }
    1338 [ #  # ][ #  # ]:          0 :             else if ( pDefCustomShape && ( ( pDefCustomShape->nHandles == 0 ) || ( pDefCustomShape->pHandles == 0 ) ) )
                 [ #  # ]
    1339                 :          0 :                 bIsDefaultGeometry = sal_True;
    1340                 :            :         }
    1341                 :          0 :         break;
    1342                 :            :     }
    1343         [ +  - ]:          3 :     return bIsDefaultGeometry;
    1344                 :            : }
    1345                 :            : 
    1346                 :          0 : void SdrObjCustomShape::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
    1347                 :            : {
    1348                 :          0 :     rInfo.bResizeFreeAllowed=fObjectRotation == 0.0;
    1349                 :          0 :     rInfo.bResizePropAllowed=sal_True;
    1350                 :          0 :     rInfo.bRotateFreeAllowed=sal_True;
    1351                 :          0 :     rInfo.bRotate90Allowed  =sal_True;
    1352                 :          0 :     rInfo.bMirrorFreeAllowed=sal_True;
    1353                 :          0 :     rInfo.bMirror45Allowed  =sal_True;
    1354                 :          0 :     rInfo.bMirror90Allowed  =sal_True;
    1355                 :          0 :     rInfo.bTransparenceAllowed = sal_False;
    1356                 :          0 :     rInfo.bGradientAllowed = sal_False;
    1357                 :          0 :     rInfo.bShearAllowed     =sal_True;
    1358                 :          0 :     rInfo.bEdgeRadiusAllowed=sal_False;
    1359                 :          0 :     rInfo.bNoContortion     =sal_True;
    1360                 :            : 
    1361                 :            :     // #i37011#
    1362         [ #  # ]:          0 :     if ( mXRenderedCustomShape.is() )
    1363                 :            :     {
    1364                 :          0 :         const SdrObject* pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
    1365         [ #  # ]:          0 :         if ( pRenderedCustomShape )
    1366                 :            :         {
    1367                 :            :             // #i37262#
    1368                 :            :             // Iterate self over the contained objects, since there are combinations of
    1369                 :            :             // polygon and curve objects. In that case, aInfo.bCanConvToPath and
    1370                 :            :             // aInfo.bCanConvToPoly would be false. What is needed here is an or, not an and.
    1371         [ #  # ]:          0 :             SdrObjListIter aIterator(*pRenderedCustomShape);
    1372         [ #  # ]:          0 :             while(aIterator.IsMore())
    1373                 :            :             {
    1374         [ #  # ]:          0 :                 SdrObject* pCandidate = aIterator.Next();
    1375         [ #  # ]:          0 :                 SdrObjTransformInfoRec aInfo;
    1376         [ #  # ]:          0 :                 pCandidate->TakeObjInfo(aInfo);
    1377                 :            : 
    1378                 :            :                 // set path and poly conversion if one is possible since
    1379                 :            :                 // this object will first be broken
    1380 [ #  # ][ #  # ]:          0 :                 const bool bCanConvToPathOrPoly(aInfo.bCanConvToPath || aInfo.bCanConvToPoly);
    1381         [ #  # ]:          0 :                 if(rInfo.bCanConvToPath != bCanConvToPathOrPoly)
    1382                 :            :                 {
    1383                 :          0 :                     rInfo.bCanConvToPath = bCanConvToPathOrPoly;
    1384                 :            :                 }
    1385                 :            : 
    1386         [ #  # ]:          0 :                 if(rInfo.bCanConvToPoly != bCanConvToPathOrPoly)
    1387                 :            :                 {
    1388                 :          0 :                     rInfo.bCanConvToPoly = bCanConvToPathOrPoly;
    1389                 :            :                 }
    1390                 :            : 
    1391         [ #  # ]:          0 :                 if(rInfo.bCanConvToContour != aInfo.bCanConvToContour)
    1392                 :            :                 {
    1393                 :          0 :                     rInfo.bCanConvToContour = aInfo.bCanConvToContour;
    1394                 :            :                 }
    1395                 :            : 
    1396         [ #  # ]:          0 :                 if(rInfo.bShearAllowed != aInfo.bShearAllowed)
    1397                 :            :                 {
    1398                 :          0 :                     rInfo.bShearAllowed = aInfo.bShearAllowed;
    1399                 :            :                 }
    1400                 :            : 
    1401         [ #  # ]:          0 :                 if(rInfo.bEdgeRadiusAllowed != aInfo.bEdgeRadiusAllowed)
    1402                 :            :                 {
    1403                 :          0 :                     rInfo.bEdgeRadiusAllowed = aInfo.bEdgeRadiusAllowed;
    1404                 :            :                 }
    1405                 :          0 :             }
    1406                 :            :         }
    1407                 :            :     }
    1408                 :          0 : }
    1409                 :            : 
    1410                 :        654 : void SdrObjCustomShape::SetModel(SdrModel* pNewModel)
    1411                 :            : {
    1412                 :        654 :     SdrTextObj::SetModel(pNewModel);
    1413                 :        654 :     mXRenderedCustomShape.clear();
    1414                 :        654 : }
    1415                 :            : 
    1416                 :      18261 : sal_uInt16 SdrObjCustomShape::GetObjIdentifier() const
    1417                 :            : {
    1418                 :      18261 :     return sal_uInt16(OBJ_CUSTOMSHAPE);
    1419                 :            : }
    1420                 :            : 
    1421                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1422                 :            : 
    1423                 :        702 : void SdrObjCustomShape::RecalcSnapRect()
    1424                 :            : {
    1425                 :        702 :     SdrTextObj::RecalcSnapRect();
    1426                 :        702 : }
    1427                 :       2643 : const Rectangle& SdrObjCustomShape::GetSnapRect() const
    1428                 :            : {
    1429                 :       2643 :     return SdrTextObj::GetSnapRect();
    1430                 :            : }
    1431                 :        573 : const Rectangle& SdrObjCustomShape::GetCurrentBoundRect() const
    1432                 :            : {
    1433                 :        573 :     return SdrTextObj::GetCurrentBoundRect();
    1434                 :            : }
    1435                 :       1452 : const Rectangle& SdrObjCustomShape::GetLogicRect() const
    1436                 :            : {
    1437                 :       1452 :     return SdrTextObj::GetLogicRect();
    1438                 :            : }
    1439                 :       1446 : void SdrObjCustomShape::NbcSetSnapRect( const Rectangle& rRect )
    1440                 :            : {
    1441                 :       1446 :     aRect=rRect;
    1442         [ +  - ]:       1446 :     ImpJustifyRect(aRect);
    1443         [ +  - ]:       1446 :     InvalidateRenderGeometry();
    1444                 :       1446 :     Rectangle aTextBound( aRect );
    1445 [ +  - ][ -  + ]:       1446 :     if ( GetTextBounds( aTextBound ) )
    1446                 :            :     {
    1447 [ #  # ][ #  # ]:          0 :         if ( pModel==NULL || !pModel->IsPasteResize() )
                 [ #  # ]
    1448                 :            :         {
    1449 [ #  # ][ #  # ]:          0 :             long nHDist=GetTextLeftDistance()+GetTextRightDistance();
    1450 [ #  # ][ #  # ]:          0 :             long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
    1451 [ #  # ][ #  # ]:          0 :             long nTWdt=aTextBound.GetWidth ()-1-nHDist; if (nTWdt<0) nTWdt=0;
    1452 [ #  # ][ #  # ]:          0 :             long nTHgt=aTextBound.GetHeight()-1-nVDist; if (nTHgt<0) nTHgt=0;
    1453 [ #  # ][ #  # ]:          0 :             if ( IsAutoGrowWidth() )
    1454         [ #  # ]:          0 :                 NbcSetMinTextFrameWidth( nTWdt );
    1455 [ #  # ][ #  # ]:          0 :             if ( IsAutoGrowHeight() )
    1456         [ #  # ]:          0 :                 NbcSetMinTextFrameHeight( nTHgt );
    1457         [ #  # ]:          0 :             NbcAdjustTextFrameWidthAndHeight();
    1458                 :            :         }
    1459                 :            :     }
    1460         [ +  - ]:       1446 :     ImpCheckShear();
    1461         [ +  - ]:       1446 :     SetRectsDirty();
    1462         [ +  - ]:       1446 :     SetChanged();
    1463                 :       1446 : }
    1464                 :        864 : void SdrObjCustomShape::SetSnapRect( const Rectangle& rRect )
    1465                 :            : {
    1466         [ +  - ]:        864 :     Rectangle aBoundRect0;
    1467         [ +  + ]:        864 :     if ( pUserCall )
    1468         [ +  - ]:          3 :         aBoundRect0 = GetLastBoundRect();
    1469         [ +  - ]:        864 :     NbcSetSnapRect( rRect );
    1470         [ +  - ]:        864 :     BroadcastObjectChange();
    1471         [ +  - ]:        864 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1472                 :        864 : }
    1473                 :        276 : void SdrObjCustomShape::NbcSetLogicRect( const Rectangle& rRect )
    1474                 :            : {
    1475                 :        276 :     aRect = rRect;
    1476         [ +  - ]:        276 :     ImpJustifyRect( aRect );
    1477         [ +  - ]:        276 :     InvalidateRenderGeometry();
    1478                 :        276 :     Rectangle aTextBound( aRect );
    1479 [ +  - ][ -  + ]:        276 :     if ( GetTextBounds( aTextBound ) )
    1480                 :            :     {
    1481 [ #  # ][ #  # ]:          0 :         long nHDist=GetTextLeftDistance()+GetTextRightDistance();
    1482 [ #  # ][ #  # ]:          0 :         long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
    1483                 :            : 
    1484 [ #  # ][ #  # ]:          0 :         long nTWdt=aTextBound.GetWidth()-1-nHDist; if (nTWdt<0) nTWdt=0;
    1485 [ #  # ][ #  # ]:          0 :         long nTHgt=aTextBound.GetHeight()-1-nVDist; if (nTHgt<0) nTHgt=0;
    1486 [ #  # ][ #  # ]:          0 :         if ( IsAutoGrowWidth() )
    1487         [ #  # ]:          0 :             NbcSetMinTextFrameWidth( nTWdt );
    1488 [ #  # ][ #  # ]:          0 :         if ( IsAutoGrowHeight() )
    1489         [ #  # ]:          0 :             NbcSetMinTextFrameHeight( nTHgt );
    1490         [ #  # ]:          0 :         NbcAdjustTextFrameWidthAndHeight();
    1491                 :            :     }
    1492         [ +  - ]:        276 :     SetRectsDirty();
    1493         [ +  - ]:        276 :     SetChanged();
    1494                 :        276 : }
    1495                 :        276 : void SdrObjCustomShape::SetLogicRect( const Rectangle& rRect )
    1496                 :            : {
    1497         [ +  - ]:        276 :     Rectangle aBoundRect0;
    1498         [ +  + ]:        276 :     if ( pUserCall )
    1499         [ +  - ]:         30 :         aBoundRect0 = GetLastBoundRect();
    1500         [ +  - ]:        276 :     NbcSetLogicRect(rRect);
    1501         [ +  - ]:        276 :     BroadcastObjectChange();
    1502         [ +  - ]:        276 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1503                 :        276 : }
    1504                 :        747 : void SdrObjCustomShape::Move( const Size& rSiz )
    1505                 :            : {
    1506 [ +  + ][ +  + ]:        747 :     if ( rSiz.Width() || rSiz.Height() )
                 [ +  + ]
    1507                 :            :     {
    1508         [ +  - ]:        369 :         Rectangle aBoundRect0;
    1509         [ +  + ]:        369 :         if ( pUserCall )
    1510         [ +  - ]:        144 :             aBoundRect0 = GetLastBoundRect();
    1511         [ +  - ]:        369 :         NbcMove(rSiz);
    1512         [ +  - ]:        369 :         SetChanged();
    1513         [ +  - ]:        369 :         BroadcastObjectChange();
    1514         [ +  - ]:        369 :         SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
    1515                 :            :     }
    1516                 :        747 : }
    1517                 :        456 : void SdrObjCustomShape::NbcMove( const Size& rSiz )
    1518                 :            : {
    1519                 :        456 :     SdrTextObj::NbcMove( rSiz );
    1520         [ -  + ]:        456 :     if ( mXRenderedCustomShape.is() )
    1521                 :            :     {
    1522                 :          0 :         SdrObject* pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
    1523         [ #  # ]:          0 :         if ( pRenderedCustomShape )
    1524                 :            :         {
    1525                 :            :             // #i97149# the visualisation shape needs to be informed
    1526                 :            :             // about change, too
    1527                 :          0 :             pRenderedCustomShape->ActionChanged();
    1528                 :          0 :             pRenderedCustomShape->NbcMove( rSiz );
    1529                 :            :         }
    1530                 :            :     }
    1531                 :            : 
    1532                 :            :     // #i37011# adapt geometry shadow
    1533         [ -  + ]:        456 :     if(mpLastShadowGeometry)
    1534                 :            :     {
    1535                 :          0 :         mpLastShadowGeometry->NbcMove( rSiz );
    1536                 :            :     }
    1537                 :        456 : }
    1538                 :         12 : void SdrObjCustomShape::Resize( const Point& rRef, const Fraction& xFact, const Fraction& yFact )
    1539                 :            : {
    1540                 :         12 :     SdrTextObj::Resize( rRef, xFact, yFact );
    1541                 :         12 : }
    1542                 :            : 
    1543                 :         12 : void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, const Fraction& ryFact )
    1544                 :            : {
    1545         [ +  - ]:         12 :     Fraction xFact( rxFact );
    1546         [ +  - ]:         12 :     Fraction yFact( ryFact );
    1547                 :            : 
    1548                 :            :     // taking care of handles that should not been changed
    1549                 :         12 :     Rectangle aOld( aRect );
    1550         [ +  - ]:         12 :     std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
    1551                 :            : 
    1552         [ +  - ]:         12 :     SdrTextObj::NbcResize( rRef, xFact, yFact );
    1553                 :            : 
    1554   [ -  +  #  # ]:         12 :     if ( ( xFact.GetNumerator() != xFact.GetDenominator() )
                 [ +  - ]
    1555                 :          0 :         || ( yFact.GetNumerator()!= yFact.GetDenominator() ) )
    1556                 :            :     {
    1557 [ -  + ][ #  #  :         36 :         if ( ( ( xFact.GetNumerator() < 0 ) && ( xFact.GetDenominator() > 0 ) ) ||
             +  -  -  + ]
                 [ -  + ]
    1558                 :         24 :             ( ( xFact.GetNumerator() > 0 ) && ( xFact.GetDenominator() < 0 ) ) )
    1559                 :            :         {
    1560 [ #  # ][ #  # ]:          0 :             SetMirroredX( IsMirroredX() == sal_False );
    1561                 :            :         }
    1562 [ -  + ][ #  #  :         36 :         if ( ( ( yFact.GetNumerator() < 0 ) && ( yFact.GetDenominator() > 0 ) ) ||
             +  -  -  + ]
                 [ -  + ]
    1563                 :         24 :             ( ( yFact.GetNumerator() > 0 ) && ( yFact.GetDenominator() < 0 ) ) )
    1564                 :            :         {
    1565 [ #  # ][ #  # ]:          0 :             SetMirroredY( IsMirroredY() == sal_False );
    1566                 :            :         }
    1567                 :            :     }
    1568                 :            : 
    1569                 :         12 :     std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
    1570 [ +  - ][ -  + ]:         12 :     while ( aIter != aInteractionHandles.end() )
    1571                 :            :     {
    1572                 :            :         try
    1573                 :            :         {
    1574         [ #  # ]:          0 :             if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
    1575 [ #  # ][ #  # ]:          0 :                 aIter->xInteraction->setControllerPosition( aIter->aPosition );
    1576         [ #  # ]:          0 :             if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X )
    1577                 :            :             {
    1578                 :          0 :                 sal_Int32 nX = ( aIter->aPosition.X - aOld.Left() ) + aRect.Left();
    1579 [ #  # ][ #  # ]:          0 :                 aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( nX, aIter->xInteraction->getPosition().Y ) );
         [ #  # ][ #  # ]
    1580                 :            :             }
    1581         [ #  # ]:          0 :             if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y )
    1582                 :            :             {
    1583                 :          0 :                 sal_Int32 nY = ( aIter->aPosition.Y - aOld.Top() ) + aRect.Top();
    1584 [ #  # ][ #  # ]:          0 :                 aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( aIter->xInteraction->getPosition().X, nY ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1585                 :            :             }
    1586                 :            :         }
    1587         [ #  # ]:          0 :         catch ( const uno::RuntimeException& )
    1588                 :            :         {
    1589                 :            :         }
    1590         [ #  # ]:          0 :         aIter++;
    1591                 :            :     }
    1592         [ +  - ]:         12 :     InvalidateRenderGeometry();
    1593                 :         12 : }
    1594                 :          3 : void SdrObjCustomShape::NbcRotate( const Point& rRef, long nWink, double sn, double cs )
    1595                 :            : {
    1596                 :          3 :     sal_Bool bMirroredX = IsMirroredX();
    1597                 :          3 :     sal_Bool bMirroredY = IsMirroredY();
    1598                 :            : 
    1599                 :          3 :     fObjectRotation = fmod( fObjectRotation, 360.0 );
    1600         [ -  + ]:          3 :     if ( fObjectRotation < 0 )
    1601                 :          0 :         fObjectRotation = 360 + fObjectRotation;
    1602                 :            : 
    1603                 :            :     // the rotation angle for ashapes is stored in fObjectRotation, this rotation
    1604                 :            :     // has to be applied to the text object (which is internally using aGeo.nWink).
    1605                 :          3 :     SdrTextObj::NbcRotate( aRect.TopLeft(), -aGeo.nDrehWink,        // retrieving the unrotated text object
    1606                 :            :                             sin( (-aGeo.nDrehWink) * F_PI18000 ),
    1607         [ +  - ]:          3 :                             cos( (-aGeo.nDrehWink) * F_PI18000 ) );
    1608                 :          3 :     aGeo.nDrehWink = 0;                                             // resetting aGeo data
    1609                 :          3 :     aGeo.RecalcSinCos();
    1610                 :            : 
    1611                 :          3 :     long nW = (long)( fObjectRotation * 100 );                      // applying our object rotation
    1612         [ -  + ]:          3 :     if ( bMirroredX )
    1613                 :          0 :         nW = 36000 - nW;
    1614         [ -  + ]:          3 :     if ( bMirroredY )
    1615                 :          0 :         nW = 18000 - nW;
    1616                 :          3 :     nW = nW % 36000;
    1617         [ -  + ]:          3 :     if ( nW < 0 )
    1618                 :          0 :         nW = 36000 + nW;
    1619                 :          3 :     SdrTextObj::NbcRotate( aRect.TopLeft(), nW,                     // applying text rotation
    1620                 :            :                             sin( nW * F_PI18000 ),
    1621         [ +  - ]:          3 :                             cos( nW * F_PI18000 ) );
    1622                 :            : 
    1623                 :          3 :     int nSwap = 0;
    1624         [ -  + ]:          3 :     if ( bMirroredX )
    1625                 :          0 :         nSwap ^= 1;
    1626         [ -  + ]:          3 :     if ( bMirroredY )
    1627                 :          0 :         nSwap ^= 1;
    1628                 :            : 
    1629                 :          3 :     double fWink = nWink;                                                   // updating to our new object rotation
    1630                 :          3 :     fWink /= 100.0;
    1631         [ -  + ]:          3 :     fObjectRotation = fmod( nSwap ? fObjectRotation - fWink : fObjectRotation + fWink, 360.0 );
    1632         [ -  + ]:          3 :     if ( fObjectRotation < 0 )
    1633                 :          0 :         fObjectRotation = 360 + fObjectRotation;
    1634                 :            : 
    1635                 :          3 :     SdrTextObj::NbcRotate( rRef, nWink, sn, cs );                           // applying text rotation
    1636                 :          3 :     InvalidateRenderGeometry();
    1637                 :          3 : }
    1638                 :            : 
    1639                 :          9 : void SdrObjCustomShape::NbcMirror( const Point& rRef1, const Point& rRef2 )
    1640                 :            : {
    1641                 :            :     // storing horizontal and vertical flipping without modifying the rotate angle
    1642                 :          9 :     sal_Bool bHorz = sal_False;
    1643                 :          9 :     sal_Bool bVert = sal_False;
    1644         [ +  - ]:          9 :     if ( rRef1.X() == rRef2.X() )
    1645                 :          9 :         bHorz = sal_True;
    1646         [ -  + ]:          9 :     if ( rRef1.Y() == rRef2.Y() )
    1647                 :          0 :         bVert = sal_True;
    1648 [ -  + ][ #  # ]:          9 :     if ( !bHorz && !bVert )
    1649                 :          0 :         bHorz = bVert = sal_True;
    1650                 :            : 
    1651 [ -  + ][ #  # ]:          9 :     if ( bHorz || bVert )
    1652                 :            :     {
    1653 [ +  - ][ +  - ]:          9 :         SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
    1654                 :            : 
    1655                 :            :         // "MirroredX" //
    1656         [ +  - ]:          9 :         if ( bHorz )
    1657                 :            :         {
    1658         [ +  - ]:          9 :             const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
    1659         [ +  - ]:          9 :             com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredX );
    1660         [ +  - ]:          9 :             if ( pAny )
    1661                 :            :             {
    1662                 :          9 :                 sal_Bool bFlip = sal_Bool();
    1663         [ +  - ]:          9 :                 if ( *pAny >>= bFlip )
    1664                 :            :                 {
    1665         [ +  - ]:          9 :                     if ( bFlip )
    1666                 :          9 :                         bHorz = sal_False;
    1667                 :            :                 }
    1668                 :            :             }
    1669                 :          9 :             PropertyValue aPropVal;
    1670                 :          9 :             aPropVal.Name = sMirroredX;
    1671         [ +  - ]:          9 :             aPropVal.Value <<= bHorz;
    1672         [ +  - ]:          9 :             aGeometryItem.SetPropertyValue( aPropVal );
    1673                 :            :         }
    1674                 :            : 
    1675                 :            :         // "MirroredY" //
    1676         [ -  + ]:          9 :         if ( bVert )
    1677                 :            :         {
    1678         [ #  # ]:          0 :             const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
    1679         [ #  # ]:          0 :             com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredY );
    1680         [ #  # ]:          0 :             if ( pAny )
    1681                 :            :             {
    1682                 :          0 :                 sal_Bool bFlip = sal_Bool();
    1683         [ #  # ]:          0 :                 if ( *pAny >>= bFlip )
    1684                 :            :                 {
    1685         [ #  # ]:          0 :                     if ( bFlip )
    1686                 :          0 :                         bVert = sal_False;
    1687                 :            :                 }
    1688                 :            :             }
    1689                 :          0 :             PropertyValue aPropVal;
    1690                 :          0 :             aPropVal.Name = sMirroredY;
    1691         [ #  # ]:          0 :             aPropVal.Value <<= bVert;
    1692         [ #  # ]:          0 :             aGeometryItem.SetPropertyValue( aPropVal );
    1693                 :            :         }
    1694 [ +  - ][ +  - ]:          9 :         SetMergedItem( aGeometryItem );
    1695                 :            :     }
    1696         [ +  - ]:          9 :     SdrTextObj::NbcMirror( rRef1, rRef2 );
    1697         [ +  - ]:          9 :     InvalidateRenderGeometry();
    1698                 :          9 : }
    1699                 :            : 
    1700                 :          0 : void SdrObjCustomShape::Shear( const Point& rRef, long nWink, double tn, bool bVShear )
    1701                 :            : {
    1702                 :          0 :     SdrTextObj::Shear( rRef, nWink, tn, bVShear );
    1703                 :          0 :     InvalidateRenderGeometry();
    1704                 :          0 : }
    1705                 :          0 : void SdrObjCustomShape::NbcShear( const Point& rRef, long nWink, double tn, bool bVShear )
    1706                 :            : {
    1707                 :          0 :     long nDrehWink = aGeo.nDrehWink;
    1708         [ #  # ]:          0 :     if ( nDrehWink )
    1709                 :            :     {
    1710                 :          0 :         aGeo.nDrehWink = -nDrehWink;
    1711                 :          0 :         aGeo.RecalcSinCos();
    1712                 :          0 :         NbcRotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos );
    1713                 :            :     }
    1714                 :          0 :     SdrTextObj::NbcShear(rRef,nWink,tn,bVShear);
    1715         [ #  # ]:          0 :     if ( nDrehWink )
    1716                 :            :     {
    1717                 :          0 :         aGeo.nDrehWink = nDrehWink;
    1718                 :          0 :         aGeo.RecalcSinCos();
    1719                 :          0 :         Rotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos );
    1720                 :            :     }
    1721                 :          0 :     InvalidateRenderGeometry();
    1722                 :          0 : }
    1723                 :            : 
    1724                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1725                 :            : 
    1726                 :          0 : SdrGluePoint SdrObjCustomShape::GetVertexGluePoint(sal_uInt16 nPosNum) const
    1727                 :            : {
    1728         [ #  # ]:          0 :     sal_Int32 nWdt = ImpGetLineWdt(); // #i25616#
    1729                 :            : 
    1730                 :            :     // #i25616#
    1731 [ #  # ][ #  # ]:          0 :     if(!LineIsOutsideGeometry())
    1732                 :            :     {
    1733                 :          0 :         nWdt++;
    1734                 :          0 :         nWdt /= 2;
    1735                 :            :     }
    1736                 :            : 
    1737                 :          0 :     Point aPt;
    1738   [ #  #  #  #  :          0 :     switch (nPosNum) {
                      # ]
    1739         [ #  # ]:          0 :         case 0: aPt=aRect.TopCenter();    aPt.Y()-=nWdt; break;
    1740         [ #  # ]:          0 :         case 1: aPt=aRect.RightCenter();  aPt.X()+=nWdt; break;
    1741         [ #  # ]:          0 :         case 2: aPt=aRect.BottomCenter(); aPt.Y()+=nWdt; break;
    1742         [ #  # ]:          0 :         case 3: aPt=aRect.LeftCenter();   aPt.X()-=nWdt; break;
    1743                 :            :     }
    1744         [ #  # ]:          0 :     if (aGeo.nShearWink!=0) ShearPoint(aPt,aRect.TopLeft(),aGeo.nTan);
    1745         [ #  # ]:          0 :     if (aGeo.nDrehWink!=0) RotatePoint(aPt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
    1746 [ #  # ][ #  # ]:          0 :     aPt-=GetSnapRect().Center();
    1747                 :          0 :     SdrGluePoint aGP(aPt);
    1748                 :          0 :     aGP.SetPercent(sal_False);
    1749                 :          0 :     return aGP;
    1750                 :            : }
    1751                 :            : 
    1752                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1753                 :            : 
    1754                 :            : // #i38892#
    1755                 :         63 : void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
    1756                 :            : {
    1757                 :         63 :     const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
    1758                 :            : 
    1759         [ -  + ]:         63 :     if(pSdrObject)
    1760                 :            :     {
    1761                 :          0 :         const SdrGluePointList* pSource = pSdrObject->GetGluePointList();
    1762                 :            : 
    1763 [ #  # ][ #  # ]:          0 :         if(pSource && pSource->GetCount())
                 [ #  # ]
    1764                 :            :         {
    1765         [ #  # ]:          0 :             if(!SdrTextObj::GetGluePointList())
    1766                 :            :             {
    1767                 :          0 :                 SdrTextObj::ForceGluePointList();
    1768                 :            :             }
    1769                 :            : 
    1770                 :          0 :             const SdrGluePointList* pList = SdrTextObj::GetGluePointList();
    1771                 :            : 
    1772         [ #  # ]:          0 :             if(pList)
    1773                 :            :             {
    1774         [ #  # ]:          0 :                 SdrGluePointList aNewList;
    1775                 :            :                 sal_uInt16 a;
    1776                 :            : 
    1777         [ #  # ]:          0 :                 for(a = 0; a < pSource->GetCount(); a++)
    1778                 :            :                 {
    1779         [ #  # ]:          0 :                     SdrGluePoint aCopy((*pSource)[a]);
    1780                 :          0 :                     aCopy.SetUserDefined(sal_False);
    1781         [ #  # ]:          0 :                     aNewList.Insert(aCopy);
    1782                 :            :                 }
    1783                 :            : 
    1784         [ #  # ]:          0 :                 sal_Bool bMirroredX = IsMirroredX();
    1785         [ #  # ]:          0 :                 sal_Bool bMirroredY = IsMirroredY();
    1786                 :            : 
    1787                 :          0 :                 long nShearWink = aGeo.nShearWink;
    1788                 :          0 :                 double fTan = aGeo.nTan;
    1789                 :            : 
    1790 [ #  # ][ #  # ]:          0 :                 if ( aGeo.nDrehWink || nShearWink || bMirroredX || bMirroredY )
         [ #  # ][ #  # ]
    1791                 :            :                 {
    1792         [ #  # ]:          0 :                     Polygon aPoly( aRect );
    1793         [ #  # ]:          0 :                     if( nShearWink )
    1794                 :            :                     {
    1795         [ #  # ]:          0 :                         sal_uInt16 nPointCount=aPoly.GetSize();
    1796         [ #  # ]:          0 :                         for (sal_uInt16 i=0; i<nPointCount; i++)
    1797 [ #  # ][ #  # ]:          0 :                             ShearPoint(aPoly[i],aRect.Center(), fTan, sal_False );
    1798                 :            :                     }
    1799         [ #  # ]:          0 :                     if ( aGeo.nDrehWink )
    1800 [ #  # ][ #  # ]:          0 :                         aPoly.Rotate( aRect.Center(), aGeo.nDrehWink / 10 );
    1801                 :            : 
    1802         [ #  # ]:          0 :                     Rectangle aBoundRect( aPoly.GetBoundRect() );
    1803                 :          0 :                     sal_Int32 nXDiff = aBoundRect.Left() - aRect.Left();
    1804                 :          0 :                     sal_Int32 nYDiff = aBoundRect.Top() - aRect.Top();
    1805                 :            : 
    1806 [ #  # ][ #  # ]:          0 :                     if (nShearWink&&((bMirroredX&&!bMirroredY)||(bMirroredY&&!bMirroredX)))
         [ #  # ][ #  # ]
                 [ #  # ]
    1807                 :            :                     {
    1808                 :          0 :                         nShearWink = -nShearWink;
    1809                 :          0 :                         fTan = -fTan;
    1810                 :            :                     }
    1811                 :            : 
    1812 [ #  # ][ #  # ]:          0 :                     Point aRef( aRect.GetWidth() / 2, aRect.GetHeight() / 2 );
    1813         [ #  # ]:          0 :                     for ( a = 0; a < aNewList.GetCount(); a++ )
    1814                 :            :                     {
    1815         [ #  # ]:          0 :                         SdrGluePoint& rPoint = aNewList[ a ];
    1816                 :          0 :                         Point aGlue( rPoint.GetPos() );
    1817         [ #  # ]:          0 :                         if ( nShearWink )
    1818                 :          0 :                             ShearPoint( aGlue, aRef, fTan );
    1819                 :            : 
    1820                 :          0 :                         RotatePoint( aGlue, aRef, sin( fObjectRotation * F_PI180 ), cos( fObjectRotation * F_PI180 ) );
    1821         [ #  # ]:          0 :                         if ( bMirroredX )
    1822         [ #  # ]:          0 :                             aGlue.X() = aRect.GetWidth() - aGlue.X();
    1823         [ #  # ]:          0 :                         if ( bMirroredY )
    1824         [ #  # ]:          0 :                             aGlue.Y() = aRect.GetHeight() - aGlue.Y();
    1825                 :          0 :                         aGlue.X() -= nXDiff;
    1826                 :          0 :                         aGlue.Y() -= nYDiff;
    1827                 :          0 :                         rPoint.SetPos( aGlue );
    1828         [ #  # ]:          0 :                     }
    1829                 :            :                 }
    1830                 :            : 
    1831         [ #  # ]:          0 :                 for(a = 0; a < pList->GetCount(); a++)
    1832                 :            :                 {
    1833         [ #  # ]:          0 :                     const SdrGluePoint& rCandidate = (*pList)[a];
    1834                 :            : 
    1835         [ #  # ]:          0 :                     if(rCandidate.IsUserDefined())
    1836                 :            :                     {
    1837         [ #  # ]:          0 :                         aNewList.Insert(rCandidate);
    1838                 :            :                     }
    1839                 :            :                 }
    1840                 :            : 
    1841                 :            :                 // copy new list to local. This is NOT very convenient behavior, the local
    1842                 :            :                 // GluePointList should not be set, but we delivered by using GetGluePointList(),
    1843                 :            :                 // maybe on demand. Since the local object is changed here, this is assumed to
    1844                 :            :                 // be a result of GetGluePointList and thus the list is copied
    1845         [ #  # ]:          0 :                 if(pPlusData)
    1846                 :            :                 {
    1847         [ #  # ]:          0 :                     pPlusData->SetGluePoints(aNewList);
    1848         [ #  # ]:          0 :                 }
    1849                 :            :             }
    1850                 :            :         }
    1851                 :            :     }
    1852                 :         63 : }
    1853                 :            : 
    1854                 :            : // #i38892#
    1855                 :         63 : const SdrGluePointList* SdrObjCustomShape::GetGluePointList() const
    1856                 :            : {
    1857                 :         63 :     ((SdrObjCustomShape*)this)->ImpCheckCustomGluePointsAreAdded();
    1858                 :         63 :     return SdrTextObj::GetGluePointList();
    1859                 :            : }
    1860                 :            : 
    1861                 :            : // #i38892#
    1862                 :          0 : SdrGluePointList* SdrObjCustomShape::ForceGluePointList()
    1863                 :            : {
    1864         [ #  # ]:          0 :     if(SdrTextObj::ForceGluePointList())
    1865                 :            :     {
    1866                 :          0 :         ImpCheckCustomGluePointsAreAdded();
    1867                 :          0 :         return SdrTextObj::ForceGluePointList();
    1868                 :            :     }
    1869                 :            :     else
    1870                 :            :     {
    1871                 :          0 :         return 0L;
    1872                 :            :     }
    1873                 :            : }
    1874                 :            : 
    1875                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1876                 :            : 
    1877                 :          0 : sal_uInt32 SdrObjCustomShape::GetHdlCount() const
    1878                 :            : {
    1879         [ #  # ]:          0 :     const sal_uInt32 nBasicHdlCount(SdrTextObj::GetHdlCount());
    1880         [ #  # ]:          0 :     std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
    1881                 :          0 :     return ( aInteractionHandles.size() + nBasicHdlCount );
    1882                 :            : }
    1883                 :            : 
    1884                 :          0 : SdrHdl* SdrObjCustomShape::GetHdl( sal_uInt32 nHdlNum ) const
    1885                 :            : {
    1886                 :          0 :     SdrHdl* pH = NULL;
    1887                 :          0 :     const sal_uInt32 nBasicHdlCount(SdrTextObj::GetHdlCount());
    1888                 :            : 
    1889         [ #  # ]:          0 :     if ( nHdlNum < nBasicHdlCount )
    1890                 :          0 :         pH = SdrTextObj::GetHdl( nHdlNum );
    1891                 :            :     else
    1892                 :            :     {
    1893         [ #  # ]:          0 :         std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
    1894                 :          0 :         const sal_uInt32 nCustomShapeHdlNum(nHdlNum - nBasicHdlCount);
    1895                 :            : 
    1896         [ #  # ]:          0 :         if ( nCustomShapeHdlNum < aInteractionHandles.size() )
    1897                 :            :         {
    1898         [ #  # ]:          0 :             if ( aInteractionHandles[ nCustomShapeHdlNum ].xInteraction.is() )
    1899                 :            :             {
    1900                 :            :                 try
    1901                 :            :                 {
    1902 [ #  # ][ #  # ]:          0 :                     com::sun::star::awt::Point aPosition( aInteractionHandles[ nCustomShapeHdlNum ].xInteraction->getPosition() );
    1903         [ #  # ]:          0 :                     pH = new SdrHdl( Point( aPosition.X, aPosition.Y ), HDL_CUSTOMSHAPE1 );
           [ #  #  #  # ]
    1904                 :          0 :                     pH->SetPointNum( nCustomShapeHdlNum );
    1905         [ #  # ]:          0 :                     pH->SetObj( (SdrObject*)this );
    1906                 :            :                 }
    1907         [ #  # ]:          0 :                 catch ( const uno::RuntimeException& )
    1908                 :            :                 {
    1909                 :            :                 }
    1910                 :            :             }
    1911                 :          0 :         }
    1912                 :            :     }
    1913                 :          0 :     return pH;
    1914                 :            : }
    1915                 :            : 
    1916                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1917                 :            : 
    1918                 :          3 : bool SdrObjCustomShape::hasSpecialDrag() const
    1919                 :            : {
    1920                 :          3 :     return true;
    1921                 :            : }
    1922                 :            : 
    1923                 :          0 : bool SdrObjCustomShape::beginSpecialDrag(SdrDragStat& rDrag) const
    1924                 :            : {
    1925                 :          0 :     const SdrHdl* pHdl = rDrag.GetHdl();
    1926                 :            : 
    1927 [ #  # ][ #  # ]:          0 :     if(pHdl && HDL_CUSTOMSHAPE1 == pHdl->GetKind())
                 [ #  # ]
    1928                 :            :     {
    1929                 :          0 :         rDrag.SetEndDragChangesAttributes(true);
    1930                 :          0 :         rDrag.SetNoSnap(true);
    1931                 :            :     }
    1932                 :            :     else
    1933                 :            :     {
    1934                 :          0 :         const SdrHdl* pHdl2 = rDrag.GetHdl();
    1935         [ #  # ]:          0 :         const SdrHdlKind eHdl((pHdl2 == NULL) ? HDL_MOVE : pHdl2->GetKind());
    1936                 :            : 
    1937         [ #  # ]:          0 :         switch( eHdl )
    1938                 :            :         {
    1939                 :            :             case HDL_UPLFT :
    1940                 :            :             case HDL_UPPER :
    1941                 :            :             case HDL_UPRGT :
    1942                 :            :             case HDL_LEFT  :
    1943                 :            :             case HDL_RIGHT :
    1944                 :            :             case HDL_LWLFT :
    1945                 :            :             case HDL_LOWER :
    1946                 :            :             case HDL_LWRGT :
    1947                 :            :             case HDL_MOVE  :
    1948                 :            :             {
    1949                 :          0 :                 break;
    1950                 :            :             }
    1951                 :            :             default:
    1952                 :            :             {
    1953                 :          0 :                 return false;
    1954                 :            :             }
    1955                 :            :         }
    1956                 :            :     }
    1957                 :            : 
    1958                 :          0 :     return true;
    1959                 :            : }
    1960                 :            : 
    1961                 :          0 : void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect, SdrObjCustomShape* pObj ) const
    1962                 :            : {
    1963                 :          0 :     Rectangle   aOld( pObj->aRect );
    1964         [ #  # ]:          0 :     sal_Bool    bOldMirroredX( pObj->IsMirroredX() );
    1965         [ #  # ]:          0 :     sal_Bool    bOldMirroredY( pObj->IsMirroredY() );
    1966                 :            : 
    1967                 :          0 :     Rectangle aNewRect( rNewRect );
    1968         [ #  # ]:          0 :     aNewRect.Justify();
    1969                 :            : 
    1970         [ #  # ]:          0 :     std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( pObj ) );
    1971                 :            : 
    1972                 :          0 :     GeoStat aGeoStat( pObj->GetGeoStat() );
    1973 [ #  # ][ #  # ]:          0 :     if ( aNewRect.TopLeft()!= pObj->aRect.TopLeft() &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1974                 :            :         ( pObj->aGeo.nDrehWink || pObj->aGeo.nShearWink ) )
    1975                 :            :     {
    1976                 :          0 :         Point aNewPos( aNewRect.TopLeft() );
    1977         [ #  # ]:          0 :         if ( pObj->aGeo.nShearWink ) ShearPoint( aNewPos, aOld.TopLeft(), aGeoStat.nTan );
    1978         [ #  # ]:          0 :         if ( pObj->aGeo.nDrehWink )  RotatePoint(aNewPos, aOld.TopLeft(), aGeoStat.nSin, aGeoStat.nCos );
    1979                 :          0 :         aNewRect.SetPos( aNewPos );
    1980                 :            :     }
    1981 [ #  # ][ #  # ]:          0 :     if ( aNewRect != pObj->aRect )
    1982                 :            :     {
    1983         [ #  # ]:          0 :         pObj->SetLogicRect( aNewRect );
    1984         [ #  # ]:          0 :         pObj->InvalidateRenderGeometry();
    1985                 :            : 
    1986         [ #  # ]:          0 :         if ( rNewRect.Left() > rNewRect.Right() )
    1987                 :            :         {
    1988 [ #  # ][ #  # ]:          0 :             Point aTop( ( pObj->GetSnapRect().Left() + pObj->GetSnapRect().Right() ) >> 1, pObj->GetSnapRect().Top() );
                 [ #  # ]
    1989                 :          0 :             Point aBottom( aTop.X(), aTop.Y() + 1000 );
    1990         [ #  # ]:          0 :             pObj->NbcMirror( aTop, aBottom );
    1991                 :            :         }
    1992         [ #  # ]:          0 :         if ( rNewRect.Top() > rNewRect.Bottom() )
    1993                 :            :         {
    1994 [ #  # ][ #  # ]:          0 :             Point aLeft( pObj->GetSnapRect().Left(), ( pObj->GetSnapRect().Top() + pObj->GetSnapRect().Bottom() ) >> 1 );
                 [ #  # ]
    1995                 :          0 :             Point aRight( aLeft.X() + 1000, aLeft.Y() );
    1996         [ #  # ]:          0 :             pObj->NbcMirror( aLeft, aRight );
    1997                 :            :         }
    1998                 :            : 
    1999                 :          0 :         std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
    2000 [ #  # ][ #  # ]:          0 :         while ( aIter != aInteractionHandles.end() )
    2001                 :            :         {
    2002                 :            :             try
    2003                 :            :             {
    2004         [ #  # ]:          0 :                 if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
    2005 [ #  # ][ #  # ]:          0 :                     aIter->xInteraction->setControllerPosition( aIter->aPosition );
    2006         [ #  # ]:          0 :                 if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X )
    2007                 :            :                 {
    2008                 :            :                     sal_Int32 nX;
    2009         [ #  # ]:          0 :                     if ( bOldMirroredX )
    2010                 :            :                     {
    2011                 :          0 :                         nX = ( aIter->aPosition.X - aOld.Right() );
    2012         [ #  # ]:          0 :                         if ( rNewRect.Left() > rNewRect.Right() )
    2013                 :          0 :                             nX = pObj->aRect.Left() - nX;
    2014                 :            :                         else
    2015                 :          0 :                             nX += pObj->aRect.Right();
    2016                 :            :                     }
    2017                 :            :                     else
    2018                 :            :                     {
    2019                 :          0 :                         nX = ( aIter->aPosition.X - aOld.Left() );
    2020         [ #  # ]:          0 :                         if ( rNewRect.Left() > rNewRect.Right() )
    2021                 :          0 :                             nX = pObj->aRect.Right() - nX;
    2022                 :            :                         else
    2023                 :          0 :                             nX += pObj->aRect.Left();
    2024                 :            :                     }
    2025 [ #  # ][ #  # ]:          0 :                     aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( nX, aIter->xInteraction->getPosition().Y ) );
         [ #  # ][ #  # ]
    2026                 :            :                 }
    2027         [ #  # ]:          0 :                 if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y )
    2028                 :            :                 {
    2029                 :            :                     sal_Int32 nY;
    2030         [ #  # ]:          0 :                     if ( bOldMirroredY )
    2031                 :            :                     {
    2032                 :          0 :                         nY = ( aIter->aPosition.Y - aOld.Bottom() );
    2033         [ #  # ]:          0 :                         if ( rNewRect.Top() > rNewRect.Bottom() )
    2034                 :          0 :                             nY = pObj->aRect.Top() - nY;
    2035                 :            :                         else
    2036                 :          0 :                             nY += pObj->aRect.Bottom();
    2037                 :            :                     }
    2038                 :            :                     else
    2039                 :            :                     {
    2040                 :          0 :                         nY = ( aIter->aPosition.Y - aOld.Top() );
    2041         [ #  # ]:          0 :                         if ( rNewRect.Top() > rNewRect.Bottom() )
    2042                 :          0 :                             nY = pObj->aRect.Bottom() - nY;
    2043                 :            :                         else
    2044                 :          0 :                             nY += pObj->aRect.Top();
    2045                 :            :                     }
    2046 [ #  # ][ #  # ]:          0 :                     aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( aIter->xInteraction->getPosition().X, nY ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    2047                 :            :                 }
    2048                 :            :             }
    2049         [ #  # ]:          0 :             catch ( const uno::RuntimeException& )
    2050                 :            :             {
    2051                 :            :             }
    2052         [ #  # ]:          0 :             aIter++;
    2053                 :            :         }
    2054                 :          0 :     }
    2055                 :          0 : }
    2056                 :            : 
    2057                 :          0 : void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point aDestination, const sal_uInt16 nCustomShapeHdlNum, SdrObjCustomShape* pObj ) const
    2058                 :            : {
    2059         [ #  # ]:          0 :     std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( pObj ) );
    2060         [ #  # ]:          0 :     if ( nCustomShapeHdlNum < aInteractionHandles.size() )
    2061                 :            :     {
    2062         [ #  # ]:          0 :         SdrCustomShapeInteraction aInteractionHandle( aInteractionHandles[ nCustomShapeHdlNum ] );
    2063         [ #  # ]:          0 :         if ( aInteractionHandle.xInteraction.is() )
    2064                 :            :         {
    2065                 :            :             try
    2066                 :            :             {
    2067                 :          0 :                 com::sun::star::awt::Point aPt( aDestination.X(), aDestination.Y() );
    2068         [ #  # ]:          0 :                 if ( aInteractionHandle.nMode & CUSTOMSHAPE_HANDLE_MOVE_SHAPE )
    2069                 :            :                 {
    2070                 :          0 :                     sal_Int32 nXDiff = aPt.X - aInteractionHandle.aPosition.X;
    2071                 :          0 :                     sal_Int32 nYDiff = aPt.Y - aInteractionHandle.aPosition.Y;
    2072                 :            : 
    2073         [ #  # ]:          0 :                     pObj->aRect.Move( nXDiff, nYDiff );
    2074         [ #  # ]:          0 :                     pObj->aOutRect.Move( nXDiff, nYDiff );
    2075         [ #  # ]:          0 :                     pObj->maSnapRect.Move( nXDiff, nYDiff );
    2076         [ #  # ]:          0 :                     pObj->SetRectsDirty(sal_True);
    2077         [ #  # ]:          0 :                     pObj->InvalidateRenderGeometry();
    2078                 :            : 
    2079                 :          0 :                     std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
    2080 [ #  # ][ #  # ]:          0 :                     while ( aIter != aInteractionHandles.end() )
                 [ #  # ]
    2081                 :            :                     {
    2082         [ #  # ]:          0 :                         if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
    2083                 :            :                         {
    2084         [ #  # ]:          0 :                             if ( aIter->xInteraction.is() )
    2085 [ #  # ][ #  # ]:          0 :                                 aIter->xInteraction->setControllerPosition( aIter->aPosition );
    2086                 :            :                         }
    2087         [ #  # ]:          0 :                         aIter++;
    2088                 :            :                     }
    2089                 :            :                 }
    2090 [ #  # ][ #  # ]:          0 :                 aInteractionHandle.xInteraction->setControllerPosition( aPt );
    2091                 :            :             }
    2092         [ #  # ]:          0 :             catch ( const uno::RuntimeException& )
    2093                 :            :             {
    2094                 :            :             }
    2095         [ #  # ]:          0 :         }
    2096                 :          0 :     }
    2097                 :          0 : }
    2098                 :            : 
    2099                 :          0 : bool SdrObjCustomShape::applySpecialDrag(SdrDragStat& rDrag)
    2100                 :            : {
    2101                 :          0 :     const SdrHdl* pHdl = rDrag.GetHdl();
    2102         [ #  # ]:          0 :     const SdrHdlKind eHdl((pHdl == NULL) ? HDL_MOVE : pHdl->GetKind());
    2103                 :            : 
    2104   [ #  #  #  # ]:          0 :     switch(eHdl)
    2105                 :            :     {
    2106                 :            :         case HDL_CUSTOMSHAPE1 :
    2107                 :            :         {
    2108                 :          0 :             rDrag.SetEndDragChangesGeoAndAttributes(true);
    2109                 :          0 :             DragMoveCustomShapeHdl( rDrag.GetNow(), (sal_uInt16)pHdl->GetPointNum(), this );
    2110                 :          0 :             SetRectsDirty();
    2111                 :          0 :             InvalidateRenderGeometry();
    2112                 :          0 :             SetChanged();
    2113                 :          0 :             break;
    2114                 :            :         }
    2115                 :            : 
    2116                 :            :         case HDL_UPLFT :
    2117                 :            :         case HDL_UPPER :
    2118                 :            :         case HDL_UPRGT :
    2119                 :            :         case HDL_LEFT  :
    2120                 :            :         case HDL_RIGHT :
    2121                 :            :         case HDL_LWLFT :
    2122                 :            :         case HDL_LOWER :
    2123                 :            :         case HDL_LWRGT :
    2124                 :            :         {
    2125         [ #  # ]:          0 :             DragResizeCustomShape(ImpDragCalcRect(rDrag), this);
    2126                 :          0 :             break;
    2127                 :            :         }
    2128                 :            :         case HDL_MOVE :
    2129                 :            :         {
    2130         [ #  # ]:          0 :             Move(Size(rDrag.GetDX(), rDrag.GetDY()));
    2131                 :          0 :             break;
    2132                 :            :         }
    2133                 :          0 :         default: break;
    2134                 :            :     }
    2135                 :            : 
    2136                 :          0 :     return true;
    2137                 :            : }
    2138                 :            : 
    2139                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2140                 :            : 
    2141                 :          0 : void SdrObjCustomShape::DragCreateObject( SdrDragStat& rStat )
    2142                 :            : {
    2143         [ #  # ]:          0 :     Rectangle aRect1;
    2144         [ #  # ]:          0 :     rStat.TakeCreateRect( aRect1 );
    2145                 :            : 
    2146         [ #  # ]:          0 :     std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
    2147                 :            : 
    2148                 :          0 :     sal_uInt32 nDefaultObjectSizeWidth = 3000;      // default width from SDOptions ?
    2149                 :          0 :     sal_uInt32 nDefaultObjectSizeHeight= 3000;
    2150                 :            : 
    2151 [ #  # ][ #  # ]:          0 :     if ( ImpVerticalSwitch( *this ) )
    2152                 :            :     {
    2153         [ #  # ]:          0 :         SetMirroredX( aRect1.Left() > aRect1.Right() );
    2154                 :            : 
    2155 [ #  # ][ #  # ]:          0 :         aRect1 = Rectangle( rStat.GetNow(), Size( nDefaultObjectSizeWidth, nDefaultObjectSizeHeight ) );
    2156                 :            :         // subtracting the horizontal difference of the latest handle from shape position
    2157         [ #  # ]:          0 :         if ( !aInteractionHandles.empty() )
    2158                 :            :         {
    2159 [ #  # ][ #  # ]:          0 :             sal_Int32 nHandlePos = aInteractionHandles[ aInteractionHandles.size() - 1 ].xInteraction->getPosition().X;
    2160         [ #  # ]:          0 :             aRect1.Move( aRect.Left() - nHandlePos, 0 );
    2161                 :            :         }
    2162                 :            :     }
    2163         [ #  # ]:          0 :     ImpJustifyRect( aRect1 );
    2164                 :          0 :     rStat.SetActionRect( aRect1 );
    2165                 :          0 :     aRect = aRect1;
    2166         [ #  # ]:          0 :     SetRectsDirty();
    2167                 :            : 
    2168                 :          0 :     std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
    2169 [ #  # ][ #  # ]:          0 :     while ( aIter != aInteractionHandles.end() )
    2170                 :            :     {
    2171                 :            :         try
    2172                 :            :         {
    2173         [ #  # ]:          0 :             if ( aIter->nMode & CUSTOMSHAPE_HANDLE_CREATE_FIXED )
    2174 [ #  # ][ #  # ]:          0 :                 aIter->xInteraction->setControllerPosition( awt::Point( rStat.GetStart().X(), rStat.GetStart().Y() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    2175                 :            :         }
    2176         [ #  # ]:          0 :         catch ( const uno::RuntimeException& )
    2177                 :            :         {
    2178                 :            :         }
    2179         [ #  # ]:          0 :         aIter++;
    2180                 :            :     }
    2181                 :            : 
    2182         [ #  # ]:          0 :     SetBoundRectDirty();
    2183                 :          0 :     bSnapRectDirty=sal_True;
    2184                 :          0 : }
    2185                 :            : 
    2186                 :          0 : bool SdrObjCustomShape::BegCreate( SdrDragStat& rDrag )
    2187                 :            : {
    2188                 :          0 :     return SdrTextObj::BegCreate( rDrag );
    2189                 :            : }
    2190                 :            : 
    2191                 :          0 : bool SdrObjCustomShape::MovCreate(SdrDragStat& rStat)
    2192                 :            : {
    2193                 :          0 :     SdrView* pView = rStat.GetView();       // #i37448#
    2194 [ #  # ][ #  # ]:          0 :     if( pView && pView->IsSolidDragging() )
                 [ #  # ]
    2195                 :            :     {
    2196                 :          0 :         InvalidateRenderGeometry();
    2197                 :            :     }
    2198                 :          0 :     DragCreateObject( rStat );
    2199                 :          0 :     SetRectsDirty();
    2200                 :          0 :     return sal_True;
    2201                 :            : }
    2202                 :            : 
    2203                 :          0 : bool SdrObjCustomShape::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd )
    2204                 :            : {
    2205                 :          0 :     DragCreateObject( rStat );
    2206                 :            : 
    2207         [ #  # ]:          0 :     if ( bTextFrame )
    2208                 :            :     {
    2209         [ #  # ]:          0 :         if ( IsAutoGrowHeight() )
    2210                 :            :         {
    2211                 :            :             // MinTextHeight
    2212                 :          0 :             long nHgt=aRect.GetHeight()-1;
    2213         [ #  # ]:          0 :             if (nHgt==1) nHgt=0;
    2214                 :          0 :             NbcSetMinTextFrameHeight( nHgt );
    2215                 :            :         }
    2216         [ #  # ]:          0 :         if ( IsAutoGrowWidth() )
    2217                 :            :         {
    2218                 :            :             // MinTextWidth
    2219                 :          0 :             long nWdt=aRect.GetWidth()-1;
    2220         [ #  # ]:          0 :             if (nWdt==1) nWdt=0;
    2221                 :          0 :             NbcSetMinTextFrameWidth( nWdt );
    2222                 :            :         }
    2223                 :            :         // re-calculate text frame
    2224                 :          0 :         NbcAdjustTextFrameWidthAndHeight();
    2225                 :            :     }
    2226                 :          0 :     SetRectsDirty();
    2227 [ #  # ][ #  # ]:          0 :     return ( eCmd == SDRCREATE_FORCEEND || rStat.GetPointAnz() >= 2 );
    2228                 :            : }
    2229                 :            : 
    2230                 :          0 : basegfx::B2DPolyPolygon SdrObjCustomShape::TakeCreatePoly(const SdrDragStat& /*rDrag*/) const
    2231                 :            : {
    2232                 :          0 :     return GetLineGeometry( this, sal_False );
    2233                 :            : }
    2234                 :            : 
    2235                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2236                 :            : 
    2237                 :            : // in context with the SdrObjCustomShape the SdrTextAutoGrowHeightItem == true -> Resize Shape to fit text,
    2238                 :            : //                                     the SdrTextAutoGrowWidthItem  == true -> Word wrap text in Shape
    2239                 :         33 : bool SdrObjCustomShape::IsAutoGrowHeight() const
    2240                 :            : {
    2241                 :         33 :     const SfxItemSet& rSet = GetMergedItemSet();
    2242                 :         33 :     bool bIsAutoGrowHeight = ((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT))).GetValue();
    2243 [ -  + ][ -  + ]:         33 :     if ( bIsAutoGrowHeight && IsVerticalWriting() )
                 [ +  - ]
    2244                 :          0 :         bIsAutoGrowHeight = ((SdrTextWordWrapItem&)(rSet.Get(SDRATTR_TEXT_WORDWRAP))).GetValue() == sal_False;
    2245                 :         33 :     return bIsAutoGrowHeight;
    2246                 :            : }
    2247                 :         36 : bool SdrObjCustomShape::IsAutoGrowWidth() const
    2248                 :            : {
    2249                 :         36 :     const SfxItemSet& rSet = GetMergedItemSet();
    2250                 :         36 :     bool bIsAutoGrowWidth = ((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT))).GetValue();
    2251 [ #  # ][ -  + ]:         36 :     if ( bIsAutoGrowWidth && !IsVerticalWriting() )
                 [ -  + ]
    2252                 :          0 :         bIsAutoGrowWidth = ((SdrTextWordWrapItem&)(rSet.Get(SDRATTR_TEXT_WORDWRAP))).GetValue() == sal_False;
    2253                 :         36 :     return bIsAutoGrowWidth;
    2254                 :            : }
    2255                 :            : 
    2256                 :            : /* The following method is identical to the SdrTextObj::SetVerticalWriting method, the only difference
    2257                 :            :    is that the SdrAutoGrowWidthItem and SdrAutoGrowHeightItem are not exchanged if the vertical writing
    2258                 :            :    mode has been changed */
    2259                 :            : 
    2260                 :        216 : void SdrObjCustomShape::SetVerticalWriting( sal_Bool bVertical )
    2261                 :            : {
    2262                 :        216 :     ForceOutlinerParaObject();
    2263                 :            : 
    2264                 :        216 :     OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
    2265                 :            : 
    2266                 :            :     DBG_ASSERT( pOutlinerParaObject, "SdrTextObj::SetVerticalWriting() without OutlinerParaObject!" );
    2267                 :            : 
    2268         [ +  - ]:        216 :     if( pOutlinerParaObject )
    2269                 :            :     {
    2270         [ -  + ]:        216 :         if(pOutlinerParaObject->IsVertical() != (bool)bVertical)
    2271                 :            :         {
    2272                 :            :             // get item settings
    2273         [ #  # ]:          0 :             const SfxItemSet& rSet = GetObjectItemSet();
    2274                 :            : 
    2275                 :            :             // Also exchange horizontal and vertical adjust items
    2276         [ #  # ]:          0 :             SdrTextHorzAdjust eHorz = ((SdrTextHorzAdjustItem&)(rSet.Get(SDRATTR_TEXT_HORZADJUST))).GetValue();
    2277         [ #  # ]:          0 :             SdrTextVertAdjust eVert = ((SdrTextVertAdjustItem&)(rSet.Get(SDRATTR_TEXT_VERTADJUST))).GetValue();
    2278                 :            : 
    2279                 :            :             // rescue object size
    2280         [ #  # ]:          0 :             Rectangle aObjectRect = GetSnapRect();
    2281                 :            : 
    2282                 :            :             // prepare ItemSet to set exchanged width and height items
    2283                 :          0 :             SfxItemSet aNewSet(*rSet.GetPool(),
    2284                 :            :                 SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
    2285                 :            :                 // Expanded item ranges to also support horizontal and vertical adjust.
    2286                 :            :                 SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST,
    2287                 :            :                 SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST,
    2288         [ #  # ]:          0 :                 0, 0);
    2289                 :            : 
    2290         [ #  # ]:          0 :             aNewSet.Put(rSet);
    2291                 :            : 
    2292                 :            :             // Exchange horizontal and vertical adjusts
    2293   [ #  #  #  #  :          0 :             switch(eVert)
                      # ]
    2294                 :            :             {
    2295 [ #  # ][ #  # ]:          0 :                 case SDRTEXTVERTADJUST_TOP: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); break;
                 [ #  # ]
    2296 [ #  # ][ #  # ]:          0 :                 case SDRTEXTVERTADJUST_CENTER: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); break;
                 [ #  # ]
    2297 [ #  # ][ #  # ]:          0 :                 case SDRTEXTVERTADJUST_BOTTOM: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); break;
                 [ #  # ]
    2298 [ #  # ][ #  # ]:          0 :                 case SDRTEXTVERTADJUST_BLOCK: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK)); break;
                 [ #  # ]
    2299                 :            :             }
    2300   [ #  #  #  #  :          0 :             switch(eHorz)
                      # ]
    2301                 :            :             {
    2302 [ #  # ][ #  # ]:          0 :                 case SDRTEXTHORZADJUST_LEFT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM)); break;
                 [ #  # ]
    2303 [ #  # ][ #  # ]:          0 :                 case SDRTEXTHORZADJUST_CENTER: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); break;
                 [ #  # ]
    2304 [ #  # ][ #  # ]:          0 :                 case SDRTEXTHORZADJUST_RIGHT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); break;
                 [ #  # ]
    2305 [ #  # ][ #  # ]:          0 :                 case SDRTEXTHORZADJUST_BLOCK: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK)); break;
                 [ #  # ]
    2306                 :            :             }
    2307                 :            : 
    2308         [ #  # ]:          0 :             SetObjectItemSet( aNewSet );
    2309         [ #  # ]:          0 :             pOutlinerParaObject = GetOutlinerParaObject();
    2310         [ #  # ]:          0 :             if ( pOutlinerParaObject )
    2311         [ #  # ]:          0 :                 pOutlinerParaObject->SetVertical(bVertical);
    2312                 :            : 
    2313                 :            :             // restore object size
    2314 [ #  # ][ #  # ]:          0 :             SetSnapRect(aObjectRect);
    2315                 :            :         }
    2316                 :            :     }
    2317                 :        216 : }
    2318                 :       2361 : bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt, bool bWdt) const
    2319                 :            : {
    2320 [ +  - ][ -  + ]:       2361 :      if ( pModel && HasText() && !rR.IsEmpty() )
         [ #  # ][ -  + ]
    2321                 :            :     {
    2322 [ #  # ][ #  # ]:          0 :         bool bWdtGrow=bWdt && IsAutoGrowWidth();
    2323 [ #  # ][ #  # ]:          0 :         bool bHgtGrow=bHgt && IsAutoGrowHeight();
    2324 [ #  # ][ #  # ]:          0 :         if ( bWdtGrow || bHgtGrow )
    2325                 :            :         {
    2326                 :          0 :             Rectangle aR0(rR);
    2327                 :          0 :             long nHgt=0,nMinHgt=0,nMaxHgt=0;
    2328                 :          0 :             long nWdt=0,nMinWdt=0,nMaxWdt=0;
    2329         [ #  # ]:          0 :             Size aSiz(rR.GetSize()); aSiz.Width()--; aSiz.Height()--;
    2330                 :          0 :             Size aMaxSiz(100000,100000);
    2331                 :          0 :             Size aTmpSiz(pModel->GetMaxObjSize());
    2332         [ #  # ]:          0 :             if (aTmpSiz.Width()!=0) aMaxSiz.Width()=aTmpSiz.Width();
    2333         [ #  # ]:          0 :             if (aTmpSiz.Height()!=0) aMaxSiz.Height()=aTmpSiz.Height();
    2334         [ #  # ]:          0 :             if (bWdtGrow)
    2335                 :            :             {
    2336         [ #  # ]:          0 :                 nMinWdt=GetMinTextFrameWidth();
    2337         [ #  # ]:          0 :                 nMaxWdt=GetMaxTextFrameWidth();
    2338 [ #  # ][ #  # ]:          0 :                 if (nMaxWdt==0 || nMaxWdt>aMaxSiz.Width()) nMaxWdt=aMaxSiz.Width();
                 [ #  # ]
    2339         [ #  # ]:          0 :                 if (nMinWdt<=0) nMinWdt=1;
    2340                 :          0 :                 aSiz.Width()=nMaxWdt;
    2341                 :            :             }
    2342         [ #  # ]:          0 :             if (bHgtGrow)
    2343                 :            :             {
    2344         [ #  # ]:          0 :                 nMinHgt=GetMinTextFrameHeight();
    2345         [ #  # ]:          0 :                 nMaxHgt=GetMaxTextFrameHeight();
    2346 [ #  # ][ #  # ]:          0 :                 if (nMaxHgt==0 || nMaxHgt>aMaxSiz.Height()) nMaxHgt=aMaxSiz.Height();
                 [ #  # ]
    2347         [ #  # ]:          0 :                 if (nMinHgt<=0) nMinHgt=1;
    2348                 :          0 :                 aSiz.Height()=nMaxHgt;
    2349                 :            :             }
    2350 [ #  # ][ #  # ]:          0 :             long nHDist=GetTextLeftDistance()+GetTextRightDistance();
    2351 [ #  # ][ #  # ]:          0 :             long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
    2352                 :          0 :             aSiz.Width()-=nHDist;
    2353                 :          0 :             aSiz.Height()-=nVDist;
    2354         [ #  # ]:          0 :             if ( aSiz.Width() < 2 )
    2355                 :          0 :                 aSiz.Width() = 2;   // minimum size=2
    2356         [ #  # ]:          0 :             if ( aSiz.Height() < 2 )
    2357                 :          0 :                 aSiz.Height() = 2; // minimum size=2
    2358                 :            : 
    2359         [ #  # ]:          0 :             if(pEdtOutl)
    2360                 :            :             {
    2361         [ #  # ]:          0 :                 pEdtOutl->SetMaxAutoPaperSize( aSiz );
    2362         [ #  # ]:          0 :                 if (bWdtGrow)
    2363                 :            :                 {
    2364         [ #  # ]:          0 :                     Size aSiz2(pEdtOutl->CalcTextSize());
    2365                 :          0 :                     nWdt=aSiz2.Width()+1; // a little more tolerance
    2366         [ #  # ]:          0 :                     if (bHgtGrow) nHgt=aSiz2.Height()+1; // a little more tolerance
    2367                 :            :                 } else
    2368                 :            :                 {
    2369         [ #  # ]:          0 :                     nHgt=pEdtOutl->GetTextHeight()+1; // a little more tolerance
    2370                 :            :                 }
    2371                 :            :             }
    2372                 :            :             else
    2373                 :            :             {
    2374         [ #  # ]:          0 :                 Outliner& rOutliner=ImpGetDrawOutliner();
    2375         [ #  # ]:          0 :                 rOutliner.SetPaperSize(aSiz);
    2376         [ #  # ]:          0 :                 rOutliner.SetUpdateMode(sal_True);
    2377                 :            :                 // TODO: add the optimization with bPortionInfoChecked again.
    2378         [ #  # ]:          0 :                 OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
    2379         [ #  # ]:          0 :                 if( pOutlinerParaObject != NULL )
    2380                 :            :                 {
    2381         [ #  # ]:          0 :                     rOutliner.SetText(*pOutlinerParaObject);
    2382 [ #  # ][ #  # ]:          0 :                     rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
    2383                 :            :                 }
    2384         [ #  # ]:          0 :                 if ( bWdtGrow )
    2385                 :            :                 {
    2386         [ #  # ]:          0 :                     Size aSiz2(rOutliner.CalcTextSize());
    2387                 :          0 :                     nWdt=aSiz2.Width()+1; // a little more tolerance
    2388         [ #  # ]:          0 :                     if ( bHgtGrow )
    2389                 :          0 :                         nHgt=aSiz2.Height()+1; // a little more tolerance
    2390                 :            :                 }
    2391                 :            :                 else
    2392         [ #  # ]:          0 :                     nHgt = rOutliner.GetTextHeight()+1; // a little more tolerance
    2393         [ #  # ]:          0 :                 rOutliner.Clear();
    2394                 :            :             }
    2395         [ #  # ]:          0 :             if ( nWdt < nMinWdt )
    2396                 :          0 :                 nWdt = nMinWdt;
    2397         [ #  # ]:          0 :             if ( nWdt > nMaxWdt )
    2398                 :          0 :                 nWdt = nMaxWdt;
    2399                 :          0 :             nWdt += nHDist;
    2400         [ #  # ]:          0 :             if ( nWdt < 1 )
    2401                 :          0 :                 nWdt = 1; // nHDist may also be negative
    2402         [ #  # ]:          0 :             if ( nHgt < nMinHgt )
    2403                 :          0 :                 nHgt = nMinHgt;
    2404         [ #  # ]:          0 :             if ( nHgt > nMaxHgt )
    2405                 :          0 :                 nHgt = nMaxHgt;
    2406                 :          0 :             nHgt+=nVDist;
    2407         [ #  # ]:          0 :             if ( nHgt < 1 )
    2408                 :          0 :                 nHgt = 1; // nVDist may also be negative
    2409                 :          0 :             long nWdtGrow = nWdt-(rR.Right()-rR.Left());
    2410                 :          0 :             long nHgtGrow = nHgt-(rR.Bottom()-rR.Top());
    2411         [ #  # ]:          0 :             if ( nWdtGrow == 0 )
    2412                 :          0 :                 bWdtGrow = sal_False;
    2413         [ #  # ]:          0 :             if ( nHgtGrow == 0 )
    2414                 :          0 :                 bHgtGrow=sal_False;
    2415 [ #  # ][ #  # ]:          0 :             if ( bWdtGrow || bHgtGrow )
    2416                 :            :             {
    2417         [ #  # ]:          0 :                 if ( bWdtGrow )
    2418                 :            :                 {
    2419         [ #  # ]:          0 :                     SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust();
    2420         [ #  # ]:          0 :                     if ( eHAdj == SDRTEXTHORZADJUST_LEFT )
    2421                 :          0 :                         rR.Right()+=nWdtGrow;
    2422         [ #  # ]:          0 :                     else if ( eHAdj == SDRTEXTHORZADJUST_RIGHT )
    2423                 :          0 :                         rR.Left()-=nWdtGrow;
    2424                 :            :                     else
    2425                 :            :                     {
    2426                 :          0 :                         long nWdtGrow2=nWdtGrow/2;
    2427                 :          0 :                         rR.Left()-=nWdtGrow2;
    2428                 :          0 :                         rR.Right()=rR.Left()+nWdt;
    2429                 :            :                     }
    2430                 :            :                 }
    2431         [ #  # ]:          0 :                 if ( bHgtGrow )
    2432                 :            :                 {
    2433         [ #  # ]:          0 :                     SdrTextVertAdjust eVAdj=GetTextVerticalAdjust();
    2434         [ #  # ]:          0 :                     if ( eVAdj == SDRTEXTVERTADJUST_TOP )
    2435                 :          0 :                         rR.Bottom()+=nHgtGrow;
    2436         [ #  # ]:          0 :                     else if ( eVAdj == SDRTEXTVERTADJUST_BOTTOM )
    2437                 :          0 :                         rR.Top()-=nHgtGrow;
    2438                 :            :                     else
    2439                 :            :                     {
    2440                 :          0 :                         long nHgtGrow2=nHgtGrow/2;
    2441                 :          0 :                         rR.Top()-=nHgtGrow2;
    2442                 :          0 :                         rR.Bottom()=rR.Top()+nHgt;
    2443                 :            :                     }
    2444                 :            :                 }
    2445         [ #  # ]:          0 :                 if ( aGeo.nDrehWink )
    2446                 :            :                 {
    2447                 :          0 :                     Point aD1(rR.TopLeft());
    2448                 :          0 :                     aD1-=aR0.TopLeft();
    2449                 :          0 :                     Point aD2(aD1);
    2450                 :          0 :                     RotatePoint(aD2,Point(),aGeo.nSin,aGeo.nCos);
    2451                 :          0 :                     aD2-=aD1;
    2452         [ #  # ]:          0 :                     rR.Move(aD2.X(),aD2.Y());
    2453                 :            :                 }
    2454                 :          0 :                 return sal_True;
    2455                 :            :             }
    2456                 :            :         }
    2457                 :            :     }
    2458                 :       2361 :     return sal_False;
    2459                 :            : }
    2460                 :            : 
    2461                 :       2361 : Rectangle SdrObjCustomShape::ImpCalculateTextFrame( const bool bHgt, const bool bWdt )
    2462                 :            : {
    2463         [ +  - ]:       2361 :     Rectangle aReturnValue;
    2464                 :            : 
    2465                 :       2361 :     Rectangle aOldTextRect( aRect );        // <- initial text rectangle
    2466                 :            : 
    2467                 :       2361 :     Rectangle aNewTextRect( aRect );        // <- new text rectangle returned from the custom shape renderer,
    2468         [ +  - ]:       2361 :     GetTextBounds( aNewTextRect );          //    it depends to the current logical shape size
    2469                 :            : 
    2470                 :       2361 :     Rectangle aAdjustedTextRect( aNewTextRect );                            // <- new text rectangle is being tested by AdjustTextFrameWidthAndHeight to ensure
    2471 [ +  - ][ -  + ]:       2361 :     if ( AdjustTextFrameWidthAndHeight( aAdjustedTextRect, bHgt, bWdt ) )   //    that the new text rectangle is matching the current text size from the outliner
    2472                 :            :     {
    2473 [ #  # ][ #  # ]:          0 :         if ( ( aAdjustedTextRect != aNewTextRect ) && ( aOldTextRect != aAdjustedTextRect ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    2474                 :            :         {
    2475                 :          0 :             aReturnValue = aRect;
    2476 [ #  # ][ #  # ]:          0 :             double fXScale = (double)aOldTextRect.GetWidth() / (double)aNewTextRect.GetWidth();
    2477 [ #  # ][ #  # ]:          0 :             double fYScale = (double)aOldTextRect.GetHeight() / (double)aNewTextRect.GetHeight();
    2478                 :          0 :             double fRightDiff = (double)( aAdjustedTextRect.Right() - aNewTextRect.Right() ) * fXScale;
    2479                 :          0 :             double fLeftDiff  = (double)( aAdjustedTextRect.Left()  - aNewTextRect.Left()  ) * fXScale;
    2480                 :          0 :             double fTopDiff   = (double)( aAdjustedTextRect.Top()   - aNewTextRect.Top()   ) * fYScale;
    2481                 :          0 :             double fBottomDiff= (double)( aAdjustedTextRect.Bottom()- aNewTextRect.Bottom()) * fYScale;
    2482                 :          0 :             aReturnValue.Left() += (sal_Int32)fLeftDiff;
    2483                 :          0 :             aReturnValue.Right() += (sal_Int32)fRightDiff;
    2484                 :          0 :             aReturnValue.Top() += (sal_Int32)fTopDiff;
    2485                 :       2361 :             aReturnValue.Bottom() += (sal_Int32)fBottomDiff;
    2486                 :            :         }
    2487                 :            :     }
    2488                 :       2361 :     return aReturnValue;
    2489                 :            : }
    2490                 :            : 
    2491                 :       2361 : bool SdrObjCustomShape::NbcAdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
    2492                 :            : {
    2493         [ +  - ]:       2361 :     Rectangle aNewTextRect = ImpCalculateTextFrame( bHgt, bWdt );
    2494 [ +  - ][ -  + ]:       2361 :     sal_Bool bRet = !aNewTextRect.IsEmpty() && ( aNewTextRect != aRect );
         [ #  # ][ #  # ]
    2495         [ -  + ]:       2361 :     if ( bRet )
    2496                 :            :     {
    2497                 :            :         // taking care of handles that should not been changed
    2498         [ #  # ]:          0 :         std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
    2499                 :            : 
    2500                 :          0 :         aRect = aNewTextRect;
    2501         [ #  # ]:          0 :         SetRectsDirty();
    2502         [ #  # ]:          0 :         SetChanged();
    2503                 :            : 
    2504                 :          0 :         std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
    2505 [ #  # ][ #  # ]:          0 :         while ( aIter != aInteractionHandles.end() )
    2506                 :            :         {
    2507                 :            :             try
    2508                 :            :             {
    2509         [ #  # ]:          0 :                 if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
    2510 [ #  # ][ #  # ]:          0 :                     aIter->xInteraction->setControllerPosition( aIter->aPosition );
    2511                 :            :             }
    2512         [ #  # ]:          0 :             catch ( const uno::RuntimeException& )
    2513                 :            :             {
    2514                 :            :             }
    2515         [ #  # ]:          0 :             aIter++;
    2516                 :            :         }
    2517         [ #  # ]:          0 :         InvalidateRenderGeometry();
    2518                 :            :     }
    2519         [ #  # ]:       2361 :     return bRet;
    2520                 :            : }
    2521                 :          0 : bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
    2522                 :            : {
    2523         [ #  # ]:          0 :     Rectangle aNewTextRect = ImpCalculateTextFrame( bHgt, bWdt );
    2524 [ #  # ][ #  # ]:          0 :     sal_Bool bRet = !aNewTextRect.IsEmpty() && ( aNewTextRect != aRect );
         [ #  # ][ #  # ]
    2525         [ #  # ]:          0 :     if ( bRet )
    2526                 :            :     {
    2527         [ #  # ]:          0 :         Rectangle aBoundRect0;
    2528         [ #  # ]:          0 :         if ( pUserCall )
    2529         [ #  # ]:          0 :             aBoundRect0 = GetCurrentBoundRect();
    2530                 :            : 
    2531                 :            :         // taking care of handles that should not been changed
    2532         [ #  # ]:          0 :         std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
    2533                 :            : 
    2534                 :          0 :         aRect = aNewTextRect;
    2535         [ #  # ]:          0 :         SetRectsDirty();
    2536                 :            : 
    2537                 :          0 :         std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
    2538 [ #  # ][ #  # ]:          0 :         while ( aIter != aInteractionHandles.end() )
    2539                 :            :         {
    2540                 :            :             try
    2541                 :            :             {
    2542         [ #  # ]:          0 :                 if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
    2543 [ #  # ][ #  # ]:          0 :                     aIter->xInteraction->setControllerPosition( aIter->aPosition );
    2544                 :            :             }
    2545         [ #  # ]:          0 :             catch ( const uno::RuntimeException& )
    2546                 :            :             {
    2547                 :            :             }
    2548         [ #  # ]:          0 :             aIter++;
    2549                 :            :         }
    2550                 :            : 
    2551         [ #  # ]:          0 :         InvalidateRenderGeometry();
    2552         [ #  # ]:          0 :         SetChanged();
    2553         [ #  # ]:          0 :         BroadcastObjectChange();
    2554         [ #  # ]:          0 :         SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    2555                 :            :     }
    2556         [ #  # ]:          0 :     return bRet;
    2557                 :            : }
    2558                 :          0 : sal_Bool SdrObjCustomShape::BegTextEdit( SdrOutliner& rOutl )
    2559                 :            : {
    2560                 :          0 :     return SdrTextObj::BegTextEdit( rOutl );
    2561                 :            : }
    2562                 :          0 : void SdrObjCustomShape::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const
    2563                 :            : {
    2564                 :          0 :     Size aPaperMin,aPaperMax;
    2565         [ #  # ]:          0 :     Rectangle aViewInit;
    2566         [ #  # ]:          0 :     TakeTextAnchorRect( aViewInit );
    2567         [ #  # ]:          0 :     if ( aGeo.nDrehWink )
    2568                 :            :     {
    2569         [ #  # ]:          0 :         Point aCenter(aViewInit.Center());
    2570                 :          0 :         aCenter-=aViewInit.TopLeft();
    2571                 :          0 :         Point aCenter0(aCenter);
    2572                 :          0 :         RotatePoint(aCenter,Point(),aGeo.nSin,aGeo.nCos);
    2573                 :          0 :         aCenter-=aCenter0;
    2574         [ #  # ]:          0 :         aViewInit.Move(aCenter.X(),aCenter.Y());
    2575                 :            :     }
    2576         [ #  # ]:          0 :     Size aAnkSiz(aViewInit.GetSize());
    2577                 :          0 :     aAnkSiz.Width()--; aAnkSiz.Height()--; // because GetSize() adds 1
    2578                 :          0 :     Size aMaxSiz(1000000,1000000);
    2579         [ #  # ]:          0 :     if (pModel!=NULL) {
    2580                 :          0 :         Size aTmpSiz(pModel->GetMaxObjSize());
    2581         [ #  # ]:          0 :         if (aTmpSiz.Width()!=0) aMaxSiz.Width()=aTmpSiz.Width();
    2582         [ #  # ]:          0 :         if (aTmpSiz.Height()!=0) aMaxSiz.Height()=aTmpSiz.Height();
    2583                 :            :     }
    2584         [ #  # ]:          0 :     SdrTextHorzAdjust eHAdj(GetTextHorizontalAdjust());
    2585         [ #  # ]:          0 :     SdrTextVertAdjust eVAdj(GetTextVerticalAdjust());
    2586                 :            : 
    2587         [ #  # ]:          0 :     long nMinWdt = GetMinTextFrameWidth();
    2588         [ #  # ]:          0 :     long nMinHgt = GetMinTextFrameHeight();
    2589         [ #  # ]:          0 :     long nMaxWdt = GetMaxTextFrameWidth();
    2590         [ #  # ]:          0 :     long nMaxHgt = GetMaxTextFrameHeight();
    2591         [ #  # ]:          0 :     if (nMinWdt<1) nMinWdt=1;
    2592         [ #  # ]:          0 :     if (nMinHgt<1) nMinHgt=1;
    2593 [ #  # ][ #  # ]:          0 :     if ( nMaxWdt == 0 || nMaxWdt > aMaxSiz.Width() )
                 [ #  # ]
    2594                 :          0 :         nMaxWdt = aMaxSiz.Width();
    2595 [ #  # ][ #  # ]:          0 :     if ( nMaxHgt == 0 || nMaxHgt > aMaxSiz.Height() )
                 [ #  # ]
    2596                 :          0 :         nMaxHgt=aMaxSiz.Height();
    2597                 :            : 
    2598 [ #  # ][ #  # ]:          0 :     if (((SdrTextWordWrapItem&)(GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue())
    2599                 :            :     {
    2600 [ #  # ][ #  # ]:          0 :         if ( IsVerticalWriting() )
    2601                 :            :         {
    2602                 :          0 :             nMaxHgt = aAnkSiz.Height();
    2603                 :          0 :             nMinHgt = nMaxHgt;
    2604                 :            :         }
    2605                 :            :         else
    2606                 :            :         {
    2607                 :          0 :             nMaxWdt = aAnkSiz.Width();
    2608                 :          0 :             nMinWdt = nMaxWdt;
    2609                 :            :         }
    2610                 :            :     }
    2611                 :          0 :     aPaperMax.Width()=nMaxWdt;
    2612                 :          0 :     aPaperMax.Height()=nMaxHgt;
    2613                 :            : 
    2614                 :          0 :     aPaperMin.Width()=nMinWdt;
    2615                 :          0 :     aPaperMin.Height()=nMinHgt;
    2616                 :            : 
    2617         [ #  # ]:          0 :     if ( pViewMin )
    2618                 :            :     {
    2619                 :          0 :         *pViewMin = aViewInit;
    2620                 :            : 
    2621                 :          0 :         long nXFree = aAnkSiz.Width() - aPaperMin.Width();
    2622         [ #  # ]:          0 :         if ( eHAdj == SDRTEXTHORZADJUST_LEFT )
    2623                 :          0 :             pViewMin->Right() -= nXFree;
    2624         [ #  # ]:          0 :         else if ( eHAdj == SDRTEXTHORZADJUST_RIGHT )
    2625                 :          0 :             pViewMin->Left() += nXFree;
    2626                 :          0 :         else { pViewMin->Left() += nXFree / 2; pViewMin->Right() = pViewMin->Left() + aPaperMin.Width(); }
    2627                 :            : 
    2628                 :          0 :         long nYFree = aAnkSiz.Height() - aPaperMin.Height();
    2629         [ #  # ]:          0 :         if ( eVAdj == SDRTEXTVERTADJUST_TOP )
    2630                 :          0 :             pViewMin->Bottom() -= nYFree;
    2631         [ #  # ]:          0 :         else if ( eVAdj == SDRTEXTVERTADJUST_BOTTOM )
    2632                 :          0 :             pViewMin->Top() += nYFree;
    2633                 :          0 :         else { pViewMin->Top() += nYFree / 2; pViewMin->Bottom() = pViewMin->Top() + aPaperMin.Height(); }
    2634                 :            :     }
    2635                 :            : 
    2636 [ #  # ][ #  # ]:          0 :     if( IsVerticalWriting() )
    2637                 :          0 :         aPaperMin.Width() = 0;
    2638                 :            :     else
    2639                 :          0 :         aPaperMin.Height() = 0;
    2640                 :            : 
    2641         [ #  # ]:          0 :     if( eHAdj != SDRTEXTHORZADJUST_BLOCK )
    2642                 :          0 :         aPaperMin.Width()=0;
    2643                 :            : 
    2644                 :            :     // For complete vertical adjust support, set paper min height to 0, here.
    2645         [ #  # ]:          0 :     if(SDRTEXTVERTADJUST_BLOCK != eVAdj )
    2646                 :          0 :         aPaperMin.Height() = 0;
    2647                 :            : 
    2648         [ #  # ]:          0 :     if (pPaperMin!=NULL) *pPaperMin=aPaperMin;
    2649         [ #  # ]:          0 :     if (pPaperMax!=NULL) *pPaperMax=aPaperMax;
    2650         [ #  # ]:          0 :     if (pViewInit!=NULL) *pViewInit=aViewInit;
    2651                 :          0 : }
    2652                 :          0 : void SdrObjCustomShape::EndTextEdit( SdrOutliner& rOutl )
    2653                 :            : {
    2654                 :          0 :     SdrTextObj::EndTextEdit( rOutl );
    2655                 :          0 :     InvalidateRenderGeometry();
    2656                 :          0 : }
    2657                 :          0 : void SdrObjCustomShape::TakeTextAnchorRect( Rectangle& rAnchorRect ) const
    2658                 :            : {
    2659         [ #  # ]:          0 :     if ( GetTextBounds( rAnchorRect ) )
    2660                 :            :     {
    2661         [ #  # ]:          0 :         Point aRotateRef( maSnapRect.Center() );
    2662         [ #  # ]:          0 :         rAnchorRect.Left()   += GetTextLeftDistance();
    2663         [ #  # ]:          0 :         rAnchorRect.Top()    += GetTextUpperDistance();
    2664         [ #  # ]:          0 :         rAnchorRect.Right()  -= GetTextRightDistance();
    2665         [ #  # ]:          0 :         rAnchorRect.Bottom() -= GetTextLowerDistance();
    2666         [ #  # ]:          0 :         ImpJustifyRect( rAnchorRect );
    2667                 :            : 
    2668 [ #  # ][ #  # ]:          0 :         if ( rAnchorRect.GetWidth() < 2 )
    2669                 :          0 :             rAnchorRect.Right() = rAnchorRect.Left() + 1;   // minimal width is 2
    2670 [ #  # ][ #  # ]:          0 :         if ( rAnchorRect.GetHeight() < 2 )
    2671                 :          0 :             rAnchorRect.Bottom() = rAnchorRect.Top() + 1;   // minimal height is 2
    2672         [ #  # ]:          0 :         if ( aGeo.nDrehWink )
    2673                 :            :         {
    2674                 :          0 :             Point aP( rAnchorRect.TopLeft() );
    2675                 :          0 :             RotatePoint( aP, aRotateRef, aGeo.nSin, aGeo. nCos );
    2676                 :          0 :             rAnchorRect.SetPos( aP );
    2677                 :            :         }
    2678                 :            :     }
    2679                 :            :     else
    2680                 :          0 :         SdrTextObj::TakeTextAnchorRect( rAnchorRect );
    2681                 :          0 : }
    2682                 :          0 : void SdrObjCustomShape::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, bool bNoEditText,
    2683                 :            :                                Rectangle* pAnchorRect, bool /*bLineWidth*/) const
    2684                 :            : {
    2685         [ #  # ]:          0 :     Rectangle aAnkRect; // Rect in which we anchor
    2686         [ #  # ]:          0 :     TakeTextAnchorRect(aAnkRect);
    2687         [ #  # ]:          0 :     SdrTextVertAdjust eVAdj=GetTextVerticalAdjust();
    2688         [ #  # ]:          0 :     SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust();
    2689         [ #  # ]:          0 :     sal_uIntPtr nStat0=rOutliner.GetControlWord();
    2690                 :          0 :     Size aNullSize;
    2691                 :            : 
    2692         [ #  # ]:          0 :     rOutliner.SetControlWord(nStat0|EE_CNTRL_AUTOPAGESIZE);
    2693         [ #  # ]:          0 :     rOutliner.SetMinAutoPaperSize(aNullSize);
    2694                 :          0 :     sal_Int32 nMaxAutoPaperWidth = 1000000;
    2695                 :          0 :     sal_Int32 nMaxAutoPaperHeight= 1000000;
    2696                 :            : 
    2697         [ #  # ]:          0 :     long nAnkWdt=aAnkRect.GetWidth();
    2698         [ #  # ]:          0 :     long nAnkHgt=aAnkRect.GetHeight();
    2699                 :            : 
    2700 [ #  # ][ #  # ]:          0 :     if (((SdrTextWordWrapItem&)(GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue())
    2701                 :            :     {
    2702 [ #  # ][ #  # ]:          0 :         if ( IsVerticalWriting() )
    2703                 :          0 :             nMaxAutoPaperHeight = nAnkHgt;
    2704                 :            :         else
    2705                 :          0 :             nMaxAutoPaperWidth = nAnkWdt;
    2706                 :            :     }
    2707 [ #  # ][ #  # ]:          0 :     if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting())
         [ #  # ][ #  # ]
    2708                 :            :     {
    2709         [ #  # ]:          0 :         rOutliner.SetMinAutoPaperSize(Size(nAnkWdt, 0));
    2710                 :            :     }
    2711                 :            : 
    2712 [ #  # ][ #  # ]:          0 :     if(SDRTEXTVERTADJUST_BLOCK == eVAdj && IsVerticalWriting())
         [ #  # ][ #  # ]
    2713                 :            :     {
    2714         [ #  # ]:          0 :         rOutliner.SetMinAutoPaperSize(Size(0, nAnkHgt));
    2715                 :            :     }
    2716         [ #  # ]:          0 :     rOutliner.SetMaxAutoPaperSize( Size( nMaxAutoPaperWidth, nMaxAutoPaperHeight ) );
    2717         [ #  # ]:          0 :     rOutliner.SetPaperSize( aNullSize );
    2718                 :            : 
    2719                 :            :     // put text into the Outliner - if necessary the use the text from the EditOutliner
    2720         [ #  # ]:          0 :     OutlinerParaObject* pPara= GetOutlinerParaObject();
    2721 [ #  # ][ #  # ]:          0 :     if (pEdtOutl && !bNoEditText)
    2722         [ #  # ]:          0 :         pPara=pEdtOutl->CreateParaObject();
    2723                 :            : 
    2724         [ #  # ]:          0 :     if (pPara)
    2725                 :            :     {
    2726                 :          0 :         sal_Bool bHitTest = sal_False;
    2727         [ #  # ]:          0 :         if( pModel )
    2728                 :          0 :             bHitTest = &pModel->GetHitTestOutliner() == &rOutliner;
    2729                 :            : 
    2730         [ #  # ]:          0 :         const SdrTextObj* pTestObj = rOutliner.GetTextObj();
    2731 [ #  # ][ #  # ]:          0 :         if( !pTestObj || !bHitTest || pTestObj != this ||
         [ #  # ][ #  # ]
                 [ #  # ]
    2732 [ #  # ][ #  # ]:          0 :             pTestObj->GetOutlinerParaObject() != GetOutlinerParaObject() )
    2733                 :            :         {
    2734         [ #  # ]:          0 :             if( bHitTest )
    2735         [ #  # ]:          0 :                 rOutliner.SetTextObj( this );
    2736                 :            : 
    2737         [ #  # ]:          0 :             rOutliner.SetUpdateMode(sal_True);
    2738         [ #  # ]:          0 :             rOutliner.SetText(*pPara);
    2739                 :            :         }
    2740                 :            :     }
    2741                 :            :     else
    2742                 :            :     {
    2743         [ #  # ]:          0 :         rOutliner.SetTextObj( NULL );
    2744                 :            :     }
    2745 [ #  # ][ #  # ]:          0 :     if (pEdtOutl && !bNoEditText && pPara)
                 [ #  # ]
    2746 [ #  # ][ #  # ]:          0 :         delete pPara;
    2747                 :            : 
    2748         [ #  # ]:          0 :     rOutliner.SetUpdateMode(sal_True);
    2749         [ #  # ]:          0 :     rOutliner.SetControlWord(nStat0);
    2750                 :            : 
    2751         [ #  # ]:          0 :     SdrText* pText = getActiveText();
    2752         [ #  # ]:          0 :     if( pText )
    2753         [ #  # ]:          0 :         pText->CheckPortionInfo( rOutliner );
    2754                 :            : 
    2755                 :          0 :     Point aTextPos(aAnkRect.TopLeft());
    2756         [ #  # ]:          0 :     Size aTextSiz(rOutliner.GetPaperSize()); // GetPaperSize() has a little added tolerance, no?
    2757                 :            : 
    2758                 :            :     // For draw objects containing text correct horizontal/vertical alignment if text is bigger
    2759                 :            :     // than the object itself. Without that correction, the text would always be
    2760                 :            :     // formatted to the left edge (or top edge when vertical) of the draw object.
    2761                 :            : 
    2762         [ #  # ]:          0 :     if( !IsTextFrame() )
    2763                 :            :     {
    2764 [ #  # ][ #  # ]:          0 :         if(aAnkRect.GetWidth() < aTextSiz.Width() && !IsVerticalWriting())
         [ #  # ][ #  # ]
                 [ #  # ]
    2765                 :            :         {
    2766                 :            :             // Horizontal case here. Correct only if eHAdj == SDRTEXTHORZADJUST_BLOCK,
    2767                 :            :             // else the alignment is wanted.
    2768         [ #  # ]:          0 :             if(SDRTEXTHORZADJUST_BLOCK == eHAdj)
    2769                 :            :             {
    2770                 :          0 :                 eHAdj = SDRTEXTHORZADJUST_CENTER;
    2771                 :            :             }
    2772                 :            :         }
    2773                 :            : 
    2774 [ #  # ][ #  # ]:          0 :         if(aAnkRect.GetHeight() < aTextSiz.Height() && IsVerticalWriting())
         [ #  # ][ #  # ]
                 [ #  # ]
    2775                 :            :         {
    2776                 :            :             // Vertical case here. Correct only if eHAdj == SDRTEXTVERTADJUST_BLOCK,
    2777                 :            :             // else the alignment is wanted.
    2778         [ #  # ]:          0 :             if(SDRTEXTVERTADJUST_BLOCK == eVAdj)
    2779                 :            :             {
    2780                 :          0 :                 eVAdj = SDRTEXTVERTADJUST_CENTER;
    2781                 :            :             }
    2782                 :            :         }
    2783                 :            :     }
    2784                 :            : 
    2785 [ #  # ][ #  # ]:          0 :     if (eHAdj==SDRTEXTHORZADJUST_CENTER || eHAdj==SDRTEXTHORZADJUST_RIGHT)
    2786                 :            :     {
    2787         [ #  # ]:          0 :         long nFreeWdt=aAnkRect.GetWidth()-aTextSiz.Width();
    2788         [ #  # ]:          0 :         if (eHAdj==SDRTEXTHORZADJUST_CENTER)
    2789                 :          0 :             aTextPos.X()+=nFreeWdt/2;
    2790         [ #  # ]:          0 :         if (eHAdj==SDRTEXTHORZADJUST_RIGHT)
    2791                 :          0 :             aTextPos.X()+=nFreeWdt;
    2792                 :            :     }
    2793 [ #  # ][ #  # ]:          0 :     if (eVAdj==SDRTEXTVERTADJUST_CENTER || eVAdj==SDRTEXTVERTADJUST_BOTTOM)
    2794                 :            :     {
    2795         [ #  # ]:          0 :         long nFreeHgt=aAnkRect.GetHeight()-aTextSiz.Height();
    2796         [ #  # ]:          0 :         if (eVAdj==SDRTEXTVERTADJUST_CENTER)
    2797                 :          0 :             aTextPos.Y()+=nFreeHgt/2;
    2798         [ #  # ]:          0 :         if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
    2799                 :          0 :             aTextPos.Y()+=nFreeHgt;
    2800                 :            :     }
    2801         [ #  # ]:          0 :     if (aGeo.nDrehWink!=0)
    2802                 :          0 :         RotatePoint(aTextPos,aAnkRect.TopLeft(),aGeo.nSin,aGeo.nCos);
    2803                 :            : 
    2804         [ #  # ]:          0 :     if (pAnchorRect)
    2805                 :          0 :         *pAnchorRect=aAnkRect;
    2806                 :            : 
    2807                 :            :     // using rTextRect together with ContourFrame doesn't always work correctly
    2808         [ #  # ]:          0 :     rTextRect=Rectangle(aTextPos,aTextSiz);
    2809                 :          0 : }
    2810                 :            : 
    2811                 :         33 : void SdrObjCustomShape::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject)
    2812                 :            : {
    2813                 :         33 :     SdrTextObj::NbcSetOutlinerParaObject( pTextObject );
    2814                 :         33 :     SetBoundRectDirty();
    2815                 :         33 :     SetRectsDirty(sal_True);
    2816                 :         33 :     InvalidateRenderGeometry();
    2817                 :         33 : }
    2818                 :            : 
    2819                 :          0 : SdrObjCustomShape* SdrObjCustomShape::Clone() const
    2820                 :            : {
    2821                 :          0 :     return CloneHelper< SdrObjCustomShape >();
    2822                 :            : }
    2823                 :            : 
    2824                 :          0 : SdrObjCustomShape& SdrObjCustomShape::operator=(const SdrObjCustomShape& rObj)
    2825                 :            : {
    2826         [ #  # ]:          0 :     if( this == &rObj )
    2827                 :          0 :         return *this;
    2828                 :          0 :     SdrTextObj::operator=( rObj );
    2829                 :          0 :     aName = rObj.aName;
    2830                 :          0 :     fObjectRotation = rObj.fObjectRotation;
    2831                 :          0 :     InvalidateRenderGeometry();
    2832                 :          0 :     return *this;
    2833                 :            : }
    2834                 :            : 
    2835                 :            : 
    2836                 :         36 : void SdrObjCustomShape::TakeObjNameSingul(XubString& rName) const
    2837                 :            : {
    2838 [ +  - ][ +  - ]:         36 :     rName = ImpGetResStr(STR_ObjNameSingulCUSTOMSHAPE);
                 [ +  - ]
    2839 [ +  - ][ +  - ]:         36 :     String aNm( GetName() );
    2840         [ -  + ]:         36 :     if( aNm.Len() )
    2841                 :            :     {
    2842         [ #  # ]:          0 :         rName += sal_Unicode(' ');
    2843         [ #  # ]:          0 :         rName += sal_Unicode('\'');
    2844         [ #  # ]:          0 :         rName += aNm;
    2845         [ #  # ]:          0 :         rName += sal_Unicode('\'');
    2846         [ +  - ]:         36 :     }
    2847                 :         36 : }
    2848                 :            : 
    2849                 :          0 : void SdrObjCustomShape::TakeObjNamePlural(XubString& rName) const
    2850                 :            : {
    2851         [ #  # ]:          0 :     rName=ImpGetResStr(STR_ObjNamePluralCUSTOMSHAPE);
    2852                 :          0 : }
    2853                 :            : 
    2854                 :          0 : basegfx::B2DPolyPolygon SdrObjCustomShape::TakeXorPoly() const
    2855                 :            : {
    2856                 :          0 :     return GetLineGeometry( (SdrObjCustomShape*)this, sal_False );
    2857                 :            : }
    2858                 :            : 
    2859                 :          0 : basegfx::B2DPolyPolygon SdrObjCustomShape::TakeContour() const
    2860                 :            : {
    2861                 :          0 :     const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
    2862         [ #  # ]:          0 :     if ( pSdrObject )
    2863                 :          0 :         return pSdrObject->TakeContour();
    2864                 :          0 :     return basegfx::B2DPolyPolygon();
    2865                 :            : }
    2866                 :            : 
    2867                 :          0 : SdrObject* SdrObjCustomShape::DoConvertToPolyObj(sal_Bool bBezier) const
    2868                 :            : {
    2869                 :            :     // #i37011#
    2870                 :          0 :     SdrObject* pRetval = 0L;
    2871                 :          0 :     SdrObject* pRenderedCustomShape = 0L;
    2872                 :            : 
    2873         [ #  # ]:          0 :     if ( !mXRenderedCustomShape.is() )
    2874                 :            :     {
    2875                 :            :         // force CustomShape
    2876                 :          0 :         ((SdrObjCustomShape*)this)->GetSdrObjectFromCustomShape();
    2877                 :            :     }
    2878                 :            : 
    2879         [ #  # ]:          0 :     if ( mXRenderedCustomShape.is() )
    2880                 :            :     {
    2881                 :          0 :         pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
    2882                 :            :     }
    2883                 :            : 
    2884         [ #  # ]:          0 :     if ( pRenderedCustomShape )
    2885                 :            :     {
    2886         [ #  # ]:          0 :         SdrObject* pCandidate = pRenderedCustomShape->Clone();
    2887                 :            :         DBG_ASSERT(pCandidate, "SdrObjCustomShape::DoConvertToPolyObj: Could not clone SdrObject (!)");
    2888 [ #  # ][ #  # ]:          0 :         pCandidate->SetModel(GetModel());
    2889         [ #  # ]:          0 :         pRetval = pCandidate->DoConvertToPolyObj(bBezier);
    2890         [ #  # ]:          0 :         SdrObject::Free( pCandidate );
    2891                 :            : 
    2892         [ #  # ]:          0 :         if(pRetval)
    2893                 :            :         {
    2894         [ #  # ]:          0 :             const sal_Bool bShadow(((SdrShadowItem&)GetMergedItem(SDRATTR_SHADOW)).GetValue());
    2895         [ #  # ]:          0 :             if(bShadow)
    2896                 :            :             {
    2897 [ #  # ][ #  # ]:          0 :                 pRetval->SetMergedItem(SdrShadowItem(sal_True));
                 [ #  # ]
    2898                 :            :             }
    2899                 :            :         }
    2900                 :            : 
    2901 [ #  # ][ #  # ]:          0 :         if(HasText() && !IsTextPath())
         [ #  # ][ #  # ]
                 [ #  # ]
    2902                 :            :         {
    2903         [ #  # ]:          0 :             pRetval = ImpConvertAddText(pRetval, bBezier);
    2904                 :            :         }
    2905                 :            :     }
    2906                 :            : 
    2907                 :          0 :     return pRetval;
    2908                 :            : }
    2909                 :            : 
    2910                 :        201 : void SdrObjCustomShape::NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr )
    2911                 :            : {
    2912                 :            :     // #i40944#
    2913                 :        201 :     InvalidateRenderGeometry();
    2914                 :        201 :     SdrObject::NbcSetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
    2915                 :        201 : }
    2916                 :            : 
    2917                 :        639 : void SdrObjCustomShape::SetPage( SdrPage* pNewPage )
    2918                 :            : {
    2919                 :        639 :     SdrTextObj::SetPage( pNewPage );
    2920                 :            : 
    2921         [ +  + ]:        639 :     if( pNewPage )
    2922                 :            :     {
    2923                 :            :         // invalidating rectangles by SetRectsDirty is not sufficient,
    2924                 :            :         // AdjustTextFrameWidthAndHeight() also has to be made, both
    2925                 :            :         // actions are done by NbcSetSnapRect
    2926                 :        564 :         Rectangle aTmp( aRect );    //creating temporary rectangle #i61108#
    2927         [ +  - ]:        564 :         NbcSetSnapRect( aTmp );
    2928                 :            :     }
    2929                 :        639 : }
    2930                 :            : 
    2931                 :          0 : SdrObjGeoData* SdrObjCustomShape::NewGeoData() const
    2932                 :            : {
    2933         [ #  # ]:          0 :     return new SdrAShapeObjGeoData;
    2934                 :            : }
    2935                 :            : 
    2936                 :        228 : void SdrObjCustomShape::SaveGeoData(SdrObjGeoData& rGeo) const
    2937                 :            : {
    2938         [ +  - ]:        228 :     SdrTextObj::SaveGeoData( rGeo );
    2939                 :        228 :     SdrAShapeObjGeoData& rAGeo=(SdrAShapeObjGeoData&)rGeo;
    2940                 :        228 :     rAGeo.fObjectRotation = fObjectRotation;
    2941         [ +  - ]:        228 :     rAGeo.bMirroredX = IsMirroredX();
    2942         [ +  - ]:        228 :     rAGeo.bMirroredY = IsMirroredY();
    2943                 :            : 
    2944         [ +  - ]:        228 :     const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
    2945 [ +  - ][ +  - ]:        228 :     Any* pAny( ( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ).GetPropertyValueByName( sAdjustmentValues ) );
    2946         [ +  + ]:        228 :     if ( pAny )
    2947         [ +  - ]:        228 :         *pAny >>= rAGeo.aAdjustmentSeq;
    2948                 :        228 : }
    2949                 :            : 
    2950                 :          0 : void SdrObjCustomShape::RestGeoData(const SdrObjGeoData& rGeo)
    2951                 :            : {
    2952         [ #  # ]:          0 :     SdrTextObj::RestGeoData( rGeo );
    2953                 :          0 :     SdrAShapeObjGeoData& rAGeo=(SdrAShapeObjGeoData&)rGeo;
    2954                 :          0 :     fObjectRotation = rAGeo.fObjectRotation;
    2955         [ #  # ]:          0 :     SetMirroredX( rAGeo.bMirroredX );
    2956         [ #  # ]:          0 :     SetMirroredY( rAGeo.bMirroredY );
    2957                 :            : 
    2958 [ #  # ][ #  # ]:          0 :     SdrCustomShapeGeometryItem rGeometryItem = (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
    2959         [ #  # ]:          0 :     const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
    2960                 :          0 :     PropertyValue aPropVal;
    2961                 :          0 :     aPropVal.Name = sAdjustmentValues;
    2962         [ #  # ]:          0 :     aPropVal.Value <<= rAGeo.aAdjustmentSeq;
    2963         [ #  # ]:          0 :     rGeometryItem.SetPropertyValue( aPropVal );
    2964         [ #  # ]:          0 :     SetMergedItem( rGeometryItem );
    2965                 :            : 
    2966 [ #  # ][ #  # ]:          0 :     InvalidateRenderGeometry();
    2967                 :          0 : }
    2968                 :            : 
    2969                 :        216 : void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
    2970                 :            : {
    2971                 :            :     // break up matrix
    2972                 :        216 :     basegfx::B2DTuple aScale;
    2973                 :        216 :     basegfx::B2DTuple aTranslate;
    2974                 :            :     double fRotate, fShearX;
    2975         [ +  - ]:        216 :     rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
    2976                 :            : 
    2977                 :            :     // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
    2978                 :            :     // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
    2979 [ -  + ][ #  # ]:        216 :     if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
         [ -  + ][ -  + ]
         [ +  - ][ +  - ]
                 [ -  + ]
    2980                 :            :     {
    2981                 :          0 :         aScale.setX(fabs(aScale.getX()));
    2982                 :          0 :         aScale.setY(fabs(aScale.getY()));
    2983                 :          0 :         fRotate = fmod(fRotate + F_PI, F_2PI);
    2984                 :            :     }
    2985                 :            : 
    2986                 :            :     // reset object shear and rotations
    2987                 :        216 :     aGeo.nDrehWink = 0;
    2988         [ +  - ]:        216 :     aGeo.RecalcSinCos();
    2989                 :        216 :     aGeo.nShearWink = 0;
    2990         [ +  - ]:        216 :     aGeo.RecalcTan();
    2991                 :            : 
    2992                 :            :     // force metric to pool metric
    2993 [ +  - ][ +  - ]:        216 :     SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
    2994         [ +  + ]:        216 :     if(eMapUnit != SFX_MAPUNIT_100TH_MM)
    2995                 :            :     {
    2996         [ +  - ]:         15 :         switch(eMapUnit)
    2997                 :            :         {
    2998                 :            :             case SFX_MAPUNIT_TWIP :
    2999                 :            :             {
    3000                 :            :                 // position
    3001                 :         15 :                 aTranslate.setX(ImplMMToTwips(aTranslate.getX()));
    3002                 :         15 :                 aTranslate.setY(ImplMMToTwips(aTranslate.getY()));
    3003                 :            : 
    3004                 :            :                 // size
    3005                 :         15 :                 aScale.setX(ImplMMToTwips(aScale.getX()));
    3006                 :         15 :                 aScale.setY(ImplMMToTwips(aScale.getY()));
    3007                 :            : 
    3008                 :         15 :                 break;
    3009                 :            :             }
    3010                 :            :             default:
    3011                 :            :             {
    3012                 :            :                 OSL_FAIL("TRSetBaseGeometry: Missing unit translation to PoolMetric!");
    3013                 :            :             }
    3014                 :            :         }
    3015                 :            :     }
    3016                 :            : 
    3017                 :            :     // if anchor is used, make position relative to it
    3018 [ +  - ][ +  + ]:        216 :     if( pModel && pModel->IsWriter() )
                 [ +  + ]
    3019                 :            :     {
    3020 [ +  - ][ +  - ]:         15 :         if(GetAnchorPos().X() || GetAnchorPos().Y())
         [ +  - ][ -  + ]
                 [ -  + ]
    3021                 :            :         {
    3022 [ #  # ][ #  # ]:          0 :             aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
    3023                 :            :         }
    3024                 :            :     }
    3025                 :            : 
    3026                 :            :     // build and set BaseRect (use scale)
    3027                 :        216 :     Point aPoint = Point();
    3028                 :        216 :     Size aSize(FRound(aScale.getX()), FRound(aScale.getY()));
    3029                 :            :     // fdo#47434 We need a valid rectangle here
    3030         [ +  + ]:        216 :     if( !aSize.Height() ) aSize.setHeight( 1 );
    3031         [ -  + ]:        216 :     if( !aSize.Width() ) aSize.setWidth( 1 );
    3032                 :            : 
    3033         [ +  - ]:        216 :     Rectangle aBaseRect(aPoint, aSize);
    3034         [ +  - ]:        216 :     SetSnapRect(aBaseRect);
    3035                 :            : 
    3036                 :            :     // shear?
    3037         [ -  + ]:        216 :     if(!basegfx::fTools::equalZero(fShearX))
    3038                 :            :     {
    3039                 :          0 :         GeoStat aGeoStat;
    3040                 :          0 :         aGeoStat.nShearWink = FRound((atan(fShearX) / F_PI180) * 100.0);
    3041         [ #  # ]:          0 :         aGeoStat.RecalcTan();
    3042         [ #  # ]:          0 :         Shear(Point(), aGeoStat.nShearWink, aGeoStat.nTan, sal_False);
    3043                 :            :     }
    3044                 :            : 
    3045                 :            :     // rotation?
    3046         [ -  + ]:        216 :     if(!basegfx::fTools::equalZero(fRotate))
    3047                 :            :     {
    3048                 :          0 :         GeoStat aGeoStat;
    3049                 :            : 
    3050                 :            :         // #i78696#
    3051                 :            :         // fRotate is mathematically correct, but aGeoStat.nDrehWink is
    3052                 :            :         // mirrored -> mirror value here
    3053         [ #  # ]:          0 :         aGeoStat.nDrehWink = NormAngle360(FRound(-fRotate / F_PI18000));
    3054         [ #  # ]:          0 :         aGeoStat.RecalcSinCos();
    3055         [ #  # ]:          0 :         Rotate(Point(), aGeoStat.nDrehWink, aGeoStat.nSin, aGeoStat.nCos);
    3056                 :            :     }
    3057                 :            : 
    3058                 :            :     // translate?
    3059 [ +  - ][ +  - ]:        216 :     if(!aTranslate.equalZero())
    3060                 :            :     {
    3061         [ +  - ]:        216 :         Move(Size(FRound(aTranslate.getX()), FRound(aTranslate.getY())));
    3062                 :        216 :     }
    3063                 :        216 : }
    3064                 :            : 
    3065                 :            : // taking fObjectRotation instead of aGeo.nWink
    3066                 :        411 : sal_Bool SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const
    3067                 :            : {
    3068                 :            :     // get turn and shear
    3069                 :        411 :     double fRotate = fObjectRotation * F_PI180;
    3070                 :        411 :     double fShearX = (aGeo.nShearWink / 100.0) * F_PI180;
    3071                 :            : 
    3072                 :            :     // get aRect, this is the unrotated snaprect
    3073                 :        411 :     Rectangle aRectangle(aRect);
    3074                 :            : 
    3075         [ +  - ]:        411 :     sal_Bool bMirroredX = IsMirroredX();
    3076         [ +  - ]:        411 :     sal_Bool bMirroredY = IsMirroredY();
    3077 [ +  + ][ -  + ]:        411 :     if ( bMirroredX || bMirroredY )
    3078                 :            :     {   // we have to retrieve the unmirrored rect
    3079                 :            : 
    3080                 :          9 :         GeoStat aNewGeo( aGeo );
    3081                 :            : 
    3082         [ +  - ]:          9 :         if ( bMirroredX )
    3083                 :            :         {
    3084         [ +  - ]:          9 :             Polygon aPol( Rect2Poly( aRect, aNewGeo ) );
    3085         [ +  - ]:          9 :             Rectangle aBoundRect( aPol.GetBoundRect() );
    3086                 :            : 
    3087                 :          9 :             Point aRef1( ( aBoundRect.Left() + aBoundRect.Right() ) >> 1, aBoundRect.Top() );
    3088                 :          9 :             Point aRef2( aRef1.X(), aRef1.Y() + 1000 );
    3089                 :            :             sal_uInt16 i;
    3090         [ +  - ]:          9 :             sal_uInt16 nPntAnz=aPol.GetSize();
    3091         [ +  + ]:         54 :             for (i=0; i<nPntAnz; i++)
    3092                 :            :             {
    3093 [ +  - ][ +  - ]:         45 :                 MirrorPoint(aPol[i],aRef1,aRef2);
    3094                 :            :             }
    3095                 :            :             // mirror polygon and move it a bit
    3096         [ +  - ]:          9 :             Polygon aPol0(aPol);
    3097 [ +  - ][ +  - ]:          9 :             aPol[0]=aPol0[1];
    3098 [ +  - ][ +  - ]:          9 :             aPol[1]=aPol0[0];
    3099 [ +  - ][ +  - ]:          9 :             aPol[2]=aPol0[3];
    3100 [ +  - ][ +  - ]:          9 :             aPol[3]=aPol0[2];
    3101 [ +  - ][ +  - ]:          9 :             aPol[4]=aPol0[1];
    3102 [ +  - ][ +  - ]:          9 :             Poly2Rect(aPol,aRectangle,aNewGeo);
                 [ +  - ]
    3103                 :            :         }
    3104         [ -  + ]:          9 :         if ( bMirroredY )
    3105                 :            :         {
    3106         [ #  # ]:          0 :             Polygon aPol( Rect2Poly( aRectangle, aNewGeo ) );
    3107         [ #  # ]:          0 :             Rectangle aBoundRect( aPol.GetBoundRect() );
    3108                 :            : 
    3109                 :          0 :             Point aRef1( aBoundRect.Left(), ( aBoundRect.Top() + aBoundRect.Bottom() ) >> 1 );
    3110                 :          0 :             Point aRef2( aRef1.X() + 1000, aRef1.Y() );
    3111                 :            :             sal_uInt16 i;
    3112         [ #  # ]:          0 :             sal_uInt16 nPntAnz=aPol.GetSize();
    3113         [ #  # ]:          0 :             for (i=0; i<nPntAnz; i++)
    3114                 :            :             {
    3115 [ #  # ][ #  # ]:          0 :                 MirrorPoint(aPol[i],aRef1,aRef2);
    3116                 :            :             }
    3117                 :            :             // mirror polygon and move it a bit
    3118         [ #  # ]:          0 :             Polygon aPol0(aPol);
    3119 [ #  # ][ #  # ]:          0 :             aPol[0]=aPol0[1];
    3120 [ #  # ][ #  # ]:          0 :             aPol[1]=aPol0[0];
    3121 [ #  # ][ #  # ]:          0 :             aPol[2]=aPol0[3];
    3122 [ #  # ][ #  # ]:          0 :             aPol[3]=aPol0[2];
    3123 [ #  # ][ #  # ]:          0 :             aPol[4]=aPol0[1];
    3124 [ #  # ][ #  # ]:          9 :             Poly2Rect(aPol,aRectangle,aNewGeo);
                 [ #  # ]
    3125                 :            :         }
    3126                 :            :     }
    3127                 :            : 
    3128                 :            :     // fill other values
    3129 [ +  - ][ +  - ]:        411 :     basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
    3130                 :        411 :     basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
    3131                 :            : 
    3132                 :            :     // position may be relative to anchorpos, convert
    3133 [ +  + ][ +  + ]:        411 :     if( pModel && pModel->IsWriter() )
                 [ +  - ]
    3134                 :            :     {
    3135 [ +  - ][ +  - ]:         15 :         if(GetAnchorPos().X() || GetAnchorPos().Y())
         [ +  - ][ -  + ]
                 [ -  + ]
    3136                 :            :         {
    3137 [ #  # ][ #  # ]:          0 :             aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
    3138                 :            :         }
    3139                 :            :     }
    3140                 :            : 
    3141                 :            :     // force MapUnit to 100th mm
    3142 [ +  - ][ +  - ]:        411 :     SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
    3143         [ +  + ]:        411 :     if(eMapUnit != SFX_MAPUNIT_100TH_MM)
    3144                 :            :     {
    3145         [ +  - ]:         15 :         switch(eMapUnit)
    3146                 :            :         {
    3147                 :            :             case SFX_MAPUNIT_TWIP :
    3148                 :            :             {
    3149                 :            :                 // position
    3150                 :         15 :                 aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
    3151                 :         15 :                 aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
    3152                 :            : 
    3153                 :            :                 // size
    3154                 :         15 :                 aScale.setX(ImplTwipsToMM(aScale.getX()));
    3155                 :         15 :                 aScale.setY(ImplTwipsToMM(aScale.getY()));
    3156                 :            : 
    3157                 :         15 :                 break;
    3158                 :            :             }
    3159                 :            :             default:
    3160                 :            :             {
    3161                 :            :                 OSL_FAIL("TRGetBaseGeometry: Missing unit translation to 100th mm!");
    3162                 :            :             }
    3163                 :            :         }
    3164                 :            :     }
    3165                 :            : 
    3166                 :            :     // build matrix
    3167                 :            :     rMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
    3168                 :            :         aScale,
    3169                 :        411 :         basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
    3170                 :        411 :         basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
    3171 [ +  - ][ +  - ]:        822 :         aTranslate);
         [ +  - ][ +  - ]
                 [ +  - ]
    3172                 :            : 
    3173                 :        411 :     return sal_False;
    3174                 :            : }
    3175                 :            : 
    3176                 :        642 : sdr::contact::ViewContact* SdrObjCustomShape::CreateObjectSpecificViewContact()
    3177                 :            : {
    3178         [ +  - ]:        642 :     return new sdr::contact::ViewContactOfSdrObjCustomShape(*this);
    3179                 :            : }
    3180                 :            : 
    3181                 :            : // #i33136#
    3182                 :          0 : bool SdrObjCustomShape::doConstructOrthogonal(const ::rtl::OUString& rName)
    3183                 :            : {
    3184                 :          0 :     bool bRetval(false);
    3185 [ #  # ][ #  # ]:          0 :     static ::rtl::OUString Imps_sNameASOrtho_quadrat(  "quadrat"  );
    3186 [ #  # ][ #  # ]:          0 :     static ::rtl::OUString Imps_sNameASOrtho_round_quadrat(  "round-quadrat"  );
    3187 [ #  # ][ #  # ]:          0 :     static ::rtl::OUString Imps_sNameASOrtho_circle(  "circle"  );
    3188 [ #  # ][ #  # ]:          0 :     static ::rtl::OUString Imps_sNameASOrtho_circle_pie(  "circle-pie"  );
    3189 [ #  # ][ #  # ]:          0 :     static ::rtl::OUString Imps_sNameASOrtho_ring(  "ring"  );
    3190                 :            : 
    3191         [ #  # ]:          0 :     if(Imps_sNameASOrtho_quadrat.equalsIgnoreAsciiCase(rName))
    3192                 :            :     {
    3193                 :          0 :         bRetval = true;
    3194                 :            :     }
    3195         [ #  # ]:          0 :     else if(Imps_sNameASOrtho_round_quadrat.equalsIgnoreAsciiCase(rName))
    3196                 :            :     {
    3197                 :          0 :         bRetval = true;
    3198                 :            :     }
    3199         [ #  # ]:          0 :     else if(Imps_sNameASOrtho_circle.equalsIgnoreAsciiCase(rName))
    3200                 :            :     {
    3201                 :          0 :         bRetval = true;
    3202                 :            :     }
    3203         [ #  # ]:          0 :     else if(Imps_sNameASOrtho_circle_pie.equalsIgnoreAsciiCase(rName))
    3204                 :            :     {
    3205                 :          0 :         bRetval = true;
    3206                 :            :     }
    3207         [ #  # ]:          0 :     else if(Imps_sNameASOrtho_ring.equalsIgnoreAsciiCase(rName))
    3208                 :            :     {
    3209                 :          0 :         bRetval = true;
    3210                 :            :     }
    3211                 :            : 
    3212                 :          0 :     return bRetval;
    3213                 :            : }
    3214                 :            : 
    3215                 :            : // #i37011# centralize throw-away of render geometry
    3216                 :      51981 : void SdrObjCustomShape::InvalidateRenderGeometry()
    3217                 :            : {
    3218                 :      51981 :     mXRenderedCustomShape = 0L;
    3219                 :      51981 :     SdrObject::Free( mpLastShadowGeometry );
    3220                 :      51981 :     mpLastShadowGeometry = 0L;
    3221                 :      51981 : }
    3222                 :            : 
    3223                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10