LCOV - code coverage report
Current view: top level - filter/source/msfilter - eschesdo.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 158 573 27.6 %
Date: 2012-08-25 Functions: 24 37 64.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 130 1079 12.0 %

           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 "eschesdo.hxx"
      30                 :            : #include <svx/svdobj.hxx>
      31                 :            : #include <svx/unoapi.hxx>
      32                 :            : #include <svx/svdoashp.hxx>
      33                 :            : #include <svx/unoshape.hxx>
      34                 :            : #include <vcl/outdev.hxx>
      35                 :            : #include <tools/poly.hxx>
      36                 :            : #include <vcl/bitmapex.hxx>
      37                 :            : #include <vcl/graph.hxx>
      38                 :            : #include <tools/debug.hxx>
      39                 :            : #include <svx/fmdpage.hxx>
      40                 :            : #include <toolkit/unohlp.hxx>
      41                 :            : #include <com/sun/star/style/VerticalAlignment.hpp>
      42                 :            : #include <com/sun/star/awt/Gradient.hpp>
      43                 :            : #include <com/sun/star/drawing/PointSequence.hpp>
      44                 :            : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
      45                 :            : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      46                 :            : #include <com/sun/star/drawing/FlagSequence.hpp>
      47                 :            : #include <com/sun/star/drawing/TextAdjust.hpp>
      48                 :            : #include <com/sun/star/drawing/LineDash.hpp>
      49                 :            : #include <com/sun/star/text/XText.hpp>
      50                 :            : #include <com/sun/star/drawing/CircleKind.hpp>
      51                 :            : #include <com/sun/star/drawing/FillStyle.hpp>
      52                 :            : #include <com/sun/star/task/XStatusIndicator.hpp>
      53                 :            : #include <comphelper/extract.hxx>
      54                 :            : #include <svtools/fltcall.hxx>
      55                 :            : #include <vcl/cvtgrf.hxx>
      56                 :            : 
      57                 :            : using ::rtl::OUString;
      58                 :            : using namespace ::com::sun::star;
      59                 :            : using namespace ::com::sun::star::beans;
      60                 :            : using namespace ::com::sun::star::container;
      61                 :            : using namespace ::com::sun::star::uno;
      62                 :            : using namespace ::com::sun::star::drawing;
      63                 :            : using namespace ::com::sun::star::text;
      64                 :            : using namespace ::com::sun::star::task;
      65                 :            : using namespace ::com::sun::star::style;
      66                 :            : 
      67                 :            : #define EES_MAP_FRACTION 1440   // 1440 dpi
      68                 :            : 
      69                 :        141 : ImplEESdrWriter::ImplEESdrWriter( EscherEx& rEx )
      70                 :            :         :
      71                 :            :         mpEscherEx              ( &rEx ),
      72                 :            :         maMapModeSrc            ( MAP_100TH_MM ),
      73                 :            :         // PowerPoint: 576 dpi, WinWord: 1440 dpi, Excel: 1440 dpi
      74                 :            :         maMapModeDest( MAP_INCH, Point(), Fraction( 1, EES_MAP_FRACTION ), Fraction( 1, EES_MAP_FRACTION ) ),
      75                 :            :         mpPicStrm               ( NULL ),
      76                 :            :         mpHostAppData           ( NULL ),
      77                 :            :         mnPagesWritten          ( 0 ),
      78                 :            :         mnShapeMasterTitle      ( 0 ),
      79                 :            :         mnShapeMasterBody       ( 0 ),
      80                 :            :         mbStatusIndicator       ( sal_False ),
      81 [ +  - ][ +  - ]:        141 :         mbStatus                ( sal_False )
                 [ +  - ]
      82                 :            : {
      83                 :        141 : }
      84                 :            : 
      85                 :            : 
      86                 :          3 : Point ImplEESdrWriter::ImplMapPoint( const Point& rPoint )
      87                 :            : {
      88                 :          3 :     return OutputDevice::LogicToLogic( rPoint, maMapModeSrc, maMapModeDest );
      89                 :            : }
      90                 :            : 
      91                 :          3 : Size ImplEESdrWriter::ImplMapSize( const Size& rSize )
      92                 :            : {
      93                 :          3 :     Size aRetSize( OutputDevice::LogicToLogic( rSize, maMapModeSrc, maMapModeDest ) );
      94                 :            : 
      95         [ -  + ]:          3 :     if ( !aRetSize.Width() )
      96                 :          0 :         aRetSize.Width()++;
      97         [ -  + ]:          3 :     if ( !aRetSize.Height() )
      98                 :          0 :         aRetSize.Height()++;
      99                 :          3 :     return aRetSize;
     100                 :            : }
     101                 :            : 
     102                 :          0 : void ImplEESdrWriter::ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherPropertyContainer& rPropOpt )
     103                 :            : {
     104                 :          0 :     sal_Int32 nAngle = rObj.GetAngle();
     105                 :          0 :     Rectangle aRect( rObj.GetRect() );
     106                 :            : 
     107         [ #  # ]:          0 :     if ( nAngle < 0 )
     108                 :          0 :         nAngle = ( 36000 + nAngle ) % 36000;
     109                 :            :     else
     110                 :          0 :         nAngle = ( 36000 - ( nAngle % 36000 ) );
     111                 :            : 
     112                 :          0 :     double fVal = (double)nAngle * F_PI18000;
     113                 :          0 :     double  fCos = cos( fVal );
     114                 :          0 :     double  fSin = sin( fVal );
     115                 :            : 
     116         [ #  # ]:          0 :     double  nWidthHalf = (double) aRect.GetWidth() / 2;
     117         [ #  # ]:          0 :     double  nHeightHalf = (double) aRect.GetHeight() / 2;
     118                 :            : 
     119                 :          0 :     double nXDiff = fCos * nWidthHalf + fSin * (-nHeightHalf);
     120                 :          0 :     double nYDiff = - ( fSin * nWidthHalf - fCos * ( -nHeightHalf ) );
     121                 :            : 
     122         [ #  # ]:          0 :     aRect.Move( (sal_Int32)( -( nWidthHalf - nXDiff ) ), (sal_Int32)( - ( nHeightHalf + nYDiff ) ) );
     123                 :            : 
     124                 :          0 :     nAngle *= 655;
     125                 :          0 :     nAngle += 0x8000;
     126                 :          0 :     nAngle &=~0xffff;                                   // nAngle auf volle Gradzahl runden
     127         [ #  # ]:          0 :     rPropOpt.AddOpt( ESCHER_Prop_Rotation, nAngle );
     128                 :            : 
     129                 :          0 :     rObj.SetAngle( nAngle );
     130                 :          0 :     rObj.SetRect( aRect );
     131                 :          0 : }
     132                 :            : 
     133                 :            : //  -----------------------------------------------------------------------
     134                 :            : 
     135                 :            : #define ADD_SHAPE( nType, nFlags )                              \
     136                 :            : {                                                               \
     137                 :            :     nShapeType = nType;                                         \
     138                 :            :     nShapeID = mpEscherEx->GenerateShapeId();                   \
     139                 :            :     rObj.SetShapeId( nShapeID );                                \
     140                 :            :     mpEscherEx->AddShape( (sal_uInt32)nType, (sal_uInt32)nFlags, nShapeID );    \
     141                 :            :     rSolverContainer.AddShape( rObj.GetShapeRef(), nShapeID );  \
     142                 :            : }
     143                 :            : 
     144                 :            : #define SHAPE_TEXT( bFill )                                         \
     145                 :            : {                                                                   \
     146                 :            :     mpEscherEx->OpenContainer( ESCHER_SpContainer );                \
     147                 :            :     ADD_SHAPE( ESCHER_ShpInst_TextBox, 0xa00 );                     \
     148                 :            :     if ( bFill )                                                    \
     149                 :            :         aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );  \
     150                 :            :     if( rObj.ImplGetText() )                                        \
     151                 :            :         aPropOpt.CreateTextProperties( rObj.mXPropSet,              \
     152                 :            :             mpEscherEx->QueryTextID( rObj.GetShapeRef(),            \
     153                 :            :                 rObj.GetShapeId() ) );                              \
     154                 :            : }
     155                 :            : 
     156                 :            : //Map from twips to export units, generally twips as well, only excel and word
     157                 :            : //export is happening here, so native units are export units, leave as
     158                 :            : //placeholder if required in future
     159                 :          0 : void ImplEESdrWriter::MapRect(ImplEESdrObject& /* rObj */ )
     160                 :            : {
     161                 :          0 : }
     162                 :            : 
     163                 :          3 : sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
     164                 :            :                                 EscherSolverContainer& rSolverContainer,
     165                 :            :                                 ImplEESdrPageType ePageType )
     166                 :            : {
     167                 :          3 :     sal_uInt32 nShapeID = 0;
     168                 :          3 :     sal_uInt16 nShapeType = 0;
     169                 :          3 :     sal_Bool bDontWriteText = sal_False;        // if a metafile is written as shape replacement, then the text is already part of the metafile
     170                 :          3 :     sal_Bool bAdditionalText = sal_False;
     171                 :          3 :     sal_uInt32 nGrpShapeID = 0;
     172                 :            : 
     173                 :            :     do {
     174 [ -  + ][ +  - ]:          3 :         mpHostAppData = mpEscherEx->StartShape( rObj.GetShapeRef(), (mpEscherEx->GetGroupLevel() > 1) ? &rObj.GetRect() : 0 );
     175 [ -  + ][ #  # ]:          3 :         if ( mpHostAppData && mpHostAppData->DontWriteShape() )
                 [ +  - ]
     176                 :            :             break;
     177                 :            : 
     178                 :            :         // #i51348# get shape name
     179                 :          3 :         rtl::OUString aShapeName;
     180 [ +  - ][ +  - ]:          3 :         if( const SdrObject* pSdrObj = rObj.GetSdrObject() )
     181 [ +  - ][ -  + ]:          3 :             if (!pSdrObj->GetName().isEmpty())
     182         [ #  # ]:          0 :                 aShapeName = pSdrObj->GetName();
     183                 :            : 
     184                 :          3 :         Point aTextRefPoint;
     185                 :            : 
     186 [ -  + ][ +  - ]:          3 :         if( rObj.GetType().EqualsAscii( "drawing.Group" ))
     187                 :            :         {
     188         [ #  # ]:          0 :             Reference< XIndexAccess > xXIndexAccess( rObj.GetShapeRef(), UNO_QUERY );
     189                 :            : 
     190 [ #  # ][ #  # ]:          0 :             if( xXIndexAccess.is() && 0 != xXIndexAccess->getCount() )
         [ #  # ][ #  # ]
                 [ #  # ]
     191                 :            :             {
     192 [ #  # ][ #  # ]:          0 :                 nShapeID = mpEscherEx->EnterGroup( aShapeName, &rObj.GetRect() );
                 [ #  # ]
     193                 :          0 :                 nShapeType = ESCHER_ShpInst_Min;
     194                 :            : 
     195 [ #  # ][ #  # ]:          0 :                 for( sal_uInt32 n = 0, nCnt = xXIndexAccess->getCount();
                 [ #  # ]
     196                 :            :                         n < nCnt; ++n )
     197                 :            :                 {
     198                 :            :                     ImplEESdrObject aObj( *this, *(Reference< XShape >*)
     199 [ #  # ][ #  # ]:          0 :                                     xXIndexAccess->getByIndex( n ).getValue() );
                 [ #  # ]
     200         [ #  # ]:          0 :                     if( aObj.IsValid() )
     201         [ #  # ]:          0 :                         ImplWriteShape( aObj, rSolverContainer, ePageType );
     202         [ #  # ]:          0 :                 }
     203         [ #  # ]:          0 :                 mpEscherEx->LeaveGroup();
     204                 :            :             }
     205                 :          0 :             break;
     206                 :            :         }
     207         [ +  - ]:          3 :         rObj.SetAngle( rObj.ImplGetInt32PropertyValue( ::rtl::OUString( "RotateAngle" ) ));
     208                 :            : 
     209 [ +  - ][ +  - ]:          9 :         if( ( rObj.ImplGetPropertyValue( ::rtl::OUString( "IsFontwork" ) ) &&
         [ -  + ][ +  - ]
         [ +  - ][ -  +  
             #  #  #  # ]
                 [ +  - ]
     210         [ +  - ]:          3 :             ::cppu::any2bool( rObj.GetUsrAny() ) ) ||
     211         [ +  - ]:          3 :             rObj.GetType().EqualsAscii( "drawing.Measure" ) )
     212                 :            :         {
     213                 :            :             rObj.SetType( String( RTL_CONSTASCII_STRINGPARAM(
     214                 :            :                                 "drawing.dontknow" ),
     215 [ #  # ][ #  # ]:          0 :                                 RTL_TEXTENCODING_MS_1252 ));
                 [ #  # ]
     216                 :            :         }
     217                 :            : 
     218 [ +  - ][ +  - ]:          3 :         const ::com::sun::star::awt::Size   aSize100thmm( rObj.GetShapeRef()->getSize() );
     219 [ +  - ][ +  - ]:          3 :         const ::com::sun::star::awt::Point  aPoint100thmm( rObj.GetShapeRef()->getPosition() );
     220         [ +  - ]:          3 :         Rectangle   aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
     221         [ +  - ]:          3 :         if ( !mpPicStrm )
     222         [ +  - ]:          3 :             mpPicStrm = mpEscherEx->QueryPictureStream();
     223 [ +  - ][ +  - ]:          3 :         EscherPropertyContainer aPropOpt( mpEscherEx->GetGraphicProvider(), mpPicStrm, aRect100thmm );
     224                 :            : 
     225                 :            :         // #i51348# shape name
     226         [ -  + ]:          3 :         if (!aShapeName.isEmpty())
     227         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_wzName, aShapeName );
     228 [ -  + ][ -  + ]:          3 :         if ( InteractionInfo* pInteraction = mpHostAppData ? mpHostAppData->GetInteractionInfo():NULL )
     229                 :            :         {
     230                 :            :             SAL_WNODEPRECATED_DECLARATIONS_PUSH
     231                 :          0 :             const std::auto_ptr< SvMemoryStream >& pMemStrm = pInteraction->getHyperlinkRecord();
     232                 :            :             SAL_WNODEPRECATED_DECLARATIONS_POP
     233         [ #  # ]:          0 :             if ( pMemStrm.get() )
     234                 :            :             {
     235                 :          0 :                 pMemStrm->ObjectOwnsMemory( sal_False );
     236         [ #  # ]:          0 :                 sal_uInt8* pBuf = (sal_uInt8*) pMemStrm->GetData();
     237         [ #  # ]:          0 :                 sal_uInt32 nSize = pMemStrm->Seek( STREAM_SEEK_TO_END );
     238         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_pihlShape, sal_False, nSize, pBuf, nSize );
     239                 :            :             }
     240         [ #  # ]:          0 :             if ( pInteraction->hasInteraction() )
     241         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x00080008 );
     242                 :            :         }
     243                 :            : 
     244 [ +  - ][ +  - ]:          3 :         if ( rObj.GetType().EqualsAscii( "drawing.Custom" ) )
     245                 :            :         {
     246         [ +  - ]:          3 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     247                 :            :             sal_uInt32 nMirrorFlags;
     248                 :            : 
     249                 :          3 :             rtl::OUString sCustomShapeType;
     250         [ +  - ]:          3 :             MSO_SPT eShapeType = aPropOpt.GetCustomShapeType( rObj.GetShapeRef(), nMirrorFlags, sCustomShapeType );
     251 [ +  - ][ -  + ]:          3 :             if ( sCustomShapeType == "col-502ad400" || sCustomShapeType == "col-60da8460" )
                 [ -  + ]
     252                 :            :             {
     253 [ #  # ][ #  # ]:          0 :                 ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
                 [ #  # ]
     254 [ #  # ][ #  # ]:          0 :                 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
         [ #  # ][ #  # ]
     255                 :            :                 {
     256         [ #  # ]:          0 :                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
     257         [ #  # ]:          0 :                     aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );        // no fill
     258         [ #  # ]:          0 :                     aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );        // no linestyle
     259                 :          0 :                         SdrObject* pObj = GetSdrObjectFromXShape( rObj.GetShapeRef() );
     260         [ #  # ]:          0 :                     if ( pObj )
     261                 :            :                     {
     262         [ #  # ]:          0 :                         Rectangle aBound = pObj->GetCurrentBoundRect();
     263         [ #  # ]:          0 :                         Point aPosition( ImplMapPoint( aBound.TopLeft() ) );
     264 [ #  # ][ #  # ]:          0 :                         Size aSize( ImplMapSize( aBound.GetSize() ) );
     265         [ #  # ]:          0 :                         rObj.SetRect( Rectangle( aPosition, aSize ) );
     266                 :          0 :                         rObj.SetAngle( 0 );
     267                 :          0 :                         bDontWriteText = sal_True;
     268                 :            :                     }
     269                 :            :                 }
     270                 :            :             }
     271                 :            :             else
     272                 :            :             {
     273 [ +  - ][ +  - ]:          3 :                 ADD_SHAPE(
                 [ +  - ]
     274                 :            :                     sal::static_int_cast< sal_uInt16 >(eShapeType),
     275                 :            :                     nMirrorFlags | 0xa00 );
     276         [ +  - ]:          3 :                 aPropOpt.CreateCustomShapeProperties( eShapeType, rObj.GetShapeRef() );
     277         [ +  - ]:          3 :                 aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );
     278 [ +  - ][ -  + ]:          3 :                 if ( rObj.ImplGetText() )
     279                 :            :                 {
     280 [ #  # ][ #  # ]:          0 :                     if ( !aPropOpt.IsFontWork() )
     281                 :            :                         aPropOpt.CreateTextProperties( rObj.mXPropSet, mpEscherEx->QueryTextID(
     282 [ #  # ][ #  # ]:          0 :                             rObj.GetShapeRef(), rObj.GetShapeId() ), sal_True, sal_False );
     283                 :            :                 }
     284                 :          3 :             }
     285                 :            :         }
     286 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.Rectangle" ))
     287                 :            :         {
     288         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     289                 :            :             sal_Int32 nRadius = (sal_Int32)rObj.ImplGetInt32PropertyValue(
     290         [ #  # ]:          0 :                                             ::rtl::OUString( "CornerRadius" ));
     291         [ #  # ]:          0 :             if( nRadius )
     292                 :            :             {
     293         [ #  # ]:          0 :                 nRadius = ImplMapSize( Size( nRadius, 0 )).Width();
     294 [ #  # ][ #  # ]:          0 :                 ADD_SHAPE( ESCHER_ShpInst_RoundRectangle, 0xa00 );  // Flags: Connector | HasSpt
                 [ #  # ]
     295         [ #  # ]:          0 :                 sal_Int32 nLenght = rObj.GetRect().GetWidth();
     296 [ #  # ][ #  # ]:          0 :                 if ( nLenght > rObj.GetRect().GetHeight() )
     297         [ #  # ]:          0 :                     nLenght = rObj.GetRect().GetHeight();
     298                 :          0 :                 nLenght >>= 1;
     299         [ #  # ]:          0 :                 if ( nRadius >= nLenght )
     300                 :          0 :                     nRadius = 0x2a30;                           // 0x2a30 ist PPTs maximum radius
     301                 :            :                 else
     302                 :          0 :                     nRadius = ( 0x2a30 * nRadius ) / nLenght;
     303         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_adjustValue, nRadius );
     304                 :            :             }
     305                 :            :             else
     306                 :            :             {
     307 [ #  # ][ #  # ]:          0 :                 ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0xa00 );           // Flags: Connector | HasSpt
                 [ #  # ]
     308                 :            :             }
     309         [ #  # ]:          0 :             aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );
     310 [ #  # ][ #  # ]:          0 :             if( rObj.ImplGetText() )
     311                 :            :                 aPropOpt.CreateTextProperties( rObj.mXPropSet,
     312                 :          0 :                     mpEscherEx->QueryTextID( rObj.GetShapeRef(),
     313 [ #  # ][ #  # ]:          0 :                         rObj.GetShapeId() ), sal_False, sal_False );
     314                 :            :         }
     315 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.Ellipse" ))
     316                 :            :         {
     317                 :          0 :             CircleKind  eCircleKind = CircleKind_FULL;
     318                 :          0 :             PolyStyle   ePolyKind = PolyStyle();
     319 [ #  # ][ #  # ]:          0 :             if ( rObj.ImplGetPropertyValue( ::rtl::OUString( "CircleKind" ) ) )
     320                 :            :             {
     321                 :          0 :                 eCircleKind = *( (CircleKind*)rObj.GetUsrAny().getValue() );
     322   [ #  #  #  # ]:          0 :                 switch ( eCircleKind )
     323                 :            :                 {
     324                 :            :                     case CircleKind_SECTION :
     325                 :            :                     {
     326                 :          0 :                         ePolyKind = POLY_PIE;
     327                 :            :                     }
     328                 :          0 :                     break;
     329                 :            :                     case CircleKind_ARC :
     330                 :            :                     {
     331                 :          0 :                         ePolyKind = POLY_ARC;
     332                 :            :                     }
     333                 :          0 :                     break;
     334                 :            : 
     335                 :            :                     case CircleKind_CUT :
     336                 :            :                     {
     337                 :          0 :                         ePolyKind = POLY_CHORD;
     338                 :            :                     }
     339                 :          0 :                     break;
     340                 :            : 
     341                 :            :                     default:
     342                 :          0 :                         eCircleKind = CircleKind_FULL;
     343                 :            :                 }
     344                 :            :             }
     345         [ #  # ]:          0 :             if ( eCircleKind == CircleKind_FULL )
     346                 :            :             {
     347         [ #  # ]:          0 :                 mpEscherEx->OpenContainer( ESCHER_SpContainer );
     348 [ #  # ][ #  # ]:          0 :                 ADD_SHAPE( ESCHER_ShpInst_Ellipse, 0xa00 );         // Flags: Connector | HasSpt
                 [ #  # ]
     349         [ #  # ]:          0 :                 aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );
     350                 :            :             }
     351                 :            :             else
     352                 :            :             {
     353                 :            :                 sal_Int32 nStartAngle, nEndAngle;
     354 [ #  # ][ #  # ]:          0 :                 if ( !rObj.ImplGetPropertyValue( ::rtl::OUString( "CircleStartAngle" ) ) )
     355                 :            :                     break;
     356                 :          0 :                 nStartAngle = *( (sal_Int32*)rObj.GetUsrAny().getValue() );
     357 [ #  # ][ #  # ]:          0 :                 if( !rObj.ImplGetPropertyValue( ::rtl::OUString( "CircleEndAngle" ) ) )
     358                 :            :                     break;
     359                 :          0 :                 nEndAngle = *( (sal_Int32*)rObj.GetUsrAny().getValue() );
     360                 :            : 
     361                 :          0 :                 Point aStart, aEnd, aCenter;
     362                 :          0 :                 aStart.X() = (sal_Int32)( ( cos( (double)( nStartAngle *
     363                 :          0 :                                                 F_PI18000 ) ) * 100.0 ) );
     364                 :          0 :                 aStart.Y() = - (sal_Int32)( ( sin( (double)( nStartAngle *
     365                 :          0 :                                                 F_PI18000 ) ) * 100.0 ) );
     366                 :          0 :                 aEnd.X() = (sal_Int32)( ( cos( (double)( nEndAngle *
     367                 :          0 :                                                 F_PI18000 ) ) * 100.0 ) );
     368                 :          0 :                 aEnd.Y() = - (sal_Int32)( ( sin( (double)( nEndAngle *
     369                 :          0 :                                                 F_PI18000 ) ) * 100.0 ) );
     370                 :          0 :                 const Rectangle& rRect = aRect100thmm;
     371         [ #  # ]:          0 :                 aCenter.X() = rRect.Left() + ( rRect.GetWidth() / 2 );
     372         [ #  # ]:          0 :                 aCenter.Y() = rRect.Top() + ( rRect.GetHeight() / 2 );
     373                 :          0 :                 aStart.X() += aCenter.X();
     374                 :          0 :                 aStart.Y() += aCenter.Y();
     375                 :          0 :                 aEnd.X() += aCenter.X();
     376                 :          0 :                 aEnd.Y() += aCenter.Y();
     377         [ #  # ]:          0 :                 Polygon aPolygon( rRect, aStart, aEnd, ePolyKind );
     378         [ #  # ]:          0 :                 if( rObj.GetAngle() )
     379                 :            :                 {
     380         [ #  # ]:          0 :                     aPolygon.Rotate( rRect.TopLeft(), (sal_uInt16)( rObj.GetAngle() / 10 ) );
     381                 :          0 :                     rObj.SetAngle( 0 );
     382                 :            :                 }
     383         [ #  # ]:          0 :                 mpEscherEx->OpenContainer( ESCHER_SpContainer );
     384 [ #  # ][ #  # ]:          0 :                 ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 );        // Flags: Connector | HasSpt
                 [ #  # ]
     385                 :          0 :                 ::com::sun::star::awt::Rectangle aNewRect;
     386      [ #  #  # ]:          0 :                 switch ( ePolyKind )
     387                 :            :                 {
     388                 :            :                     case POLY_PIE :
     389                 :            :                     case POLY_CHORD :
     390                 :            :                     {
     391         [ #  # ]:          0 :                         aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, &aPolygon );
     392         [ #  # ]:          0 :                         aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True  );
     393                 :            :                     }
     394                 :          0 :                     break;
     395                 :            : 
     396                 :            :                     case POLY_ARC :
     397                 :            :                     {
     398         [ #  # ]:          0 :                         aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, &aPolygon );
     399         [ #  # ]:          0 :                         aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False );
     400                 :            :                     }
     401                 :          0 :                     break;
     402                 :            :                 }
     403                 :          0 :                 rObj.SetRect( Rectangle( ImplMapPoint( Point( aNewRect.X, aNewRect.Y ) ),
     404   [ #  #  #  # ]:          0 :                                             ImplMapSize( Size( aNewRect.Width, aNewRect.Height ) ) ) );
         [ #  # ][ #  # ]
     405                 :            :             }
     406 [ #  # ][ #  # ]:          0 :             if ( rObj.ImplGetText() )
     407                 :            :                 aPropOpt.CreateTextProperties( rObj.mXPropSet,
     408                 :          0 :                     mpEscherEx->QueryTextID( rObj.GetShapeRef(),
     409 [ #  # ][ #  # ]:          0 :                         rObj.GetShapeId() ), sal_False, sal_False );
     410                 :            : 
     411                 :            :         }
     412 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.Control" ))
     413                 :            :         {
     414                 :            :             break;
     415                 :            :         }
     416 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.Connector" ))
     417                 :            :         {
     418                 :            :             sal_uInt16 nSpType, nSpFlags;
     419                 :          0 :             ::com::sun::star::awt::Rectangle aNewRect;
     420         [ #  # ]:          0 :             if ( aPropOpt.CreateConnectorProperties( rObj.GetShapeRef(),
     421         [ #  # ]:          0 :                             rSolverContainer, aNewRect, nSpType, nSpFlags ) == sal_False )
     422                 :            :                 break;
     423                 :          0 :             rObj.SetRect( Rectangle( ImplMapPoint( Point( aNewRect.X, aNewRect.Y ) ),
     424   [ #  #  #  # ]:          0 :                                         ImplMapSize( Size( aNewRect.Width, aNewRect.Height ) ) ) );
                 [ #  # ]
     425                 :            : 
     426         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     427 [ #  # ][ #  # ]:          0 :             ADD_SHAPE( nSpType, nSpFlags );
                 [ #  # ]
     428                 :            :         }
     429 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.Measure" ))
     430                 :            :         {
     431                 :            :             break;
     432                 :            :         }
     433 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.Line" ))
     434                 :            :         {
     435                 :          0 :             ::com::sun::star::awt::Rectangle aNewRect;
     436         [ #  # ]:          0 :             aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_LINE, sal_False, aNewRect, NULL );
     437                 :          0 :             MapRect(rObj);
     438                 :            :             //i27942: Poly/Lines/Bezier do not support text.
     439                 :            : 
     440         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     441                 :          0 :             sal_uInt32 nFlags = 0xa00;      // Flags: Connector | HasSpt
     442         [ #  # ]:          0 :             if( aNewRect.Height < 0 )
     443                 :          0 :                 nFlags |= 0x80;             // Flags: VertMirror
     444         [ #  # ]:          0 :             if( aNewRect.Width < 0 )
     445                 :          0 :                 nFlags |= 0x40;             // Flags: HorzMirror
     446                 :            : 
     447 [ #  # ][ #  # ]:          0 :             ADD_SHAPE( ESCHER_ShpInst_Line, nFlags );
                 [ #  # ]
     448         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
     449         [ #  # ]:          0 :             aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False );
     450                 :          0 :             rObj.SetAngle( 0 );
     451                 :            :         }
     452 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.PolyPolygon" ))
     453                 :            :         {
     454 [ #  # ][ #  # ]:          0 :             if( rObj.ImplHasText() )
     455                 :            :             {
     456         [ #  # ]:          0 :                 nGrpShapeID = ImplEnterAdditionalTextGroup( rObj.GetShapeRef(), &rObj.GetRect() );
     457                 :          0 :                 bAdditionalText = sal_True;
     458                 :            :             }
     459         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     460 [ #  # ][ #  # ]:          0 :             ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 );        // Flags: Connector | HasSpt
                 [ #  # ]
     461                 :          0 :             ::com::sun::star::awt::Rectangle aNewRect;
     462         [ #  # ]:          0 :             aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, NULL );
     463                 :          0 :             MapRect(rObj);
     464         [ #  # ]:          0 :             aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );
     465                 :          0 :             rObj.SetAngle( 0 );
     466                 :            :         }
     467 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.PolyLine" ))
     468                 :            :         {
     469                 :            :             //i27942: Poly/Lines/Bezier do not support text.
     470                 :            : 
     471         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     472 [ #  # ][ #  # ]:          0 :             ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 );        // Flags: Connector | HasSpt
                 [ #  # ]
     473                 :          0 :             ::com::sun::star::awt::Rectangle aNewRect;
     474         [ #  # ]:          0 :             aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, NULL );
     475                 :          0 :             MapRect(rObj);
     476         [ #  # ]:          0 :             aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False );
     477                 :          0 :             rObj.SetAngle( 0 );
     478                 :            :         }
     479 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.OpenBezier" ) )
     480                 :            :         {
     481                 :            :             //i27942: Poly/Lines/Bezier do not support text.
     482                 :            : 
     483         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     484 [ #  # ][ #  # ]:          0 :             ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 );        // Flags: Connector | HasSpt
                 [ #  # ]
     485                 :          0 :             ::com::sun::star::awt::Rectangle aNewRect;
     486         [ #  # ]:          0 :             aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_True, aNewRect, NULL );
     487                 :          0 :             MapRect(rObj);
     488         [ #  # ]:          0 :             aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False );
     489                 :          0 :             rObj.SetAngle( 0 );
     490                 :            :         }
     491 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.ClosedBezier" ) )
     492                 :            :         {
     493 [ #  # ][ #  # ]:          0 :             if ( rObj.ImplHasText() )
     494                 :            :             {
     495         [ #  # ]:          0 :                 nGrpShapeID = ImplEnterAdditionalTextGroup( rObj.GetShapeRef(), &rObj.GetRect() );
     496                 :          0 :                 bAdditionalText = sal_True;
     497                 :            :             }
     498         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     499 [ #  # ][ #  # ]:          0 :             ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 );        // Flags: Connector | HasSpt
                 [ #  # ]
     500                 :          0 :             ::com::sun::star::awt::Rectangle aNewRect;
     501         [ #  # ]:          0 :             aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_True, aNewRect, NULL );
     502                 :          0 :             MapRect(rObj);
     503         [ #  # ]:          0 :             aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True );
     504                 :          0 :             rObj.SetAngle( 0 );
     505                 :            :         }
     506 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.GraphicObject" ))
     507                 :            :         {
     508         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     509                 :            : 
     510                 :            :             // a GraphicObject can also be a ClickMe element
     511 [ #  # ][ #  # ]:          0 :             if( rObj.IsEmptyPresObj() && ( ePageType == NORMAL ) )
                 [ #  # ]
     512                 :            :             {
     513 [ #  # ][ #  # ]:          0 :                 ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0x220 );               // Flags: HaveAnchor | HaveMaster
                 [ #  # ]
     514                 :          0 :                 sal_uInt32 nTxtBxId = mpEscherEx->QueryTextID( rObj.GetShapeRef(),
     515         [ #  # ]:          0 :                                                         rObj.GetShapeId() );
     516         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_lTxid, nTxtBxId );
     517         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
     518         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
     519         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
     520                 :            :             }
     521                 :            :             else
     522                 :            :             {
     523 [ #  # ][ #  # ]:          0 :                 if( rObj.ImplGetText() )
     524                 :            :                 {
     525                 :            :                     /* SJ #i34951#: because M. documents are not allowing GraphicObjects containing text, we
     526                 :            :                        have to create a simpe Rectangle with fill bitmap instead (while not allowing BitmapMode_Repeat).
     527                 :            :                     */
     528 [ #  # ][ #  # ]:          0 :                     ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0xa00 );           // Flags: Connector | HasSpt
                 [ #  # ]
     529 [ #  # ][ #  # ]:          0 :                     if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), sal_True,  sal_True, sal_False ) )
         [ #  # ][ #  # ]
     530                 :            :                     {
     531         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
     532         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
     533         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
     534         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x8000000 );
     535         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
     536 [ #  # ][ #  # ]:          0 :                         if ( rObj.ImplGetText() )
     537                 :            :                             aPropOpt.CreateTextProperties( rObj.mXPropSet,
     538                 :          0 :                                 mpEscherEx->QueryTextID( rObj.GetShapeRef(),
     539 [ #  # ][ #  # ]:          0 :                                     rObj.GetShapeId() ), sal_False, sal_False );
     540                 :            :                     }
     541                 :            :                 }
     542                 :            :                 else
     543                 :            :                 {
     544 [ #  # ][ #  # ]:          0 :                     ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
                 [ #  # ]
     545 [ #  # ][ #  # ]:          0 :                     if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), sal_False, sal_True ) )
         [ #  # ][ #  # ]
     546         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
     547                 :            :                 }
     548                 :            :             }
     549                 :            :         }
     550 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii(  "drawing.Text" ))
     551                 :            :         {
     552 [ #  # ][ #  # ]:          0 :             SHAPE_TEXT( sal_True );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     553                 :            :         }
     554 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.Page" ))
     555                 :            :         {
     556         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     557 [ #  # ][ #  # ]:          0 :             ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0xa00 );
                 [ #  # ]
     558         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x40004 );
     559         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_fFillOK, 0x100001 );
     560         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110011 );
     561         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90008 );
     562         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_fshadowObscured, 0x10001 );
     563                 :            :         }
     564 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.Frame" ))
     565                 :            :         {
     566                 :            :             break;
     567                 :            :         }
     568 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.OLE2" ))
     569                 :            :         {
     570         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     571 [ #  # ][ #  # ]:          0 :             if( rObj.IsEmptyPresObj() && ( ePageType == NORMAL ) )
                 [ #  # ]
     572                 :            :             {
     573 [ #  # ][ #  # ]:          0 :                 ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0x220 );               // Flags: HaveAnchor | HaveMaster
                 [ #  # ]
     574                 :          0 :                 sal_uInt32 nTxtBxId = mpEscherEx->QueryTextID( rObj.GetShapeRef(),
     575         [ #  # ]:          0 :                                                         rObj.GetShapeId() );
     576         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_lTxid, nTxtBxId );
     577         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
     578         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
     579         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
     580                 :            :             }
     581                 :            :             else
     582                 :            :             {
     583                 :            :                 //2do: could be made an option in HostAppData whether OLE object should be written or not
     584                 :          0 :                 sal_Bool bAppOLE = sal_True;
     585 [ #  # ][ #  # ]:          0 :                 ADD_SHAPE( ESCHER_ShpInst_PictureFrame,
         [ #  # ][ #  # ]
     586                 :            :                     0xa00 | (bAppOLE ? SHAPEFLAG_OLESHAPE : 0) );
     587 [ #  # ][ #  # ]:          0 :                 if ( aPropOpt.CreateOLEGraphicProperties( rObj.GetShapeRef() ) )
     588                 :            :                 {
     589         [ #  # ]:          0 :                     if ( bAppOLE )
     590                 :            :                     {   // snooped from Xcl hex dump, nobody knows the trouble I have seen
     591         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape,    0x00080008 );
     592         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_pictureId,     0x00000001 );
     593         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_fillColor,     0x08000041 );
     594         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x08000041 );
     595         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest,    0x00110010 );
     596         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_lineColor,     0x08000040 );
     597         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash,0x00080008 );
     598         [ #  # ]:          0 :                         aPropOpt.AddOpt( ESCHER_Prop_fPrint,            0x00080000 );
     599                 :            :                     }
     600         [ #  # ]:          0 :                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
     601                 :            :                 }
     602                 :            :             }
     603                 :            :         }
     604   [ #  #  #  # ]:          0 :         else if( '3' == rObj.GetType().GetChar(8 ) &&
                 [ #  # ]
     605                 :          0 :                  'D' == rObj.GetType().GetChar( 9 ) )   // drawing.3D
     606                 :            :         {
     607                 :            :             // SceneObject, CubeObject, SphereObject, LatheObject, ExtrudeObject, PolygonObject
     608 [ #  # ][ #  # ]:          0 :             if ( !rObj.ImplGetPropertyValue( ::rtl::OUString( "Bitmap" ) ) )
     609                 :            :                 break;
     610                 :            : 
     611         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     612 [ #  # ][ #  # ]:          0 :             ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
                 [ #  # ]
     613                 :            : 
     614 [ #  # ][ #  # ]:          0 :                 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ) ), sal_False ) )
         [ #  # ][ #  # ]
     615         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
     616                 :            :         }
     617 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.Caption" ))
     618                 :            :         {
     619                 :          0 :             rObj.SetAngle( 0 );
     620         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     621 [ #  # ][ #  # ]:          0 :             ADD_SHAPE( ESCHER_ShpInst_TextBox, 0xa00 );
                 [ #  # ]
     622 [ #  # ][ #  # ]:          0 :             if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
         [ #  # ][ #  # ]
     623         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
     624                 :            :         }
     625 [ #  # ][ #  # ]:          0 :         else if ( rObj.GetType().EqualsAscii( "drawing.dontknow" ))
     626                 :            :         {
     627                 :          0 :             rObj.SetAngle( 0 );
     628         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     629 [ #  # ][ #  # ]:          0 :             ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
                 [ #  # ]
     630 [ #  # ][ #  # ]:          0 :             if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
         [ #  # ][ #  # ]
     631         [ #  # ]:          0 :                 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
     632                 :            :         }
     633                 :            :         else
     634                 :            :         {
     635                 :            :             break;
     636                 :            :         }
     637         [ +  - ]:          3 :         aPropOpt.CreateShadowProperties( rObj.mXPropSet );
     638                 :            : 
     639         [ -  + ]:          6 :         if( USHRT_MAX != mpEscherEx->GetHellLayerId() &&
           [ #  #  #  # ]
                 [ -  + ]
     640 [ #  # ][ -  + ]:          3 :             rObj.ImplGetPropertyValue( ::rtl::OUString( "LayerID" ) ) &&
                 [ -  + ]
           [ #  #  #  # ]
     641                 :          0 :             (*((sal_uInt16*)rObj.GetUsrAny().getValue()) ) == mpEscherEx->GetHellLayerId() )
     642                 :            :         {
     643         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x200020 );
     644                 :            :         }
     645                 :            : 
     646                 :            :         {
     647                 :          3 :             Rectangle aRect( rObj.GetRect() );
     648         [ +  - ]:          3 :             aRect.Justify();
     649                 :          3 :             rObj.SetRect( aRect );
     650                 :            :         }
     651                 :            : 
     652         [ -  + ]:          3 :         if( rObj.GetAngle() )
     653         [ #  # ]:          0 :             ImplFlipBoundingBox( rObj, aPropOpt );
     654                 :            : 
     655         [ +  - ]:          3 :         aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
     656         [ +  - ]:          3 :         mpEscherEx->Commit( aPropOpt, rObj.GetRect() );
     657         [ -  + ]:          3 :         if( mpEscherEx->GetGroupLevel() > 1 )
     658         [ #  # ]:          0 :             mpEscherEx->AddChildAnchor( rObj.GetRect() );
     659                 :            : 
     660         [ -  + ]:          3 :         if ( mpHostAppData )
     661                 :            :         {   //! with AdditionalText the App has to control whether these are written or not
     662         [ #  # ]:          0 :             mpHostAppData->WriteClientAnchor( *mpEscherEx, rObj.GetRect() );
     663         [ #  # ]:          0 :             mpHostAppData->WriteClientData( *mpEscherEx );
     664         [ #  # ]:          0 :             if ( !bDontWriteText )
     665         [ #  # ]:          0 :                 mpHostAppData->WriteClientTextbox( *mpEscherEx );
     666                 :            :         }
     667         [ +  - ]:          3 :         mpEscherEx->CloseContainer();       // ESCHER_SpContainer
     668                 :            : 
     669         [ -  + ]:          3 :         if( bAdditionalText )
     670                 :            :         {
     671         [ #  # ]:          0 :             mpEscherEx->EndShape( nShapeType, nShapeID );
     672         [ #  # ]:          3 :             ImplWriteAdditionalText( rObj, aTextRefPoint );
     673 [ +  - ][ -  + ]:          3 :         }
                 [ +  - ]
     674                 :            : 
     675                 :            :     } while ( 0 );
     676                 :            : 
     677         [ -  + ]:          3 :     if ( bAdditionalText )
     678                 :          0 :         mpEscherEx->EndShape( ESCHER_ShpInst_Min, nGrpShapeID );
     679                 :            :     else
     680                 :          3 :         mpEscherEx->EndShape( nShapeType, nShapeID );
     681                 :          3 :     return nShapeID;
     682                 :            : }
     683                 :            : 
     684                 :          0 : void ImplEESdrWriter::ImplWriteAdditionalText( ImplEESdrObject& rObj,
     685                 :            :                                                 const Point& rTextRefPoint )
     686                 :            : {
     687                 :          0 :     sal_uInt32 nShapeID = 0;
     688                 :          0 :     sal_uInt16 nShapeType = 0;
     689                 :            :     do
     690                 :            :     {
     691 [ #  # ][ #  # ]:          0 :         mpHostAppData = mpEscherEx->StartShape( rObj.GetShapeRef(), (mpEscherEx->GetGroupLevel() > 1) ? &rObj.GetRect() : 0 );
     692 [ #  # ][ #  # ]:          0 :         if ( mpHostAppData && mpHostAppData->DontWriteShape() )
                 [ #  # ]
     693                 :            :             break;
     694                 :            : 
     695 [ #  # ][ #  # ]:          0 :         const ::com::sun::star::awt::Size   aSize100thmm( rObj.GetShapeRef()->getSize() );
     696 [ #  # ][ #  # ]:          0 :         const ::com::sun::star::awt::Point  aPoint100thmm( rObj.GetShapeRef()->getPosition() );
     697         [ #  # ]:          0 :         Rectangle   aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
     698         [ #  # ]:          0 :         if ( !mpPicStrm )
     699         [ #  # ]:          0 :             mpPicStrm = mpEscherEx->QueryPictureStream();
     700 [ #  # ][ #  # ]:          0 :         EscherPropertyContainer aPropOpt( mpEscherEx->GetGraphicProvider(), mpPicStrm, aRect100thmm );
     701         [ #  # ]:          0 :         rObj.SetAngle( rObj.ImplGetInt32PropertyValue( ::rtl::OUString( "RotateAngle" )));
     702                 :          0 :         sal_Int32 nAngle = rObj.GetAngle();
     703 [ #  # ][ #  # ]:          0 :         if( rObj.GetType().EqualsAscii( "drawing.Line" ))
     704                 :            :         {
     705                 :            : //2do: this does not work right
     706         [ #  # ]:          0 :             double fDist = hypot( rObj.GetRect().GetWidth(),
     707         [ #  # ]:          0 :                                     rObj.GetRect().GetHeight() );
     708                 :            :             rObj.SetRect( Rectangle( rTextRefPoint,
     709         [ #  # ]:          0 :                             Point( (sal_Int32)( rTextRefPoint.X() + fDist ), rTextRefPoint.Y() - 1 ) ) );
     710                 :            : 
     711         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     712         [ #  # ]:          0 :             mpEscherEx->AddShape( ESCHER_ShpInst_TextBox, 0xa00 );
     713 [ #  # ][ #  # ]:          0 :             if ( rObj.ImplGetText() )
     714                 :            :                 aPropOpt.CreateTextProperties( rObj.mXPropSet,
     715                 :          0 :                     mpEscherEx->QueryTextID( rObj.GetShapeRef(),
     716 [ #  # ][ #  # ]:          0 :                         rObj.GetShapeId() ) );
     717                 :            : 
     718         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
     719         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
     720         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x60006 );     // Size Shape To Fit Text
     721         [ #  # ]:          0 :             if ( nAngle < 0 )
     722                 :          0 :                 nAngle = ( 36000 + nAngle ) % 36000;
     723         [ #  # ]:          0 :             if ( nAngle )
     724         [ #  # ]:          0 :                 ImplFlipBoundingBox( rObj, aPropOpt );
     725                 :            :         }
     726                 :            :         else
     727                 :            :         {
     728         [ #  # ]:          0 :             mpEscherEx->OpenContainer( ESCHER_SpContainer );
     729         [ #  # ]:          0 :             nShapeID = mpEscherEx->GenerateShapeId();
     730         [ #  # ]:          0 :             mpEscherEx->AddShape( nShapeType = ESCHER_ShpInst_TextBox, 0xa00, nShapeID );
     731 [ #  # ][ #  # ]:          0 :             if ( rObj.ImplGetText() )
     732                 :            :                 aPropOpt.CreateTextProperties( rObj.mXPropSet,
     733                 :          0 :                     mpEscherEx->QueryTextID( rObj.GetShapeRef(),
     734 [ #  # ][ #  # ]:          0 :                         rObj.GetShapeId() ) );
     735         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
     736         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
     737                 :            : 
     738         [ #  # ]:          0 :             if( nAngle < 0 )
     739                 :          0 :                 nAngle = ( 36000 + nAngle ) % 36000;
     740                 :            :             else
     741                 :          0 :                 nAngle = ( 36000 - ( nAngle % 36000 ) );
     742                 :            : 
     743                 :          0 :             nAngle *= 655;
     744                 :          0 :             nAngle += 0x8000;
     745                 :          0 :             nAngle &=~0xffff;   // nAngle auf volle Gradzahl runden
     746         [ #  # ]:          0 :             aPropOpt.AddOpt( ESCHER_Prop_Rotation, nAngle );
     747                 :            :             mpEscherEx->SetGroupSnapRect( mpEscherEx->GetGroupLevel(),
     748         [ #  # ]:          0 :                                             rObj.GetRect() );
     749                 :            :             mpEscherEx->SetGroupLogicRect( mpEscherEx->GetGroupLevel(),
     750         [ #  # ]:          0 :                                             rObj.GetRect() );
     751                 :            :         }
     752                 :          0 :         rObj.SetAngle( nAngle );
     753         [ #  # ]:          0 :         aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
     754         [ #  # ]:          0 :         mpEscherEx->Commit( aPropOpt, rObj.GetRect() );
     755                 :            : 
     756                 :            :         // write the childanchor
     757         [ #  # ]:          0 :         mpEscherEx->AddChildAnchor( rObj.GetRect() );
     758                 :            : 
     759                 :            : #if defined EES_WRITE_EPP
     760                 :            :         // ClientAnchor
     761                 :            :         mpEscherEx->AddClientAnchor( maRect );
     762                 :            :         // ClientTextbox
     763                 :            :         mpEscherEx->OpenContainer( ESCHER_ClientTextbox );
     764                 :            :         mpEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
     765                 :            :         *mpStrm << (sal_uInt32)EPP_TEXTTYPE_Other;                              // Text in a Shape
     766                 :            :         ImplWriteTextStyleAtom();
     767                 :            :         mpEscherEx->CloseContainer();   // ESCHER_ClientTextBox
     768                 :            : #else // !EES_WRITE_EPP
     769         [ #  # ]:          0 :         if ( mpHostAppData )
     770                 :            :         {   //! the App has to control whether these are written or not
     771         [ #  # ]:          0 :             mpHostAppData->WriteClientAnchor( *mpEscherEx, rObj.GetRect() );
     772         [ #  # ]:          0 :             mpHostAppData->WriteClientData( *mpEscherEx );
     773         [ #  # ]:          0 :             mpHostAppData->WriteClientTextbox( *mpEscherEx );
     774                 :            :         }
     775                 :            : #endif // EES_WRITE_EPP
     776 [ #  # ][ #  # ]:          0 :         mpEscherEx->CloseContainer();   // ESCHER_SpContainer
     777                 :            :     } while ( 0 );
     778                 :          0 :     mpEscherEx->LeaveGroup();
     779                 :          0 :     mpEscherEx->EndShape( nShapeType, nShapeID );
     780                 :          0 : }
     781                 :            : 
     782                 :            : 
     783                 :          0 : sal_uInt32 ImplEESdrWriter::ImplEnterAdditionalTextGroup( const Reference< XShape >& rShape,
     784                 :            :             const Rectangle* pBoundRect )
     785                 :            : {
     786                 :          0 :     mpHostAppData = mpEscherEx->EnterAdditionalTextGroup();
     787                 :          0 :     sal_uInt32 nGrpId = mpEscherEx->EnterGroup( pBoundRect );
     788                 :          0 :     mpHostAppData = mpEscherEx->StartShape( rShape, pBoundRect );
     789                 :          0 :     return nGrpId;
     790                 :            : }
     791                 :            : 
     792                 :            : 
     793                 :          3 : sal_Bool ImplEESdrWriter::ImplInitPageValues()
     794                 :            : {
     795                 :          3 :     mnIndices = 0;
     796                 :          3 :     mnOutlinerCount = 0;                // die gliederungsobjekte muessen dem layout entsprechen,
     797                 :          3 :     mnEffectCount = 0;
     798                 :          3 :     mbIsTitlePossible = sal_True;           // bei mehr als einem title geht powerpoint in die knie
     799                 :            : 
     800                 :          3 :     return sal_True;
     801                 :            : }
     802                 :            : 
     803                 :          0 : void ImplEESdrWriter::ImplWritePage(
     804                 :            :             EscherSolverContainer& rSolverContainer,
     805                 :            :             ImplEESdrPageType ePageType, sal_Bool /* bBackGround */ )
     806                 :            : {
     807                 :          0 :     ImplInitPageValues();
     808                 :            : 
     809                 :          0 :     sal_uInt32 nLastPer = 0, nShapes = mXShapes->getCount();
     810         [ #  # ]:          0 :     for( sal_uInt32 n = 0; n < nShapes; ++n )
     811                 :            :     {
     812                 :          0 :         sal_uInt32 nPer = ( 5 * n ) / nShapes;
     813         [ #  # ]:          0 :         if( nPer != nLastPer )
     814                 :            :         {
     815                 :          0 :             nLastPer = nPer;
     816                 :          0 :             sal_uInt32 nValue = mnPagesWritten * 5 + nPer;
     817         [ #  # ]:          0 :             if( nValue > mnStatMaxValue )
     818                 :          0 :                 nValue = mnStatMaxValue;
     819         [ #  # ]:          0 :             if( mbStatusIndicator )
     820 [ #  # ][ #  # ]:          0 :                 mXStatusIndicator->setValue( nValue );
     821                 :            :         }
     822                 :            : 
     823                 :            :         ImplEESdrObject aObj( *this, *(Reference< XShape >*)
     824 [ #  # ][ #  # ]:          0 :                                     mXShapes->getByIndex( n ).getValue() );
                 [ #  # ]
     825         [ #  # ]:          0 :         if( aObj.IsValid() )
     826                 :            :         {
     827         [ #  # ]:          0 :             ImplWriteShape( aObj, rSolverContainer, ePageType );
     828                 :            :         }
     829         [ #  # ]:          0 :     }
     830                 :          0 :     mnPagesWritten++;
     831                 :          0 : }
     832                 :            : 
     833                 :        141 : ImplEscherExSdr::ImplEscherExSdr( EscherEx& rEx )
     834                 :            :         :
     835                 :            :         ImplEESdrWriter( rEx ),
     836                 :            :         mpSdrPage( NULL ),
     837                 :        141 :         mpSolverContainer( NULL )
     838                 :            : {
     839                 :        141 : }
     840                 :            : 
     841                 :            : 
     842                 :        141 : ImplEscherExSdr::~ImplEscherExSdr()
     843                 :            : {
     844                 :            :     DBG_ASSERT( !mpSolverContainer, "ImplEscherExSdr::~ImplEscherExSdr: unwritten SolverContainer" );
     845 [ +  + ][ +  - ]:        141 :     delete mpSolverContainer;
     846         [ -  + ]:        282 : }
     847                 :            : 
     848                 :            : 
     849                 :          3 : bool ImplEscherExSdr::ImplInitPage( const SdrPage& rPage )
     850                 :            : {
     851                 :            :     do
     852                 :            :     {
     853                 :            :         SvxDrawPage* pSvxDrawPage;
     854 [ -  + ][ #  # ]:          3 :         if ( mpSdrPage != &rPage || !mXDrawPage.is() )
                 [ +  - ]
     855                 :            :         {
     856                 :            :             // eventually write SolverContainer of current page, deletes the Solver
     857                 :          3 :             ImplFlushSolverContainer();
     858                 :            : 
     859                 :          3 :             mpSdrPage = NULL;
     860 [ +  - ][ +  - ]:          3 :             mXDrawPage = pSvxDrawPage = new SvxFmDrawPage( (SdrPage*) &rPage );
     861         [ +  - ]:          3 :             mXShapes = Reference< XShapes >::query( mXDrawPage );
     862         [ -  + ]:          3 :             if ( !mXShapes.is() )
     863                 :          0 :                 break;
     864         [ -  + ]:          3 :             if ( !ImplInitPageValues() )    // ImplEESdrWriter
     865                 :          0 :                 break;
     866                 :          3 :             mpSdrPage = &rPage;
     867                 :            : 
     868         [ +  - ]:          3 :             mpSolverContainer = new EscherSolverContainer;
     869                 :            :         }
     870                 :            :         else
     871                 :          0 :             pSvxDrawPage = SvxDrawPage::getImplementation(mXDrawPage);
     872                 :            : 
     873                 :          3 :         return pSvxDrawPage != 0;
     874                 :            :     } while ( 0 );
     875                 :            : 
     876                 :          3 :     return false;
     877                 :            : }
     878                 :            : 
     879                 :          0 : bool ImplEscherExSdr::ImplInitUnoShapes( const Reference< XShapes >& rxShapes )
     880                 :            : {
     881                 :            :     // eventually write SolverContainer of current page, deletes the Solver
     882                 :          0 :     ImplFlushSolverContainer();
     883                 :            : 
     884         [ #  # ]:          0 :     if( !rxShapes.is() )
     885                 :          0 :         return false;
     886                 :            : 
     887                 :          0 :     mpSdrPage = 0;
     888                 :          0 :     mXDrawPage.clear();
     889                 :          0 :     mXShapes = rxShapes;
     890                 :            : 
     891         [ #  # ]:          0 :     if( !ImplInitPageValues() )    // ImplEESdrWriter
     892                 :          0 :         return false;
     893                 :            : 
     894         [ #  # ]:          0 :     mpSolverContainer = new EscherSolverContainer;
     895                 :          0 :     return true;
     896                 :            : }
     897                 :            : 
     898                 :          9 : void ImplEscherExSdr::ImplExitPage()
     899                 :            : {
     900                 :            :     // close all groups before the solver container is written
     901         [ +  + ]:         18 :     while( mpEscherEx->GetGroupLevel() )
     902                 :          9 :         mpEscherEx->LeaveGroup();
     903                 :            : 
     904                 :          9 :     ImplFlushSolverContainer();
     905                 :          9 :     mpSdrPage = NULL;   // reset page for next init
     906                 :          9 : }
     907                 :            : 
     908                 :            : 
     909                 :         12 : void ImplEscherExSdr::ImplFlushSolverContainer()
     910                 :            : {
     911         [ -  + ]:         12 :     if ( mpSolverContainer )
     912                 :            :     {
     913                 :          0 :         mpSolverContainer->WriteSolver( mpEscherEx->GetStream() );
     914         [ #  # ]:          0 :         delete mpSolverContainer;
     915                 :          0 :         mpSolverContainer = NULL;
     916                 :            :     }
     917                 :         12 : }
     918                 :            : 
     919                 :            : 
     920                 :          0 : void ImplEscherExSdr::ImplWriteCurrentPage()
     921                 :            : {
     922                 :            :     DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteCurrentPage: no SolverContainer" );
     923                 :          0 :     ImplWritePage( *mpSolverContainer, NORMAL );
     924                 :          0 :     ImplExitPage();
     925                 :          0 : }
     926                 :            : 
     927                 :            : 
     928                 :          3 : sal_uInt32 ImplEscherExSdr::ImplWriteTheShape( ImplEESdrObject& rObj )
     929                 :            : {
     930                 :            :     DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteShape: no SolverContainer" );
     931                 :          3 :     return ImplWriteShape( rObj, *mpSolverContainer, NORMAL );
     932                 :            : }
     933                 :            : 
     934                 :            : 
     935                 :          0 : void EscherEx::AddSdrPage( const SdrPage& rPage )
     936                 :            : {
     937         [ #  # ]:          0 :     if ( mpImplEscherExSdr->ImplInitPage( rPage ) )
     938                 :          0 :         mpImplEscherExSdr->ImplWriteCurrentPage();
     939                 :          0 : }
     940                 :            : 
     941                 :          0 : void EscherEx::AddUnoShapes( const Reference< XShapes >& rxShapes )
     942                 :            : {
     943         [ #  # ]:          0 :     if ( mpImplEscherExSdr->ImplInitUnoShapes( rxShapes ) )
     944                 :          0 :         mpImplEscherExSdr->ImplWriteCurrentPage();
     945                 :          0 : }
     946                 :            : 
     947                 :          3 : sal_uInt32 EscherEx::AddSdrObject( const SdrObject& rObj )
     948                 :            : {
     949         [ +  - ]:          3 :     ImplEESdrObject aObj( *mpImplEscherExSdr, rObj );
     950         [ +  - ]:          3 :     if( aObj.IsValid() )
     951         [ +  - ]:          3 :         return mpImplEscherExSdr->ImplWriteTheShape( aObj );
     952         [ +  - ]:          3 :     return 0;
     953                 :            : }
     954                 :            : 
     955                 :            : 
     956                 :          9 : void EscherEx::EndSdrObjectPage()
     957                 :            : {
     958                 :          9 :     mpImplEscherExSdr->ImplExitPage();
     959                 :          9 : }
     960                 :            : 
     961                 :          3 : EscherExHostAppData* EscherEx::StartShape( const Reference< XShape >& /* rShape */, const Rectangle* /*pChildAnchor*/ )
     962                 :            : {
     963                 :          3 :     return NULL;
     964                 :            : }
     965                 :            : 
     966                 :          3 : void EscherEx::EndShape( sal_uInt16 /* nShapeType */, sal_uInt32 /* nShapeID */ )
     967                 :            : {
     968                 :          3 : }
     969                 :            : 
     970                 :          0 : sal_uInt32 EscherEx::QueryTextID( const Reference< XShape >&, sal_uInt32 )
     971                 :            : {
     972                 :          0 :     return 0;
     973                 :            : }
     974                 :            : 
     975                 :            : // add an dummy rectangle shape into the escher stream
     976                 :          0 : sal_uInt32 EscherEx::AddDummyShape()
     977                 :            : {
     978                 :          0 :     OpenContainer( ESCHER_SpContainer );
     979                 :          0 :     sal_uInt32 nShapeID = GenerateShapeId();
     980                 :          0 :     AddShape( ESCHER_ShpInst_Rectangle, 0xa00, nShapeID );
     981                 :          0 :     CloseContainer();
     982                 :            : 
     983                 :          0 :     return nShapeID;
     984                 :            : }
     985                 :            : 
     986                 :            : // static
     987                 :          3 : const SdrObject* EscherEx::GetSdrObject( const Reference< XShape >& rShape )
     988                 :            : {
     989                 :          3 :     const SdrObject* pRet = 0;
     990                 :          3 :     const SvxShape* pSvxShape = SvxShape::getImplementation( rShape );
     991                 :            :     DBG_ASSERT( pSvxShape, "EscherEx::GetSdrObject: no SvxShape" );
     992         [ +  - ]:          3 :     if( pSvxShape )
     993                 :            :     {
     994                 :          3 :         pRet = pSvxShape->GetSdrObject();
     995                 :            :         DBG_ASSERT( pRet, "EscherEx::GetSdrObject: no SdrObj" );
     996                 :            :     }
     997                 :          3 :     return pRet;
     998                 :            : }
     999                 :            : 
    1000                 :            : 
    1001                 :          3 : ImplEESdrObject::ImplEESdrObject( ImplEscherExSdr& rEx,
    1002                 :            :                                     const SdrObject& rObj ) :
    1003                 :            :     mnShapeId( 0 ),
    1004                 :            :     mnTextSize( 0 ),
    1005                 :            :     mnAngle( 0 ),
    1006                 :            :     mbValid( sal_False ),
    1007                 :            :     mbPresObj( sal_False ),
    1008 [ +  - ][ +  - ]:          3 :     mbEmptyPresObj( sal_False )
    1009                 :            : {
    1010         [ +  - ]:          3 :     SdrPage* pPage = rObj.GetPage();
    1011                 :            :     DBG_ASSERT( pPage, "ImplEESdrObject::ImplEESdrObject: no SdrPage" );
    1012 [ +  - ][ +  - ]:          3 :     if( pPage && rEx.ImplInitPage( *pPage ) )
         [ +  - ][ +  - ]
    1013                 :            :     {
    1014                 :            :         // why not declare a const parameter if the object will
    1015                 :            :         // not be modified?
    1016 [ +  - ][ +  - ]:          3 :         mXShape = uno::Reference< drawing::XShape >::query( ((SdrObject*)&rObj)->getUnoShape() );
                 [ +  - ]
    1017         [ +  - ]:          3 :         Init( rEx );
    1018                 :            :     }
    1019                 :          3 : }
    1020                 :            : 
    1021                 :          0 : ImplEESdrObject::ImplEESdrObject( ImplEESdrWriter& rEx,
    1022                 :            :                                     const Reference< XShape >& rShape ) :
    1023                 :            :     mXShape( rShape ),
    1024                 :            :     mnShapeId( 0 ),
    1025                 :            :     mnTextSize( 0 ),
    1026                 :            :     mnAngle( 0 ),
    1027                 :            :     mbValid( sal_False ),
    1028                 :            :     mbPresObj( sal_False ),
    1029 [ #  # ][ #  # ]:          0 :     mbEmptyPresObj( sal_False )
    1030                 :            : {
    1031         [ #  # ]:          0 :     Init( rEx );
    1032                 :          0 : }
    1033                 :            : 
    1034                 :            : 
    1035         [ +  - ]:          3 : ImplEESdrObject::~ImplEESdrObject()
    1036                 :            : {
    1037                 :          3 : }
    1038                 :            : 
    1039                 :          3 : void ImplEESdrObject::Init( ImplEESdrWriter& rEx )
    1040                 :            : {
    1041         [ +  - ]:          3 :     mXPropSet = Reference< XPropertySet >::query( mXShape );
    1042         [ +  - ]:          3 :     if( mXPropSet.is() )
    1043                 :            :     {
    1044                 :            :         static const sal_Char aPrefix[] = "com.sun.star.";
    1045                 :            :         static const xub_StrLen nPrefix = sizeof(aPrefix)-1;
    1046 [ +  - ][ +  - ]:          3 :         SetRect( rEx.ImplMapPoint( Point( mXShape->getPosition().X, mXShape->getPosition().Y ) ),
         [ +  - ][ +  - ]
    1047 [ +  - ][ +  - ]:          6 :                  rEx.ImplMapSize( Size( mXShape->getSize().Width, mXShape->getSize().Height ) ) );
           [ +  -  +  - ]
                 [ +  - ]
    1048 [ +  - ][ +  - ]:          3 :         mType = String( mXShape->getShapeType() );
                 [ +  - ]
    1049                 :          3 :         mType.Erase( 0, nPrefix );  // strip "com.sun.star."
    1050                 :          3 :         xub_StrLen nPos = mType.SearchAscii( "Shape" );
    1051                 :          3 :         mType.Erase( nPos, 5 );
    1052                 :            : 
    1053 [ +  - ][ +  - ]:          3 :         static const OUString sPresStr("IsPresentationObject" );
    1054 [ +  - ][ +  - ]:          3 :         static const OUString sEmptyPresStr("IsEmptyPresentationObject" );
    1055                 :            : 
    1056         [ -  + ]:          3 :         if( ImplGetPropertyValue( sPresStr ) )
    1057                 :          0 :             mbPresObj = ::cppu::any2bool( mAny );
    1058                 :            : 
    1059 [ -  + ][ #  # ]:          3 :         if( mbPresObj && ImplGetPropertyValue( sEmptyPresStr ) )
                 [ -  + ]
    1060                 :          0 :             mbEmptyPresObj = ::cppu::any2bool( mAny );
    1061                 :            : 
    1062                 :          3 :         mbValid = sal_True;
    1063                 :            :     }
    1064                 :          3 : }
    1065                 :            : 
    1066                 :          9 : sal_Bool ImplEESdrObject::ImplGetPropertyValue( const sal_Unicode* rString )
    1067                 :            : {
    1068                 :          9 :     sal_Bool bRetValue = sal_False;
    1069         [ +  + ]:          9 :     if( mbValid )
    1070                 :            :     {
    1071                 :            :         try
    1072                 :            :         {
    1073 [ +  - ][ +  - ]:          6 :             mAny = mXPropSet->getPropertyValue( rString );
                 [ #  # ]
    1074         [ +  - ]:          6 :             if( mAny.hasValue() )
    1075                 :          6 :                 bRetValue = sal_True;
    1076                 :            :         }
    1077                 :          0 :         catch( const ::com::sun::star::uno::Exception& )
    1078                 :            :         {
    1079                 :          0 :             bRetValue = sal_False;
    1080                 :            :         }
    1081                 :            :     }
    1082                 :          9 :     return bRetValue;
    1083                 :            : }
    1084                 :            : 
    1085                 :            : #ifdef USED
    1086                 :            : sal_Bool ImplEESdrObject::ImplGetPropertyValue( const Reference< XPropertySet >& rXPropSet,
    1087                 :            :                                             const OUString& rString )
    1088                 :            : {
    1089                 :            :     sal_Bool bRetValue = sal_False;
    1090                 :            :     if( mbValid )
    1091                 :            :     {
    1092                 :            :         try
    1093                 :            :         {
    1094                 :            :             mAny = rXPropSet->getPropertyValue( rString );
    1095                 :            :             if( 0 != mAny.get() )
    1096                 :            :                 bRetValue = sal_True;
    1097                 :            :         }
    1098                 :            :         catch( const ::com::sun::star::uno::Exception& )
    1099                 :            :         {
    1100                 :            :             bRetValue = sal_False;
    1101                 :            :         }
    1102                 :            :     }
    1103                 :            :     return bRetValue;
    1104                 :            : }
    1105                 :            : #endif
    1106                 :            : 
    1107                 :          3 : void ImplEESdrObject::SetRect( const Point& rPos, const Size& rSz )
    1108                 :            : {
    1109                 :          3 :     maRect = Rectangle( rPos, rSz );
    1110                 :          3 : }
    1111                 :            : 
    1112                 :          3 : const SdrObject* ImplEESdrObject::GetSdrObject() const
    1113                 :            : {
    1114                 :          3 :     return EscherEx::GetSdrObject( mXShape );
    1115                 :            : }
    1116                 :            : 
    1117                 :            : //  loads and  converts text from shape, result is being saved in mnTextSize respeichert
    1118                 :          3 : sal_uInt32 ImplEESdrObject::ImplGetText()
    1119                 :            : {
    1120         [ +  - ]:          3 :     Reference< XText > xXText( mXShape, UNO_QUERY );
    1121                 :          3 :     mnTextSize = 0;
    1122         [ +  - ]:          3 :     if( xXText.is() )
    1123 [ +  - ][ +  - ]:          3 :         mnTextSize = xXText->getString().getLength();
    1124                 :          3 :     return mnTextSize;
    1125                 :            : }
    1126                 :            : 
    1127                 :          0 : sal_Bool ImplEESdrObject::ImplHasText() const
    1128                 :            : {
    1129         [ #  # ]:          0 :     Reference< XText > xXText( mXShape, UNO_QUERY );
    1130 [ #  # ][ #  # ]:          0 :     return xXText.is() && !xXText->getString().isEmpty();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1131                 :            : }
    1132                 :            : 
    1133                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10