LCOV - code coverage report
Current view: top level - xmloff/source/draw - ximpshap.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 801 1697 47.2 %
Date: 2012-08-25 Functions: 85 245 34.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 785 3247 24.2 %

           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 <tools/debug.hxx>
      30                 :            : #include <com/sun/star/document/XEventsSupplier.hpp>
      31                 :            : #include <com/sun/star/container/XNameReplace.hpp>
      32                 :            : #include <com/sun/star/presentation/ClickAction.hpp>
      33                 :            : #include <com/sun/star/drawing/FillStyle.hpp>
      34                 :            : #include <com/sun/star/drawing/LineStyle.hpp>
      35                 :            : #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
      36                 :            : #include <com/sun/star/drawing/XGluePointsSupplier.hpp>
      37                 :            : #include <com/sun/star/container/XIdentifierAccess.hpp>
      38                 :            : #include <com/sun/star/drawing/GluePoint2.hpp>
      39                 :            : #include <com/sun/star/drawing/Alignment.hpp>
      40                 :            : #include <com/sun/star/drawing/EscapeDirection.hpp>
      41                 :            : #include <com/sun/star/media/ZoomLevel.hpp>
      42                 :            : #include <com/sun/star/awt/Rectangle.hpp>
      43                 :            : 
      44                 :            : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      45                 :            : #include <com/sun/star/container/XNameAccess.hpp>
      46                 :            : #include <comphelper/extract.hxx>
      47                 :            : #include "ximpshap.hxx"
      48                 :            : #include <xmloff/XMLBase64ImportContext.hxx>
      49                 :            : #include <xmloff/XMLShapeStyleContext.hxx>
      50                 :            : #include <xmloff/xmluconv.hxx>
      51                 :            : #include <com/sun/star/container/XNamed.hpp>
      52                 :            : #include <com/sun/star/drawing/CircleKind.hpp>
      53                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      54                 :            : #include <com/sun/star/awt/XControlModel.hpp>
      55                 :            : #include <com/sun/star/drawing/XControlShape.hpp>
      56                 :            : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
      57                 :            : #include <com/sun/star/drawing/PointSequence.hpp>
      58                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      59                 :            : #include <com/sun/star/util/XCloneable.hpp>
      60                 :            : #include <com/sun/star/beans/XMultiPropertyStates.hpp>
      61                 :            : #include "xexptran.hxx"
      62                 :            : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      63                 :            : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      64                 :            : #include <com/sun/star/drawing/ConnectorType.hpp>
      65                 :            : #include <com/sun/star/drawing/HomogenMatrix3.hpp>
      66                 :            : 
      67                 :            : #include <sax/tools/converter.hxx>
      68                 :            : 
      69                 :            : #include "PropertySetMerger.hxx"
      70                 :            : #include <xmloff/families.hxx>
      71                 :            : #include "ximpstyl.hxx"
      72                 :            : #include"xmloff/xmlnmspe.hxx"
      73                 :            : #include <xmloff/xmltoken.hxx>
      74                 :            : #include "EnhancedCustomShapeToken.hxx"
      75                 :            : #include "XMLReplacementImageContext.hxx"
      76                 :            : #include "XMLImageMapContext.hxx"
      77                 :            : #include "sdpropls.hxx"
      78                 :            : #include "eventimp.hxx"
      79                 :            : 
      80                 :            : #include "descriptionimp.hxx"
      81                 :            : #include "ximpcustomshape.hxx"
      82                 :            : #include "XMLEmbeddedObjectImportContext.hxx"
      83                 :            : #include "xmloff/xmlerror.hxx"
      84                 :            : #include <basegfx/matrix/b2dhommatrix.hxx>
      85                 :            : #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
      86                 :            : #include <com/sun/star/text/XTextDocument.hpp>
      87                 :            : 
      88                 :            : using ::rtl::OUString;
      89                 :            : using ::rtl::OUStringBuffer;
      90                 :            : 
      91                 :            : using namespace ::com::sun::star;
      92                 :            : using namespace ::com::sun::star::uno;
      93                 :            : using namespace ::com::sun::star::drawing;
      94                 :            : using namespace ::com::sun::star::style;
      95                 :            : using namespace ::com::sun::star::container;
      96                 :            : using namespace ::com::sun::star::document;
      97                 :            : using namespace ::xmloff::token;
      98                 :            : using namespace ::xmloff::EnhancedCustomShapeToken;
      99                 :            : 
     100                 :            : SvXMLEnumMapEntry aXML_GlueAlignment_EnumMap[] =
     101                 :            : {
     102                 :            :     { XML_TOP_LEFT,     drawing::Alignment_TOP_LEFT },
     103                 :            :     { XML_TOP,          drawing::Alignment_TOP },
     104                 :            :     { XML_TOP_RIGHT,    drawing::Alignment_TOP_RIGHT },
     105                 :            :     { XML_LEFT,         drawing::Alignment_LEFT },
     106                 :            :     { XML_CENTER,       drawing::Alignment_CENTER },
     107                 :            :     { XML_RIGHT,        drawing::Alignment_RIGHT },
     108                 :            :     { XML_BOTTOM_LEFT,  drawing::Alignment_BOTTOM_LEFT },
     109                 :            :     { XML_BOTTOM,       drawing::Alignment_BOTTOM },
     110                 :            :     { XML_BOTTOM_RIGHT, drawing::Alignment_BOTTOM_RIGHT },
     111                 :            :     { XML_TOKEN_INVALID, 0 }
     112                 :            : };
     113                 :            : 
     114                 :            : SvXMLEnumMapEntry aXML_GlueEscapeDirection_EnumMap[] =
     115                 :            : {
     116                 :            :     { XML_AUTO,         drawing::EscapeDirection_SMART },
     117                 :            :     { XML_LEFT,         drawing::EscapeDirection_LEFT },
     118                 :            :     { XML_RIGHT,        drawing::EscapeDirection_RIGHT },
     119                 :            :     { XML_UP,           drawing::EscapeDirection_UP },
     120                 :            :     { XML_DOWN,         drawing::EscapeDirection_DOWN },
     121                 :            :     { XML_HORIZONTAL,   drawing::EscapeDirection_HORIZONTAL },
     122                 :            :     { XML_VERTICAL,     drawing::EscapeDirection_VERTICAL },
     123                 :            :     { XML_TOKEN_INVALID, 0 }
     124                 :            : };
     125                 :            : 
     126                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     127                 :            : 
     128                 :          0 : static bool ImpIsEmptyURL( const ::rtl::OUString& rURL )
     129                 :            : {
     130         [ #  # ]:          0 :     if( rURL.isEmpty() )
     131                 :          0 :         return true;
     132                 :            : 
     133                 :            :     // #i13140# Also compare against 'toplevel' URLs. which also
     134                 :            :     // result in empty filename strings.
     135         [ #  # ]:          0 :     if( 0 == rURL.compareToAscii( "#./" ) )
     136                 :          0 :         return true;
     137                 :            : 
     138                 :          0 :     return false;
     139                 :            : }
     140                 :            : 
     141                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     142                 :            : 
     143 [ #  # ][ #  # ]:          0 : TYPEINIT1( SvXMLShapeContext, SvXMLImportContext );
     144 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLShapeContext, SvXMLShapeContext );
     145                 :            : 
     146                 :        632 : SdXMLShapeContext::SdXMLShapeContext(
     147                 :            :     SvXMLImport& rImport,
     148                 :            :     sal_uInt16 nPrfx,
     149                 :            :     const OUString& rLocalName,
     150                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
     151                 :            :     uno::Reference< drawing::XShapes >& rShapes,
     152                 :            :     sal_Bool bTemporaryShape)
     153                 :            : :   SvXMLShapeContext( rImport, nPrfx, rLocalName, bTemporaryShape )
     154                 :            : ,   mxShapes( rShapes )
     155                 :            : ,   mxAttrList(xAttrList)
     156                 :            : ,   mbListContextPushed( false )
     157                 :            : ,   mnStyleFamily(XML_STYLE_FAMILY_SD_GRAPHICS_ID)
     158                 :            : ,   mbIsPlaceholder(sal_False)
     159                 :            : ,   mbClearDefaultAttributes( true )
     160                 :            : ,   mbIsUserTransformed(sal_False)
     161                 :            : ,   mnZOrder(-1)
     162                 :            : ,   maSize(1, 1)
     163                 :            : ,   maPosition(0, 0)
     164                 :            : ,   mbVisible(true)
     165         [ +  - ]:        632 : ,   mbPrintable(true)
     166                 :            : {
     167                 :        632 : }
     168                 :            : 
     169                 :            : //////////////////////////////////////////////////////////////////////////////
     170                 :            : 
     171         [ +  - ]:        632 : SdXMLShapeContext::~SdXMLShapeContext()
     172                 :            : {
     173         [ -  + ]:        632 : }
     174                 :            : 
     175                 :            : //////////////////////////////////////////////////////////////////////////////
     176                 :            : 
     177                 :        293 : SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix,
     178                 :            :     const OUString& rLocalName,
     179                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList )
     180                 :            : {
     181                 :        293 :     SvXMLImportContext * pContext = NULL;
     182                 :            : 
     183                 :            :     // #i68101#
     184   [ -  +  #  #  :        293 :     if( p_nPrefix == XML_NAMESPACE_SVG &&
           #  # ][ -  + ]
     185                 :          0 :         (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
     186                 :            :     {
     187         [ #  # ]:          0 :         pContext = new SdXMLDescriptionContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
     188                 :            :     }
     189 [ -  + ][ #  # ]:        293 :     else if( p_nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
                 [ -  + ]
     190                 :            :     {
     191         [ #  # ]:          0 :         pContext = new SdXMLEventsContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
     192                 :            :     }
     193 [ -  + ][ #  # ]:        293 :     else if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
                 [ -  + ]
     194                 :            :     {
     195                 :          0 :         addGluePoint( xAttrList );
     196                 :            :     }
     197 [ -  + ][ #  # ]:        293 :     else if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_THUMBNAIL ) )
                 [ -  + ]
     198                 :            :     {
     199                 :            :         // search attributes for xlink:href
     200         [ #  # ]:          0 :         sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
     201         [ #  # ]:          0 :         for(sal_Int16 i=0; i < nAttrCount; i++)
     202                 :            :         {
     203 [ #  # ][ #  # ]:          0 :             OUString sAttrName = xAttrList->getNameByIndex( i );
     204                 :          0 :             OUString aLocalName;
     205         [ #  # ]:          0 :             sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
     206                 :            : 
     207         [ #  # ]:          0 :             if( nPrefix == XML_NAMESPACE_XLINK )
     208                 :            :             {
     209 [ #  # ][ #  # ]:          0 :                 if( IsXMLToken( aLocalName, XML_HREF ) )
     210                 :            :                 {
     211 [ #  # ][ #  # ]:          0 :                     maThumbnailURL = xAttrList->getValueByIndex( i );
     212                 :            :                     break;
     213                 :            :                 }
     214                 :            :             }
     215 [ #  # ][ #  # ]:          0 :         }
     216                 :            :     }
     217                 :            :     else
     218                 :            :     {
     219                 :            :         // create text cursor on demand
     220         [ +  - ]:        293 :         if( !mxCursor.is() )
     221                 :            :         {
     222         [ +  - ]:        293 :             uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
     223         [ +  - ]:        293 :             if( xText.is() )
     224                 :            :             {
     225                 :            :                 UniReference < XMLTextImportHelper > xTxtImport =
     226         [ +  - ]:        293 :                     GetImport().GetTextImport();
     227 [ +  - ][ +  - ]:        293 :                 mxOldCursor = xTxtImport->GetCursor();
                 [ +  - ]
     228 [ +  - ][ +  - ]:        293 :                 mxCursor = xText->createTextCursor();
                 [ +  - ]
     229         [ +  - ]:        293 :                 if( mxCursor.is() )
     230                 :            :                 {
     231 [ +  - ][ +  - ]:        293 :                     xTxtImport->SetCursor( mxCursor );
     232                 :            :                 }
     233                 :            : 
     234                 :            :                 // remember old list item and block (#91964#) and reset them
     235                 :            :                 // for the text frame
     236 [ +  - ][ +  - ]:        293 :                 xTxtImport->PushListContext();
     237         [ +  - ]:        293 :                 mbListContextPushed = true;
     238                 :        293 :             }
     239                 :            :         }
     240                 :            : 
     241                 :            :         // if we have a text cursor, lets  try to import some text
     242         [ +  - ]:        293 :         if( mxCursor.is() )
     243                 :            :         {
     244                 :        293 :             pContext = GetImport().GetTextImport()->CreateTextChildContext(
     245 [ +  - ][ +  - ]:        586 :                 GetImport(), p_nPrefix, rLocalName, xAttrList );
     246                 :            :         }
     247                 :            :     }
     248                 :            : 
     249                 :            :     // call parent for content
     250         [ -  + ]:        293 :     if(!pContext)
     251                 :          0 :         pContext = SvXMLImportContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
     252                 :            : 
     253                 :        293 :     return pContext;
     254                 :            : }
     255                 :            : 
     256                 :          0 : void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XAttributeList>& xAttrList )
     257                 :            : {
     258                 :            :     // get the glue points container for this shape if its not already there
     259         [ #  # ]:          0 :     if( !mxGluePoints.is() )
     260                 :            :     {
     261         [ #  # ]:          0 :         uno::Reference< drawing::XGluePointsSupplier > xSupplier( mxShape, uno::UNO_QUERY );
     262         [ #  # ]:          0 :         if( !xSupplier.is() )
     263                 :            :             return;
     264                 :            : 
     265 [ #  # ][ #  # ]:          0 :         mxGluePoints = uno::Reference< container::XIdentifierContainer >::query( xSupplier->getGluePoints() );
         [ #  # ][ #  # ]
     266                 :            : 
     267         [ #  # ]:          0 :         if( !mxGluePoints.is() )
     268         [ #  # ]:          0 :             return;
     269                 :            :     }
     270                 :            : 
     271                 :          0 :     drawing::GluePoint2 aGluePoint;
     272                 :          0 :     aGluePoint.IsUserDefined = sal_True;
     273                 :          0 :     aGluePoint.Position.X = 0;
     274                 :          0 :     aGluePoint.Position.Y = 0;
     275                 :          0 :     aGluePoint.Escape = drawing::EscapeDirection_SMART;
     276                 :          0 :     aGluePoint.PositionAlignment = drawing::Alignment_CENTER;
     277                 :          0 :     aGluePoint.IsRelative = sal_True;
     278                 :            : 
     279                 :          0 :     sal_Int32 nId = -1;
     280                 :            : 
     281                 :            :     // read attributes for the 3DScene
     282 [ #  # ][ #  # ]:          0 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ #  # ]
     283         [ #  # ]:          0 :     for(sal_Int16 i=0; i < nAttrCount; i++)
     284                 :            :     {
     285 [ #  # ][ #  # ]:          0 :         OUString sAttrName = xAttrList->getNameByIndex( i );
     286                 :          0 :         OUString aLocalName;
     287         [ #  # ]:          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
     288 [ #  # ][ #  # ]:          0 :         const OUString sValue( xAttrList->getValueByIndex( i ) );
     289                 :            : 
     290         [ #  # ]:          0 :         if( nPrefix == XML_NAMESPACE_SVG )
     291                 :            :         {
     292 [ #  # ][ #  # ]:          0 :             if( IsXMLToken( aLocalName, XML_X ) )
     293                 :            :             {
     294                 :          0 :                 GetImport().GetMM100UnitConverter().convertMeasureToCore(
     295         [ #  # ]:          0 :                         aGluePoint.Position.X, sValue);
     296                 :            :             }
     297 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( aLocalName, XML_Y ) )
     298                 :            :             {
     299                 :          0 :                 GetImport().GetMM100UnitConverter().convertMeasureToCore(
     300         [ #  # ]:          0 :                         aGluePoint.Position.Y, sValue);
     301                 :            :             }
     302                 :            :         }
     303         [ #  # ]:          0 :         else if( nPrefix == XML_NAMESPACE_DRAW )
     304                 :            :         {
     305 [ #  # ][ #  # ]:          0 :             if( IsXMLToken( aLocalName, XML_ID ) )
     306                 :            :             {
     307                 :          0 :                 nId = sValue.toInt32();
     308                 :            :             }
     309 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( aLocalName, XML_ALIGN ) )
     310                 :            :             {
     311                 :            :                 sal_uInt16 eKind;
     312 [ #  # ][ #  # ]:          0 :                 if( SvXMLUnitConverter::convertEnum( eKind, sValue, aXML_GlueAlignment_EnumMap ) )
     313                 :            :                 {
     314                 :          0 :                     aGluePoint.PositionAlignment = (drawing::Alignment)eKind;
     315                 :          0 :                     aGluePoint.IsRelative = sal_False;
     316                 :            :                 }
     317                 :            :             }
     318 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( aLocalName, XML_ESCAPE_DIRECTION ) )
     319                 :            :             {
     320                 :            :                 sal_uInt16 eKind;
     321 [ #  # ][ #  # ]:          0 :                 if( SvXMLUnitConverter::convertEnum( eKind, sValue, aXML_GlueEscapeDirection_EnumMap ) )
     322                 :            :                 {
     323                 :          0 :                     aGluePoint.Escape = (drawing::EscapeDirection)eKind;
     324                 :            :                 }
     325                 :            :             }
     326                 :            :         }
     327                 :          0 :     }
     328                 :            : 
     329         [ #  # ]:          0 :     if( nId != -1 )
     330                 :            :     {
     331                 :            :         try
     332                 :            :         {
     333 [ #  # ][ #  # ]:          0 :             sal_Int32 nInternalId = mxGluePoints->insert( uno::makeAny( aGluePoint ) );
                 [ #  # ]
     334 [ #  # ][ #  # ]:          0 :             GetImport().GetShapeImport()->addGluePointMapping( mxShape, nId, nInternalId );
         [ #  # ][ #  # ]
                 [ #  # ]
     335                 :            :         }
     336         [ #  # ]:          0 :         catch(const uno::Exception&)
     337                 :            :         {
     338                 :            :             OSL_FAIL( "exception during setting of glue points!");
     339                 :            :         }
     340                 :            :     }
     341                 :            : }
     342                 :            : //////////////////////////////////////////////////////////////////////////////
     343                 :            : 
     344                 :        494 : void SdXMLShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
     345                 :            : {
     346 [ +  - ][ +  - ]:        494 :     GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
     347                 :        494 : }
     348                 :            : 
     349                 :        632 : void SdXMLShapeContext::EndElement()
     350                 :            : {
     351         [ +  + ]:        632 :     if(mxCursor.is())
     352                 :            :     {
     353                 :            :         // delete addition newline
     354                 :        293 :         const OUString aEmpty;
     355 [ +  - ][ +  - ]:        293 :         mxCursor->gotoEnd( sal_False );
     356 [ +  - ][ +  - ]:        293 :         mxCursor->goLeft( 1, sal_True );
     357 [ +  - ][ +  - ]:        293 :         mxCursor->setString( aEmpty );
     358                 :            : 
     359                 :            :         // reset cursor
     360 [ +  - ][ +  - ]:        293 :         GetImport().GetTextImport()->ResetCursor();
         [ +  - ][ +  - ]
     361                 :            :     }
     362                 :            : 
     363         [ +  + ]:        632 :     if(mxOldCursor.is())
     364 [ +  - ][ +  - ]:          3 :         GetImport().GetTextImport()->SetCursor( mxOldCursor );
     365                 :            : 
     366                 :            :     // reinstall old list item (if necessary) #91964#
     367         [ +  + ]:        632 :     if (mbListContextPushed) {
     368 [ +  - ][ +  - ]:        293 :         GetImport().GetTextImport()->PopListContext();
     369                 :            :     }
     370                 :            : 
     371         [ -  + ]:        632 :     if( !msHyperlink.isEmpty() ) try
     372                 :            :     {
     373         [ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xProp( mxShape, uno::UNO_QUERY );
     374                 :            : 
     375                 :          0 :         rtl::OUString sLink(  "Hyperlink"  );
     376 [ #  # ][ #  # ]:          0 :         if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName( sLink ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     377 [ #  # ][ #  # ]:          0 :             xProp->setPropertyValue( sLink, uno::Any( msHyperlink ) );
                 [ #  # ]
     378         [ #  # ]:          0 :         Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY_THROW );
     379                 :          0 :         const OUString sBookmark(  "Bookmark"  );
     380                 :            : 
     381         [ #  # ]:          0 :         if( xEventsSupplier.is() )
     382                 :            :         {
     383                 :          0 :             const OUString sEventType(  "EventType"  );
     384                 :          0 :             const OUString sClickAction(  "ClickAction"  );
     385                 :            : 
     386 [ #  # ][ #  # ]:          0 :             Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
                 [ #  # ]
     387                 :            : 
     388         [ #  # ]:          0 :             uno::Sequence< beans::PropertyValue > aProperties( 3 );
     389         [ #  # ]:          0 :             aProperties[0].Name = sEventType;
     390         [ #  # ]:          0 :             aProperties[0].Handle = -1;
     391 [ #  # ][ #  # ]:          0 :             aProperties[0].Value <<= OUString( "Presentation" );
     392         [ #  # ]:          0 :             aProperties[0].State = beans::PropertyState_DIRECT_VALUE;
     393                 :            : 
     394         [ #  # ]:          0 :             aProperties[1].Name = sClickAction;
     395         [ #  # ]:          0 :             aProperties[1].Handle = -1;
     396 [ #  # ][ #  # ]:          0 :             aProperties[1].Value <<= ::com::sun::star::presentation::ClickAction_DOCUMENT;
     397         [ #  # ]:          0 :             aProperties[1].State = beans::PropertyState_DIRECT_VALUE;
     398                 :            : 
     399         [ #  # ]:          0 :             aProperties[2].Name = sBookmark;
     400         [ #  # ]:          0 :             aProperties[2].Handle = -1;
     401 [ #  # ][ #  # ]:          0 :             aProperties[2].Value <<= msHyperlink;
     402         [ #  # ]:          0 :             aProperties[2].State = beans::PropertyState_DIRECT_VALUE;
     403                 :            : 
     404                 :          0 :             const OUString sAPIEventName(  "OnClick"  );
     405 [ #  # ][ #  # ]:          0 :             xEvents->replaceByName( sAPIEventName, Any( aProperties ) );
         [ #  # ][ #  # ]
     406                 :            :         }
     407                 :            :         else
     408                 :            :         {
     409                 :            :             // in draw use the Bookmark property
     410         [ #  # ]:          0 :             Reference< beans::XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
     411 [ #  # ][ #  # ]:          0 :             xSet->setPropertyValue( sBookmark, Any( msHyperlink ) );
                 [ #  # ]
     412 [ #  # ][ #  # ]:          0 :             xSet->setPropertyValue( OUString(  "OnClick"  ), Any( ::com::sun::star::presentation::ClickAction_DOCUMENT ) );
                 [ #  # ]
     413         [ #  # ]:          0 :         }
     414                 :            :     }
     415                 :          0 :     catch(const Exception&)
     416                 :            :     {
     417                 :            :         OSL_FAIL("xmloff::SdXMLShapeContext::EndElement(), exception caught while setting hyperlink!");
     418                 :            :     }
     419                 :            : 
     420         [ +  + ]:        632 :     if( mxLockable.is() )
     421                 :        506 :         mxLockable->removeActionLock();
     422                 :        632 : }
     423                 :            : 
     424                 :            : //////////////////////////////////////////////////////////////////////////////
     425                 :            : 
     426                 :        506 : void SdXMLShapeContext::AddShape(uno::Reference< drawing::XShape >& xShape)
     427                 :            : {
     428         [ +  - ]:        506 :     if(xShape.is())
     429                 :            :     {
     430                 :            :         // set shape local
     431         [ +  - ]:        506 :         mxShape = xShape;
     432                 :            : 
     433         [ +  + ]:        506 :         if(!maShapeName.isEmpty())
     434                 :            :         {
     435         [ +  - ]:          5 :             uno::Reference< container::XNamed > xNamed( mxShape, uno::UNO_QUERY );
     436         [ +  - ]:          5 :             if( xNamed.is() )
     437 [ +  - ][ +  - ]:          5 :                 xNamed->setName( maShapeName );
     438                 :            :         }
     439                 :            : 
     440         [ +  - ]:        506 :         UniReference< XMLShapeImportHelper > xImp( GetImport().GetShapeImport() );
     441 [ +  - ][ +  - ]:        506 :         xImp->addShape( xShape, mxAttrList, mxShapes );
     442                 :            : 
     443         [ +  + ]:        506 :         if( mbClearDefaultAttributes )
     444                 :            :         {
     445         [ +  - ]:        372 :             uno::Reference<beans::XMultiPropertyStates> xMultiPropertyStates(xShape, uno::UNO_QUERY );
     446         [ +  - ]:        372 :             if (xMultiPropertyStates.is())
     447 [ +  - ][ +  - ]:        372 :                 xMultiPropertyStates->setAllPropertiesToDefault();
     448                 :            :         }
     449                 :            : 
     450 [ +  - ][ -  + ]:        506 :         if( !mbVisible || !mbPrintable ) try
     451                 :            :         {
     452         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY_THROW );
     453         [ #  # ]:          0 :             if( !mbVisible )
     454 [ #  # ][ #  # ]:          0 :                 xSet->setPropertyValue( rtl::OUString(  "Visible"  ), uno::Any( sal_False ) );
                 [ #  # ]
     455                 :            : 
     456         [ #  # ]:          0 :             if( !mbPrintable )
     457 [ #  # ][ #  # ]:          0 :                 xSet->setPropertyValue( rtl::OUString(  "Printable"  ), uno::Any( sal_False ) );
         [ #  # ][ #  # ]
     458                 :            :         }
     459         [ #  # ]:          0 :         catch(const Exception&)
     460                 :            :         {
     461                 :            :             OSL_FAIL( "SdXMLShapeContext::AddShape(), exception caught!" );
     462                 :            :         }
     463                 :            : 
     464                 :            :         // #107848#
     465 [ +  + ][ +  - ]:       1510 :         if(!mbTemporaryShape && (!GetImport().HasTextImport()
         [ +  - ][ +  - ]
                 [ +  + ]
     466 [ +  - ][ +  - ]:       1004 :             || !GetImport().GetTextImport()->IsInsideDeleteContext()))
         [ +  - ][ +  + ]
         [ +  - ][ #  # ]
     467                 :            :         {
     468 [ +  - ][ +  - ]:        498 :             xImp->shapeWithZIndexAdded( xShape, mnZOrder );
     469                 :            :         }
     470                 :            : 
     471         [ -  + ]:        506 :         if( !maShapeId.isEmpty() )
     472                 :            :         {
     473         [ #  # ]:          0 :             uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
     474 [ #  # ][ #  # ]:          0 :             GetImport().getInterfaceToIdentifierMapper().registerReference( maShapeId, xRef );
     475                 :            :         }
     476                 :            : 
     477                 :            :         // #91065# count only if counting for shape import is enabled
     478 [ +  - ][ +  - ]:        506 :         if(GetImport().GetShapeImport()->IsHandleProgressBarEnabled())
         [ +  - ][ +  - ]
                 [ +  + ]
     479                 :            :         {
     480                 :            :             // #80365# increment progress bar at load once for each draw object
     481 [ +  - ][ +  - ]:        414 :             GetImport().GetProgressBarHelper()->Increment();
     482         [ +  - ]:        506 :         }
     483                 :            :     }
     484                 :            : 
     485         [ +  - ]:        506 :     mxLockable = uno::Reference< document::XActionLockable >::query( xShape );
     486                 :            : 
     487         [ +  - ]:        506 :     if( mxLockable.is() )
     488                 :        506 :         mxLockable->addActionLock();
     489                 :            : 
     490                 :        506 : }
     491                 :            : 
     492                 :            : //////////////////////////////////////////////////////////////////////////////
     493                 :            : 
     494                 :        506 : void SdXMLShapeContext::AddShape(const char* pServiceName )
     495                 :            : {
     496         [ +  - ]:        506 :     uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY);
     497         [ +  - ]:        506 :     if(xServiceFact.is())
     498                 :            :     {
     499                 :            :         try
     500                 :            :         {
     501                 :            :             /* Since fix for issue i33294 the Writer model doesn't support
     502                 :            :                com.sun.star.drawing.OLE2Shape anymore.
     503                 :            :                To handle Draw OLE objects it's decided to import these
     504                 :            :                objects as com.sun.star.drawing.OLE2Shape and convert these
     505                 :            :                objects after the import into com.sun.star.drawing.GraphicObjectShape.
     506                 :            :             */
     507                 :        506 :             uno::Reference< drawing::XShape > xShape;
     508         [ +  - ]:       1012 :             if ( OUString::createFromAscii(pServiceName).compareToAscii( "com.sun.star.drawing.OLE2Shape" ) == 0 &&
           [ -  +  #  # ]
           [ -  +  #  # ]
     509 [ #  # ][ -  + ]:        506 :                  uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() )
                 [ #  # ]
     510                 :            :             {
     511 [ #  # ][ #  # ]:          0 :                 xShape = uno::Reference< drawing::XShape >(xServiceFact->createInstance(OUString("com.sun.star.drawing.temporaryForXMLImportOLE2Shape")), uno::UNO_QUERY);
         [ #  # ][ #  # ]
     512                 :            :             }
     513                 :            :             else
     514                 :            :             {
     515 [ +  - ][ +  - ]:        506 :                 xShape = uno::Reference< drawing::XShape >(xServiceFact->createInstance(OUString::createFromAscii(pServiceName)), uno::UNO_QUERY);
         [ +  - ][ +  - ]
     516                 :            :             }
     517         [ +  - ]:        506 :             if( xShape.is() )
     518         [ +  - ]:        506 :                 AddShape( xShape );
     519                 :            :         }
     520   [ #  #  #  # ]:          0 :         catch(const uno::Exception& e)
     521                 :            :         {
     522         [ #  # ]:          0 :             uno::Sequence<rtl::OUString> aSeq( 1 );
     523         [ #  # ]:          0 :             aSeq[0] = OUString::createFromAscii(pServiceName);
     524                 :          0 :             GetImport().SetError( XMLERROR_FLAG_ERROR | XMLERROR_API,
     525   [ #  #  #  #  :          0 :                                   aSeq, e.Message, NULL );
                   #  # ]
     526                 :            :         }
     527                 :        506 :     }
     528                 :        506 : }
     529                 :            : 
     530                 :            : //////////////////////////////////////////////////////////////////////////////
     531                 :            : 
     532                 :        500 : void SdXMLShapeContext::SetTransformation()
     533                 :            : {
     534         [ +  - ]:        500 :     if(mxShape.is())
     535                 :            :     {
     536         [ +  - ]:        500 :         uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
     537         [ +  - ]:        500 :         if(xPropSet.is())
     538                 :            :         {
     539         [ +  - ]:        500 :             ::basegfx::B2DHomMatrix aTransformation;
     540                 :            : 
     541 [ +  + ][ -  + ]:        500 :             if(maSize.Width != 1 || maSize.Height != 1)
     542                 :            :             {
     543                 :            :                 // take care there are no zeros used by error
     544         [ -  + ]:        495 :                 if(0 == maSize.Width)
     545                 :          0 :                     maSize.Width = 1;
     546         [ -  + ]:        495 :                 if(0 == maSize.Height)
     547                 :          0 :                     maSize.Height = 1;
     548                 :            : 
     549                 :            :                 // set global size. This should always be used.
     550         [ +  - ]:        495 :                 aTransformation.scale(maSize.Width, maSize.Height);
     551                 :            :             }
     552                 :            : 
     553 [ +  + ][ +  + ]:        500 :             if(maPosition.X != 0 || maPosition.Y != 0)
     554                 :            :             {
     555                 :            :                 // if global position is used, add it to transformation
     556         [ +  - ]:        473 :                 aTransformation.translate(maPosition.X, maPosition.Y);
     557                 :            :             }
     558                 :            : 
     559         [ +  + ]:        500 :             if(mnTransform.NeedsAction())
     560                 :            :             {
     561                 :            :                 // transformation is used, apply to object.
     562                 :            :                 // NOTICE: The transformation is applied AFTER evtl. used
     563                 :            :                 // global positioning and scaling is used, so any shear or
     564                 :            :                 // rotate used herein is applied around the (0,0) position
     565                 :            :                 // of the PAGE object !!!
     566         [ +  - ]:         12 :                 ::basegfx::B2DHomMatrix aMat;
     567         [ +  - ]:         12 :                 mnTransform.GetFullTransform(aMat);
     568                 :            : 
     569                 :            :                 // now add to transformation
     570 [ +  - ][ +  - ]:         12 :                 aTransformation *= aMat;
     571                 :            :             }
     572                 :            : 
     573                 :            :             // now set transformation for this object
     574                 :        500 :             uno::Any aAny;
     575                 :        500 :             drawing::HomogenMatrix3 aMatrix;
     576                 :            : 
     577         [ +  - ]:        500 :             aMatrix.Line1.Column1 = aTransformation.get(0, 0);
     578         [ +  - ]:        500 :             aMatrix.Line1.Column2 = aTransformation.get(0, 1);
     579         [ +  - ]:        500 :             aMatrix.Line1.Column3 = aTransformation.get(0, 2);
     580                 :            : 
     581         [ +  - ]:        500 :             aMatrix.Line2.Column1 = aTransformation.get(1, 0);
     582         [ +  - ]:        500 :             aMatrix.Line2.Column2 = aTransformation.get(1, 1);
     583         [ +  - ]:        500 :             aMatrix.Line2.Column3 = aTransformation.get(1, 2);
     584                 :            : 
     585         [ +  - ]:        500 :             aMatrix.Line3.Column1 = aTransformation.get(2, 0);
     586         [ +  - ]:        500 :             aMatrix.Line3.Column2 = aTransformation.get(2, 1);
     587         [ +  - ]:        500 :             aMatrix.Line3.Column3 = aTransformation.get(2, 2);
     588                 :            : 
     589         [ +  - ]:        500 :             aAny <<= aMatrix;
     590                 :            : 
     591         [ +  - ]:        500 :             xPropSet->setPropertyValue(
     592 [ +  - ][ +  - ]:        500 :                 OUString("Transformation"), aAny);
     593                 :        500 :         }
     594                 :            :     }
     595                 :        500 : }
     596                 :            : 
     597                 :            : //////////////////////////////////////////////////////////////////////////////
     598                 :            : 
     599                 :        506 : void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */)
     600                 :            : {
     601                 :            :     try
     602                 :            :     {
     603         [ +  - ]:        506 :         uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
     604         [ -  + ]:        506 :         if( !xPropSet.is() )
     605                 :        506 :             return;
     606                 :            : 
     607                 :            :         do
     608                 :            :         {
     609                 :        506 :             XMLPropStyleContext* pDocStyle = NULL;
     610                 :            : 
     611                 :            :             // set style on shape
     612         [ +  + ]:        506 :             if(maDrawStyleName.isEmpty())
     613                 :            :                 break;
     614                 :            : 
     615                 :        433 :             const SvXMLStyleContext* pStyle = 0L;
     616                 :        433 :             sal_Bool bAutoStyle(sal_False);
     617                 :            : 
     618 [ +  - ][ +  - ]:        433 :             if(GetImport().GetShapeImport()->GetAutoStylesContext())
         [ +  - ][ +  - ]
     619 [ +  - ][ +  - ]:        433 :                 pStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
         [ +  - ][ +  - ]
     620                 :            : 
     621         [ +  + ]:        433 :             if(pStyle)
     622                 :        399 :                 bAutoStyle = sal_True;
     623                 :            : 
     624 [ +  + ][ +  - ]:        433 :             if(!pStyle && GetImport().GetShapeImport()->GetStylesContext())
         [ +  - ][ +  + ]
         [ +  + ][ +  - ]
           [ +  +  #  # ]
     625 [ +  - ][ +  - ]:         28 :                 pStyle = GetImport().GetShapeImport()->GetStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName);
         [ +  - ][ +  - ]
     626                 :            : 
     627                 :        433 :             OUString aStyleName = maDrawStyleName;
     628                 :        433 :             uno::Reference< style::XStyle > xStyle;
     629                 :            : 
     630 [ +  - ][ +  - ]:        433 :             if( pStyle && pStyle->ISA(XMLShapeStyleContext) )
         [ +  - ][ +  + ]
                 [ +  + ]
     631                 :            :             {
     632 [ +  - ][ +  - ]:        427 :                 pDocStyle = PTR_CAST( XMLShapeStyleContext, pStyle );
         [ +  - ][ +  - ]
     633                 :            : 
     634         [ +  + ]:        427 :                 if( pDocStyle->GetStyle().is() )
     635                 :            :                 {
     636         [ +  - ]:         20 :                     xStyle = pDocStyle->GetStyle();
     637                 :            :                 }
     638                 :            :                 else
     639                 :            :                 {
     640                 :        407 :                     aStyleName = pDocStyle->GetParentName();
     641                 :            :                 }
     642                 :            :             }
     643                 :            : 
     644 [ +  + ][ +  + ]:        433 :             if( !xStyle.is() && !aStyleName.isEmpty() )
                 [ +  + ]
     645                 :            :             {
     646                 :            :                 try
     647                 :            :                 {
     648                 :            : 
     649         [ +  - ]:        296 :                     uno::Reference< style::XStyleFamiliesSupplier > xFamiliesSupplier( GetImport().GetModel(), uno::UNO_QUERY );
     650                 :            : 
     651         [ +  - ]:        296 :                     if( xFamiliesSupplier.is() )
     652                 :            :                     {
     653 [ +  - ][ +  - ]:        296 :                         uno::Reference< container::XNameAccess > xFamilies( xFamiliesSupplier->getStyleFamilies() );
     654         [ +  - ]:        296 :                         if( xFamilies.is() )
     655                 :            :                         {
     656                 :            : 
     657                 :        296 :                             uno::Reference< container::XNameAccess > xFamily;
     658                 :            : 
     659         [ +  + ]:        296 :                             if( XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily )
     660                 :            :                             {
     661                 :         71 :                                 aStyleName = GetImport().GetStyleDisplayName(
     662                 :            :                                     XML_STYLE_FAMILY_SD_PRESENTATION_ID,
     663         [ +  - ]:         71 :                                     aStyleName );
     664                 :         71 :                                 sal_Int32 nPos = aStyleName.lastIndexOf( sal_Unicode('-') );
     665         [ +  - ]:         71 :                                 if( -1 != nPos )
     666                 :            :                                 {
     667                 :         71 :                                     OUString aFamily( aStyleName.copy( 0, nPos ) );
     668                 :            : 
     669 [ +  - ][ +  - ]:         71 :                                     xFamilies->getByName( aFamily ) >>= xFamily;
                 [ +  - ]
     670                 :         71 :                                     aStyleName = aStyleName.copy( nPos + 1 );
     671                 :            :                                 }
     672                 :            :                             }
     673                 :            :                             else
     674                 :            :                             {
     675                 :            :                                 // get graphics familie
     676 [ +  - ][ +  - ]:        225 :                                 xFamilies->getByName( OUString(  "graphics"  ) ) >>= xFamily;
                 [ +  - ]
     677                 :        225 :                                 aStyleName = GetImport().GetStyleDisplayName(
     678                 :            :                                     XML_STYLE_FAMILY_SD_GRAPHICS_ID,
     679         [ +  - ]:        225 :                                     aStyleName );
     680                 :            :                             }
     681                 :            : 
     682         [ +  - ]:        296 :                             if( xFamily.is() )
     683 [ +  - ][ +  - ]:        296 :                                 xFamily->getByName( aStyleName ) >>= xStyle;
                 [ +  - ]
     684                 :        296 :                         }
     685         [ #  # ]:        296 :                     }
     686                 :            :                 }
     687         [ #  # ]:          0 :                 catch(const uno::Exception&)
     688                 :            :                 {
     689                 :            :                     OSL_FAIL( "could not find style for shape!" );
     690                 :            :                 }
     691                 :            :             }
     692                 :            : 
     693 [ +  - ][ +  + ]:        433 :             if( bSupportsStyle && xStyle.is() )
                 [ +  + ]
     694                 :            :             {
     695                 :            :                 try
     696                 :            :                 {
     697                 :            :                     // set style on object
     698                 :        316 :                     uno::Any aAny;
     699         [ +  - ]:        316 :                     aAny <<= xStyle;
     700 [ +  - ][ +  - ]:        316 :                     xPropSet->setPropertyValue(OUString("Style"), aAny);
                 [ #  # ]
     701                 :            :                 }
     702         [ #  # ]:          0 :                 catch(const uno::Exception&)
     703                 :            :                 {
     704                 :            :                     OSL_FAIL( "could not find style for shape!" );
     705                 :            :                 }
     706                 :            :             }
     707                 :            : 
     708                 :            :             // if this is an auto style, set its properties
     709 [ +  + ][ +  - ]:        433 :             if(bAutoStyle && pDocStyle)
     710                 :            :             {
     711                 :            :                 // set PropertySet on object
     712         [ +  - ]:        399 :                 pDocStyle->FillPropertySet(xPropSet);
     713                 :        506 :             }
     714                 :            : 
     715                 :            :         } while(0);
     716                 :            : 
     717                 :            :         // try to set text auto style
     718                 :            :         do
     719                 :            :         {
     720                 :            :             // set style on shape
     721         [ +  + ]:        506 :             if( maTextStyleName.isEmpty() )
     722                 :        151 :                 break;
     723                 :            : 
     724 [ +  - ][ +  - ]:        355 :             if( NULL == GetImport().GetShapeImport()->GetAutoStylesContext())
         [ +  - ][ -  + ]
     725                 :          0 :                 break;
     726                 :            : 
     727 [ +  - ][ +  - ]:        355 :             const SvXMLStyleContext* pTempStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(XML_STYLE_FAMILY_TEXT_PARAGRAPH, maTextStyleName);
         [ +  - ][ +  - ]
     728 [ +  - ][ +  - ]:        355 :             XMLPropStyleContext* pStyle = PTR_CAST( XMLPropStyleContext, pTempStyle ); // use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called twice
         [ +  - ][ +  - ]
     729         [ -  + ]:        355 :             if( pStyle == NULL )
     730                 :          0 :                 break;
     731                 :            : 
     732                 :            :             // set PropertySet on object
     733         [ +  - ]:        506 :             pStyle->FillPropertySet(xPropSet);
     734                 :            : 
     735 [ +  - ][ #  # ]:        506 :         } while(0);
     736                 :            :     }
     737                 :          0 :     catch(const uno::Exception&)
     738                 :            :     {
     739                 :            :     }
     740                 :            : }
     741                 :            : 
     742                 :        500 : void SdXMLShapeContext::SetLayer()
     743                 :            : {
     744         [ +  + ]:        500 :     if( !maLayerName.isEmpty() )
     745                 :            :     {
     746                 :            :         try
     747                 :            :         {
     748         [ +  - ]:        414 :             uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
     749         [ +  - ]:        414 :             if(xPropSet.is() )
     750                 :            :             {
     751                 :        414 :                 uno::Any aAny;
     752         [ +  - ]:        414 :                 aAny <<= maLayerName;
     753                 :            : 
     754 [ +  - ][ +  - ]:        414 :                 xPropSet->setPropertyValue(OUString("LayerName"), aAny);
     755                 :        914 :                 return;
     756 [ -  + ][ #  # ]:        414 :             }
     757                 :            :         }
     758                 :          0 :         catch(const uno::Exception&)
     759                 :            :         {
     760                 :            :         }
     761                 :            :     }
     762                 :            : }
     763                 :            : 
     764                 :          0 : void SdXMLShapeContext::SetThumbnail()
     765                 :            : {
     766         [ #  # ]:          0 :     if( maThumbnailURL.isEmpty() )
     767                 :          0 :         return;
     768                 :            : 
     769                 :            :     try
     770                 :            :     {
     771         [ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
     772         [ #  # ]:          0 :         if( !xPropSet.is() )
     773                 :            :             return;
     774                 :            : 
     775                 :          0 :         const OUString sProperty("ThumbnailGraphicURL");
     776                 :            : 
     777 [ #  # ][ #  # ]:          0 :         uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
     778 [ #  # ][ #  # ]:          0 :         if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sProperty ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     779                 :            :         {
     780                 :            :             // load the thumbnail graphic and export it to a wmf stream so we can set
     781                 :            :             // it at the api
     782                 :            : 
     783         [ #  # ]:          0 :             const OUString aInternalURL( GetImport().ResolveGraphicObjectURL( maThumbnailURL, sal_False ) );
     784 [ #  # ][ #  # ]:          0 :             xPropSet->setPropertyValue( sProperty, uno::makeAny( aInternalURL ) );
                 [ #  # ]
     785 [ #  # ][ #  # ]:          0 :         }
     786                 :            :     }
     787                 :          0 :     catch(const uno::Exception&)
     788                 :            :     {
     789                 :            :     }
     790                 :            : }
     791                 :            : 
     792                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
     793                 :       3643 : void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
     794                 :            : {
     795                 :       3643 :     bool bHaveXmlId( false );
     796 [ +  + ][ -  + ]:       3643 :     if( (XML_NAMESPACE_DRAW == nPrefix) || (XML_NAMESPACE_DRAW_EXT == nPrefix) )
     797                 :            :     {
     798         [ +  + ]:       2384 :         if( IsXMLToken( rLocalName, XML_ZINDEX ) )
     799                 :            :         {
     800                 :         72 :             mnZOrder = rValue.toInt32();
     801                 :            :         }
     802         [ -  + ]:       1120 :         else if( IsXMLToken( rLocalName, XML_ID ) )
     803                 :            :         {
     804         [ #  # ]:          0 :             if (!bHaveXmlId) { maShapeId = rValue; };
     805                 :            :         }
     806         [ +  + ]:       1120 :         else if( IsXMLToken( rLocalName, XML_NAME ) )
     807                 :            :         {
     808                 :          5 :             maShapeName = rValue;
     809                 :            :         }
     810         [ +  + ]:       1115 :         else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) )
     811                 :            :         {
     812                 :        334 :             maDrawStyleName = rValue;
     813                 :            :         }
     814         [ +  + ]:        781 :         else if( IsXMLToken( rLocalName, XML_TEXT_STYLE_NAME ) )
     815                 :            :         {
     816                 :        355 :             maTextStyleName = rValue;
     817                 :            :         }
     818         [ +  + ]:        426 :         else if( IsXMLToken( rLocalName, XML_LAYER ) )
     819                 :            :         {
     820                 :        414 :             maLayerName = rValue;
     821                 :            :         }
     822         [ +  - ]:         12 :         else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
     823                 :            :         {
     824                 :         12 :             mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter());
     825                 :            :         }
     826         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_DISPLAY ) )
     827                 :            :         {
     828 [ #  # ][ #  # ]:          0 :             mbVisible = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_SCREEN );
     829 [ #  # ][ #  # ]:          0 :             mbPrintable = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_PRINTER );
     830                 :            :         }
     831                 :            :     }
     832         [ +  + ]:       2451 :     else if( XML_NAMESPACE_PRESENTATION == nPrefix )
     833                 :            :     {
     834         [ +  + ]:        309 :         if( IsXMLToken( rLocalName, XML_USER_TRANSFORMED ) )
     835                 :            :         {
     836                 :          3 :             mbIsUserTransformed = IsXMLToken( rValue, XML_TRUE );
     837                 :            :         }
     838         [ +  + ]:        306 :         else if( IsXMLToken( rLocalName, XML_PLACEHOLDER ) )
     839                 :            :         {
     840                 :         57 :             mbIsPlaceholder = IsXMLToken( rValue, XML_TRUE );
     841         [ +  - ]:         57 :             if( mbIsPlaceholder )
     842                 :         57 :                 mbClearDefaultAttributes = false;
     843                 :            :         }
     844         [ +  + ]:        249 :         else if( IsXMLToken( rLocalName, XML_CLASS ) )
     845                 :            :         {
     846                 :        150 :             maPresentationClass = rValue;
     847                 :            :         }
     848         [ +  - ]:         99 :         else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) )
     849                 :            :         {
     850                 :         99 :             maDrawStyleName = rValue;
     851                 :         99 :             mnStyleFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID;
     852                 :            :         }
     853                 :            :     }
     854         [ +  + ]:       2142 :     else if( XML_NAMESPACE_SVG == nPrefix )
     855                 :            :     {
     856         [ +  + ]:       1900 :         if( IsXMLToken( rLocalName, XML_X ) )
     857                 :            :         {
     858                 :        469 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
     859                 :        469 :                     maPosition.X, rValue);
     860                 :            :         }
     861         [ +  + ]:       1431 :         else if( IsXMLToken( rLocalName, XML_Y ) )
     862                 :            :         {
     863                 :        469 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
     864                 :        469 :                     maPosition.Y, rValue);
     865                 :            :         }
     866         [ +  + ]:        962 :         else if( IsXMLToken( rLocalName, XML_WIDTH ) )
     867                 :            :         {
     868                 :        481 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
     869                 :        481 :                     maSize.Width, rValue);
     870         [ +  - ]:        481 :             if( maSize.Width > 0 )
     871                 :        481 :                 maSize.Width += 1;
     872         [ #  # ]:          0 :             else if( maSize.Width < 0 )
     873                 :          0 :                 maSize.Width -= 1;
     874                 :            :         }
     875         [ +  - ]:        481 :         else if( IsXMLToken( rLocalName, XML_HEIGHT ) )
     876                 :            :         {
     877                 :        481 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
     878                 :        481 :                     maSize.Height, rValue);
     879         [ +  - ]:        481 :             if( maSize.Height > 0 )
     880                 :        481 :                 maSize.Height += 1;
     881         [ #  # ]:          0 :             else if( maSize.Height < 0 )
     882                 :          0 :                 maSize.Height -= 1;
     883                 :            :         }
     884         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
     885                 :            :         {
     886                 :            :             // because of #85127# take svg:transform into account and hanle like
     887                 :            :             // draw:transform for compatibility
     888                 :          0 :             mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter());
     889                 :            :         }
     890                 :            : 
     891                 :            :         // #i68101#
     892         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_TITLE ) )
     893                 :            :         {
     894                 :          0 :             maShapeTitle = rValue;
     895                 :            :         }
     896         [ #  # ]:          0 :         else if( IsXMLToken( rLocalName, XML_DESC ) )
     897                 :            :         {
     898                 :          0 :             maShapeDescription = rValue;
     899                 :            :         }
     900                 :            :     }
     901 [ +  - ][ -  + ]:        242 :     else if( (XML_NAMESPACE_NONE == nPrefix) || (XML_NAMESPACE_XML == nPrefix) )
     902                 :            :     {
     903         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_ID ) )
     904                 :            :         {
     905                 :          0 :             maShapeId = rValue;
     906                 :          0 :             bHaveXmlId = true;
     907                 :            :         }
     908                 :            :     }
     909                 :       3643 : }
     910                 :            : 
     911                 :        112 : sal_Bool SdXMLShapeContext::isPresentationShape() const
     912                 :            : {
     913 [ +  - ][ +  - ]:        112 :     if( !maPresentationClass.isEmpty() && (const_cast<SdXMLShapeContext*>(this))->GetImport().GetShapeImport()->IsPresentationShapesSupported() )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
           [ +  -  #  # ]
     914                 :            :     {
     915         [ +  + ]:        112 :         if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily)
     916                 :            :         {
     917                 :         92 :             return sal_True;
     918                 :            :         }
     919                 :            : 
     920 [ +  + ][ +  +  :         35 :         if( IsXMLToken( maPresentationClass, XML_HEADER ) || IsXMLToken( maPresentationClass, XML_FOOTER ) ||
             +  +  +  - ]
                 [ +  - ]
     921                 :         15 :             IsXMLToken( maPresentationClass, XML_PAGE_NUMBER ) || IsXMLToken( maPresentationClass, XML_DATE_TIME ) )
     922                 :            :         {
     923                 :         20 :             return sal_True;
     924                 :            :         }
     925                 :            :     }
     926                 :            : 
     927                 :        112 :     return sal_False;
     928                 :            : }
     929                 :            : 
     930                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     931                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     932                 :            : 
     933 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLRectShapeContext, SdXMLShapeContext );
     934                 :            : 
     935                 :         12 : SdXMLRectShapeContext::SdXMLRectShapeContext(
     936                 :            :     SvXMLImport& rImport,
     937                 :            :     sal_uInt16 nPrfx,
     938                 :            :     const OUString& rLocalName,
     939                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
     940                 :            :     uno::Reference< drawing::XShapes >& rShapes,
     941                 :            :     sal_Bool bTemporaryShape)
     942                 :            : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
     943                 :         12 :     mnRadius( 0L )
     944                 :            : {
     945                 :         12 : }
     946                 :            : 
     947                 :            : //////////////////////////////////////////////////////////////////////////////
     948                 :            : 
     949                 :         12 : SdXMLRectShapeContext::~SdXMLRectShapeContext()
     950                 :            : {
     951         [ -  + ]:         24 : }
     952                 :            : 
     953                 :            : //////////////////////////////////////////////////////////////////////////////
     954                 :            : 
     955                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
     956                 :         92 : void SdXMLRectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
     957                 :            : {
     958         [ +  + ]:         92 :     if( XML_NAMESPACE_DRAW == nPrefix )
     959                 :            :     {
     960         [ -  + ]:         29 :         if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
     961                 :            :         {
     962                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
     963                 :          0 :                     mnRadius, rValue);
     964                 :         92 :             return;
     965                 :            :         }
     966                 :            :     }
     967                 :            : 
     968                 :         92 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
     969                 :            : }
     970                 :            : 
     971                 :            : //////////////////////////////////////////////////////////////////////////////
     972                 :            : 
     973                 :         12 : void SdXMLRectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
     974                 :            : {
     975                 :            :     // create rectangle shape
     976                 :         12 :     AddShape("com.sun.star.drawing.RectangleShape");
     977         [ +  - ]:         12 :     if(mxShape.is())
     978                 :            :     {
     979                 :            :         // Add, set Style and properties from base shape
     980                 :         12 :         SetStyle();
     981                 :         12 :         SetLayer();
     982                 :            : 
     983                 :            :         // set pos, size, shear and rotate
     984                 :         12 :         SetTransformation();
     985                 :            : 
     986         [ -  + ]:         12 :         if(mnRadius)
     987                 :            :         {
     988         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
     989         [ #  # ]:          0 :             if(xPropSet.is())
     990                 :            :             {
     991                 :            :                 try
     992                 :            :                 {
     993 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString("CornerRadius"), uno::makeAny( mnRadius ) );
         [ #  # ][ #  # ]
     994                 :            :                 }
     995         [ #  # ]:          0 :                 catch(const uno::Exception&)
     996                 :            :                 {
     997                 :            :                     OSL_FAIL( "exception during setting of corner radius!");
     998                 :            :                 }
     999                 :          0 :             }
    1000                 :            :         }
    1001                 :         12 :         SdXMLShapeContext::StartElement(xAttrList);
    1002                 :            :     }
    1003                 :         12 : }
    1004                 :            : 
    1005                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1006                 :            : ////////////////////////////////////////3////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1007                 :            : 
    1008 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLLineShapeContext, SdXMLShapeContext );
    1009                 :            : 
    1010                 :         14 : SdXMLLineShapeContext::SdXMLLineShapeContext(
    1011                 :            :     SvXMLImport& rImport,
    1012                 :            :     sal_uInt16 nPrfx,
    1013                 :            :     const OUString& rLocalName,
    1014                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    1015                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    1016                 :            :     sal_Bool bTemporaryShape)
    1017                 :            : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    1018                 :            :     mnX1( 0L ),
    1019                 :            :     mnY1( 0L ),
    1020                 :            :     mnX2( 1L ),
    1021                 :         14 :     mnY2( 1L )
    1022                 :            : {
    1023                 :         14 : }
    1024                 :            : 
    1025                 :            : //////////////////////////////////////////////////////////////////////////////
    1026                 :            : 
    1027                 :         14 : SdXMLLineShapeContext::~SdXMLLineShapeContext()
    1028                 :            : {
    1029         [ -  + ]:         28 : }
    1030                 :            : 
    1031                 :            : //////////////////////////////////////////////////////////////////////////////
    1032                 :            : 
    1033                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    1034                 :         93 : void SdXMLLineShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    1035                 :            : {
    1036         [ +  + ]:         93 :     if( XML_NAMESPACE_SVG == nPrefix )
    1037                 :            :     {
    1038         [ +  + ]:         56 :         if( IsXMLToken( rLocalName, XML_X1 ) )
    1039                 :            :         {
    1040                 :         14 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1041                 :         14 :                     mnX1, rValue);
    1042                 :         14 :             return;
    1043                 :            :         }
    1044         [ +  + ]:         42 :         if( IsXMLToken( rLocalName, XML_Y1 ) )
    1045                 :            :         {
    1046                 :         14 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1047                 :         14 :                     mnY1, rValue);
    1048                 :         14 :             return;
    1049                 :            :         }
    1050         [ +  + ]:         28 :         if( IsXMLToken( rLocalName, XML_X2 ) )
    1051                 :            :         {
    1052                 :         14 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1053                 :         14 :                     mnX2, rValue);
    1054                 :         14 :             return;
    1055                 :            :         }
    1056         [ +  - ]:         14 :         if( IsXMLToken( rLocalName, XML_Y2 ) )
    1057                 :            :         {
    1058                 :         14 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1059                 :         14 :                     mnY2, rValue);
    1060                 :         14 :             return;
    1061                 :            :         }
    1062                 :            :     }
    1063                 :            : 
    1064                 :         93 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    1065                 :            : }
    1066                 :            : 
    1067                 :            : //////////////////////////////////////////////////////////////////////////////
    1068                 :            : 
    1069                 :         14 : void SdXMLLineShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
    1070                 :            : {
    1071                 :            :     // #85920# use SetTransformation() to handle import of simple lines.
    1072                 :            :     // This is necessary to kake into account all anchor positions and
    1073                 :            :     // other things. All shape imports use the same import schemata now.
    1074                 :            :     // create necessary shape (Line Shape)
    1075                 :         14 :     AddShape("com.sun.star.drawing.PolyLineShape");
    1076                 :            : 
    1077         [ +  - ]:         14 :     if(mxShape.is())
    1078                 :            :     {
    1079                 :            :         // Add, set Style and properties from base shape
    1080         [ +  - ]:         14 :         SetStyle();
    1081         [ +  - ]:         14 :         SetLayer();
    1082                 :            : 
    1083                 :            :         // get sizes and offsets
    1084                 :         14 :         awt::Point aTopLeft(mnX1, mnY1);
    1085                 :         14 :         awt::Point aBottomRight(mnX2, mnY2);
    1086                 :            : 
    1087         [ +  + ]:         14 :         if(mnX1 > mnX2)
    1088                 :            :         {
    1089                 :          3 :             aTopLeft.X = mnX2;
    1090                 :          3 :             aBottomRight.X = mnX1;
    1091                 :            :         }
    1092                 :            : 
    1093         [ +  + ]:         14 :         if(mnY1 > mnY2)
    1094                 :            :         {
    1095                 :          3 :             aTopLeft.Y = mnY2;
    1096                 :          3 :             aBottomRight.Y = mnY1;
    1097                 :            :         }
    1098                 :            : 
    1099                 :            :         // set local parameters on shape
    1100         [ +  - ]:         14 :         uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
    1101         [ +  - ]:         14 :         if(xPropSet.is())
    1102                 :            :         {
    1103         [ +  - ]:         14 :             drawing::PointSequenceSequence aPolyPoly(1L);
    1104         [ +  - ]:         14 :             drawing::PointSequence* pOuterSequence = aPolyPoly.getArray();
    1105         [ +  - ]:         14 :             pOuterSequence->realloc(2L);
    1106         [ +  - ]:         14 :             awt::Point* pInnerSequence = pOuterSequence->getArray();
    1107                 :         14 :             uno::Any aAny;
    1108                 :            : 
    1109                 :         14 :             *pInnerSequence = awt::Point( mnX1 - aTopLeft.X, mnY1 - aTopLeft.Y);
    1110                 :         14 :             pInnerSequence++;
    1111                 :         14 :             *pInnerSequence = awt::Point( mnX2 - aTopLeft.X, mnY2 - aTopLeft.Y);
    1112                 :            : 
    1113         [ +  - ]:         14 :             aAny <<= aPolyPoly;
    1114         [ +  - ]:         14 :             xPropSet->setPropertyValue(
    1115 [ +  - ][ +  - ]:         14 :                 OUString("Geometry"), aAny);
    1116                 :            :         }
    1117                 :            : 
    1118                 :            :         // set sizes for transformation
    1119                 :         14 :         maSize.Width = aBottomRight.X - aTopLeft.X;
    1120                 :         14 :         maSize.Height = aBottomRight.Y - aTopLeft.Y;
    1121                 :         14 :         maPosition.X = aTopLeft.X;
    1122                 :         14 :         maPosition.Y = aTopLeft.Y;
    1123                 :            : 
    1124                 :            :         // set pos, size, shear and rotate and get copy of matrix
    1125         [ +  - ]:         14 :         SetTransformation();
    1126                 :            : 
    1127         [ +  - ]:         14 :         SdXMLShapeContext::StartElement(xAttrList);
    1128                 :            :     }
    1129                 :         14 : }
    1130                 :            : 
    1131                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1132                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1133                 :            : 
    1134 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLEllipseShapeContext, SdXMLShapeContext );
    1135                 :            : 
    1136                 :         16 : SdXMLEllipseShapeContext::SdXMLEllipseShapeContext(
    1137                 :            :     SvXMLImport& rImport,
    1138                 :            :     sal_uInt16 nPrfx,
    1139                 :            :     const OUString& rLocalName,
    1140                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    1141                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    1142                 :            :     sal_Bool bTemporaryShape)
    1143                 :            : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    1144                 :            :     mnCX( 0L ),
    1145                 :            :     mnCY( 0L ),
    1146                 :            :     mnRX( 1L ),
    1147                 :            :     mnRY( 1L ),
    1148                 :            :     meKind( drawing::CircleKind_FULL ),
    1149                 :            :     mnStartAngle( 0 ),
    1150                 :         16 :     mnEndAngle( 0 )
    1151                 :            : {
    1152                 :         16 : }
    1153                 :            : 
    1154                 :            : //////////////////////////////////////////////////////////////////////////////
    1155                 :            : 
    1156                 :         16 : SdXMLEllipseShapeContext::~SdXMLEllipseShapeContext()
    1157                 :            : {
    1158         [ -  + ]:         32 : }
    1159                 :            : 
    1160                 :            : //////////////////////////////////////////////////////////////////////////////
    1161                 :            : 
    1162                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    1163                 :        180 : void SdXMLEllipseShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    1164                 :            : {
    1165         [ +  + ]:        180 :     if( XML_NAMESPACE_SVG == nPrefix )
    1166                 :            :     {
    1167         [ -  + ]:         64 :         if( IsXMLToken( rLocalName, XML_RX ) )
    1168                 :            :         {
    1169                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1170                 :          0 :                     mnRX, rValue);
    1171                 :          0 :             return;
    1172                 :            :         }
    1173         [ -  + ]:         64 :         if( IsXMLToken( rLocalName, XML_RY ) )
    1174                 :            :         {
    1175                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1176                 :          0 :                     mnRY, rValue);
    1177                 :          0 :             return;
    1178                 :            :         }
    1179         [ -  + ]:         64 :         if( IsXMLToken( rLocalName, XML_CX ) )
    1180                 :            :         {
    1181                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1182                 :          0 :                     mnCX, rValue);
    1183                 :          0 :             return;
    1184                 :            :         }
    1185         [ -  + ]:         64 :         if( IsXMLToken( rLocalName, XML_CY ) )
    1186                 :            :         {
    1187                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1188                 :          0 :                     mnCY, rValue);
    1189                 :          0 :             return;
    1190                 :            :         }
    1191         [ -  + ]:         64 :         if( IsXMLToken( rLocalName, XML_R ) )
    1192                 :            :         {
    1193                 :            :             // single radius, it's a circle and both radii are the same
    1194                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1195                 :          0 :                     mnRX, rValue);
    1196                 :          0 :             mnRY = mnRX;
    1197                 :          0 :             return;
    1198                 :            :         }
    1199                 :            :     }
    1200         [ +  + ]:        116 :     else if( XML_NAMESPACE_DRAW == nPrefix )
    1201                 :            :     {
    1202         [ +  + ]:         63 :         if( IsXMLToken( rLocalName, XML_KIND ) )
    1203                 :            :         {
    1204                 :            :             sal_uInt16 eKind;
    1205 [ +  - ][ +  - ]:          5 :             if( SvXMLUnitConverter::convertEnum( eKind, rValue, aXML_CircleKind_EnumMap ) )
    1206                 :            :             {
    1207                 :          5 :                 meKind = eKind;
    1208                 :            :             }
    1209                 :            :             return;
    1210                 :            :         }
    1211         [ +  + ]:         58 :         if( IsXMLToken( rLocalName, XML_START_ANGLE ) )
    1212                 :            :         {
    1213                 :            :             double dStartAngle;
    1214 [ +  - ][ +  - ]:          5 :             if (::sax::Converter::convertDouble( dStartAngle, rValue ))
    1215                 :          5 :                 mnStartAngle = (sal_Int32)(dStartAngle * 100.0);
    1216                 :            :             return;
    1217                 :            :         }
    1218         [ +  + ]:         53 :         if( IsXMLToken( rLocalName, XML_END_ANGLE ) )
    1219                 :            :         {
    1220                 :            :             double dEndAngle;
    1221 [ +  - ][ +  - ]:          5 :             if (::sax::Converter::convertDouble( dEndAngle, rValue ))
    1222                 :          5 :                 mnEndAngle = (sal_Int32)(dEndAngle * 100.0);
    1223                 :            :             return;
    1224                 :            :         }
    1225                 :            :     }
    1226                 :            : 
    1227                 :        180 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    1228                 :            : }
    1229                 :            : 
    1230                 :            : //////////////////////////////////////////////////////////////////////////////
    1231                 :            : 
    1232                 :         16 : void SdXMLEllipseShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
    1233                 :            : {
    1234                 :            :     // create rectangle shape
    1235                 :         16 :     AddShape("com.sun.star.drawing.EllipseShape");
    1236         [ +  - ]:         16 :     if(mxShape.is())
    1237                 :            :     {
    1238                 :            :         // Add, set Style and properties from base shape
    1239                 :         16 :         SetStyle();
    1240                 :         16 :         SetLayer();
    1241                 :            : 
    1242                 :            :         // set pos, size, shear and rotate
    1243                 :         16 :         SetTransformation();
    1244                 :            : 
    1245         [ +  + ]:         16 :         if( meKind != drawing::CircleKind_FULL )
    1246                 :            :         {
    1247         [ +  - ]:          5 :             uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
    1248         [ +  - ]:          5 :             if( xPropSet.is() )
    1249                 :            :             {
    1250                 :          5 :                 uno::Any aAny;
    1251         [ +  - ]:          5 :                 aAny <<= (drawing::CircleKind)meKind;
    1252 [ +  - ][ +  - ]:          5 :                 xPropSet->setPropertyValue( OUString("CircleKind"), aAny );
    1253                 :            : 
    1254         [ +  - ]:          5 :                 aAny <<= mnStartAngle;
    1255 [ +  - ][ +  - ]:          5 :                 xPropSet->setPropertyValue( OUString("CircleStartAngle"), aAny );
    1256                 :            : 
    1257         [ +  - ]:          5 :                 aAny <<= mnEndAngle;
    1258 [ +  - ][ +  - ]:          5 :                 xPropSet->setPropertyValue( OUString("CircleEndAngle"), aAny );
    1259                 :          5 :             }
    1260                 :            :         }
    1261                 :            : 
    1262                 :         16 :         SdXMLShapeContext::StartElement(xAttrList);
    1263                 :            :     }
    1264                 :         16 : }
    1265                 :            : 
    1266                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1267                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1268                 :            : 
    1269 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLPolygonShapeContext, SdXMLShapeContext );
    1270                 :            : 
    1271                 :         12 : SdXMLPolygonShapeContext::SdXMLPolygonShapeContext(
    1272                 :            :     SvXMLImport& rImport,
    1273                 :            :     sal_uInt16 nPrfx,
    1274                 :            :     const OUString& rLocalName,
    1275                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    1276                 :            :     uno::Reference< drawing::XShapes >& rShapes, sal_Bool bClosed, sal_Bool bTemporaryShape)
    1277                 :            : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    1278                 :         12 :     mbClosed( bClosed )
    1279                 :            : {
    1280                 :         12 : }
    1281                 :            : 
    1282                 :            : //////////////////////////////////////////////////////////////////////////////
    1283                 :            : 
    1284                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    1285                 :        102 : void SdXMLPolygonShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    1286                 :            : {
    1287         [ +  + ]:        102 :     if( XML_NAMESPACE_SVG == nPrefix )
    1288                 :            :     {
    1289         [ +  + ]:         48 :         if( IsXMLToken( rLocalName, XML_VIEWBOX ) )
    1290                 :            :         {
    1291                 :         12 :             maViewBox = rValue;
    1292                 :         12 :             return;
    1293                 :            :         }
    1294                 :            :     }
    1295         [ +  - ]:         54 :     else if( XML_NAMESPACE_DRAW == nPrefix )
    1296                 :            :     {
    1297         [ +  + ]:         54 :         if( IsXMLToken( rLocalName, XML_POINTS ) )
    1298                 :            :         {
    1299                 :         12 :             maPoints = rValue;
    1300                 :         12 :             return;
    1301                 :            :         }
    1302                 :            :     }
    1303                 :            : 
    1304                 :        102 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    1305                 :            : }
    1306                 :            : 
    1307                 :            : //////////////////////////////////////////////////////////////////////////////
    1308                 :            : 
    1309                 :         12 : SdXMLPolygonShapeContext::~SdXMLPolygonShapeContext()
    1310                 :            : {
    1311         [ -  + ]:         24 : }
    1312                 :            : 
    1313                 :            : //////////////////////////////////////////////////////////////////////////////
    1314                 :            : 
    1315                 :         12 : void SdXMLPolygonShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
    1316                 :            : {
    1317                 :            :     // Add, set Style and properties from base shape
    1318         [ +  + ]:         12 :     if(mbClosed)
    1319                 :          9 :         AddShape("com.sun.star.drawing.PolyPolygonShape");
    1320                 :            :     else
    1321                 :          3 :         AddShape("com.sun.star.drawing.PolyLineShape");
    1322                 :            : 
    1323         [ +  - ]:         12 :     if( mxShape.is() )
    1324                 :            :     {
    1325         [ +  - ]:         12 :         SetStyle();
    1326         [ +  - ]:         12 :         SetLayer();
    1327                 :            : 
    1328                 :            :         // set local parameters on shape
    1329         [ +  - ]:         12 :         uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
    1330         [ +  - ]:         12 :         if(xPropSet.is())
    1331                 :            :         {
    1332                 :            :             // set polygon
    1333 [ +  - ][ +  - ]:         12 :             if(!maPoints.isEmpty() && !maViewBox.isEmpty())
                 [ +  - ]
    1334                 :            :             {
    1335         [ +  - ]:         12 :                 SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
    1336                 :         12 :                 awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
    1337 [ +  - ][ +  - ]:         12 :                 if (maSize.Width != 0 && maSize.Height !=0)
    1338                 :            :                 {
    1339                 :         12 :                     aSize = maSize;
    1340                 :            :                 }
    1341                 :         12 :                 awt::Point aPosition(aViewBox.GetX(), aViewBox.GetY());
    1342                 :            :                 SdXMLImExPointsElement aPoints(maPoints, aViewBox,
    1343         [ +  - ]:         12 :                     aPosition, aSize, GetImport().GetMM100UnitConverter());
    1344                 :            : 
    1345                 :         12 :                 uno::Any aAny;
    1346         [ +  - ]:         12 :                 aAny <<= aPoints.GetPointSequenceSequence();
    1347         [ +  - ]:         12 :                 xPropSet->setPropertyValue(
    1348 [ +  - ][ +  - ]:         12 :                     OUString("Geometry"), aAny);
    1349                 :            :             }
    1350                 :            :         }
    1351                 :            : 
    1352                 :            :         // set pos, size, shear and rotate and get copy of matrix
    1353         [ +  - ]:         12 :         SetTransformation();
    1354                 :            : 
    1355         [ +  - ]:         12 :         SdXMLShapeContext::StartElement(xAttrList);
    1356                 :            :     }
    1357                 :         12 : }
    1358                 :            : 
    1359                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1360                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1361                 :            : 
    1362 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLPathShapeContext, SdXMLShapeContext );
    1363                 :            : 
    1364                 :         12 : SdXMLPathShapeContext::SdXMLPathShapeContext(
    1365                 :            :     SvXMLImport& rImport,
    1366                 :            :     sal_uInt16 nPrfx,
    1367                 :            :     const OUString& rLocalName,
    1368                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    1369                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    1370                 :            :     sal_Bool bTemporaryShape)
    1371                 :         12 : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
    1372                 :            : {
    1373                 :         12 : }
    1374                 :            : 
    1375                 :            : //////////////////////////////////////////////////////////////////////////////
    1376                 :            : 
    1377                 :         12 : SdXMLPathShapeContext::~SdXMLPathShapeContext()
    1378                 :            : {
    1379         [ -  + ]:         24 : }
    1380                 :            : 
    1381                 :            : //////////////////////////////////////////////////////////////////////////////
    1382                 :            : 
    1383                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    1384                 :        102 : void SdXMLPathShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    1385                 :            : {
    1386         [ +  + ]:        102 :     if( XML_NAMESPACE_SVG == nPrefix )
    1387                 :            :     {
    1388         [ +  + ]:         60 :         if( IsXMLToken( rLocalName, XML_VIEWBOX ) )
    1389                 :            :         {
    1390                 :         12 :             maViewBox = rValue;
    1391                 :         12 :             return;
    1392                 :            :         }
    1393         [ +  + ]:         48 :         else if( IsXMLToken( rLocalName, XML_D ) )
    1394                 :            :         {
    1395                 :         12 :             maD = rValue;
    1396                 :         12 :             return;
    1397                 :            :         }
    1398                 :            :     }
    1399                 :            : 
    1400                 :        102 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    1401                 :            : }
    1402                 :            : 
    1403                 :            : //////////////////////////////////////////////////////////////////////////////
    1404                 :            : 
    1405                 :         12 : void SdXMLPathShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
    1406                 :            : {
    1407                 :            :     // create polygon shape
    1408         [ +  - ]:         12 :     if(!maD.isEmpty())
    1409                 :            :     {
    1410                 :            :         // prepare some of the parameters
    1411         [ +  - ]:         12 :         SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
    1412                 :         12 :         awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
    1413                 :         12 :         awt::Point aPosition(aViewBox.GetX(), aViewBox.GetY());
    1414 [ +  - ][ +  - ]:         12 :         if (maSize.Width != 0 && maSize.Height !=0)
    1415                 :            :         {
    1416                 :         12 :             aSize = maSize;
    1417                 :            :         }
    1418         [ +  - ]:         12 :         SdXMLImExSvgDElement aPoints(maD, aViewBox, aPosition, aSize, GetImport());
    1419                 :            : 
    1420                 :            :         const char* pService;
    1421                 :            :         // now create shape
    1422         [ +  - ]:         12 :         if(aPoints.IsCurve())
    1423                 :            :         {
    1424         [ +  + ]:         12 :             if(aPoints.IsClosed())
    1425                 :            :             {
    1426                 :          6 :                 pService = "com.sun.star.drawing.ClosedBezierShape";
    1427                 :            :             }
    1428                 :            :             else
    1429                 :            :             {
    1430                 :          6 :                 pService = "com.sun.star.drawing.OpenBezierShape";
    1431                 :            :             }
    1432                 :            :         }
    1433                 :            :         else
    1434                 :            :         {
    1435         [ #  # ]:          0 :             if(aPoints.IsClosed())
    1436                 :            :             {
    1437                 :          0 :                 pService = "com.sun.star.drawing.PolyPolygonShape";
    1438                 :            :             }
    1439                 :            :             else
    1440                 :            :             {
    1441                 :          0 :                 pService = "com.sun.star.drawing.PolyLineShape";
    1442                 :            :             }
    1443                 :            :         }
    1444                 :            : 
    1445                 :            :         // Add, set Style and properties from base shape
    1446         [ +  - ]:         12 :         AddShape(pService);
    1447                 :            : 
    1448                 :            :         // #89344# test for mxShape.is() and not for mxShapes.is() to support
    1449                 :            :         // shape import helper classes WITHOUT XShapes (member mxShapes). This
    1450                 :            :         // is used by the writer.
    1451         [ +  - ]:         12 :         if( mxShape.is() )
    1452                 :            :         {
    1453         [ +  - ]:         12 :             SetStyle();
    1454         [ +  - ]:         12 :             SetLayer();
    1455                 :            : 
    1456                 :            :             // set local parameters on shape
    1457         [ +  - ]:         12 :             uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
    1458         [ +  - ]:         12 :             if(xPropSet.is())
    1459                 :            :             {
    1460                 :         12 :                 uno::Any aAny;
    1461                 :            : 
    1462                 :            :                 // set svg:d
    1463         [ +  - ]:         12 :                 if(!maD.isEmpty())
    1464                 :            :                 {
    1465         [ +  - ]:         12 :                     if(aPoints.IsCurve())
    1466                 :            :                     {
    1467                 :            :                         drawing::PolyPolygonBezierCoords aSourcePolyPolygon(
    1468                 :         12 :                             aPoints.GetPointSequenceSequence(),
    1469         [ +  - ]:         24 :                             aPoints.GetFlagSequenceSequence());
    1470                 :            : 
    1471         [ +  - ]:         12 :                         aAny <<= aSourcePolyPolygon;
    1472         [ +  - ]:         12 :                         xPropSet->setPropertyValue(
    1473 [ +  - ][ +  - ]:         12 :                             OUString("Geometry"), aAny);
    1474                 :            :                     }
    1475                 :            :                     else
    1476                 :            :                     {
    1477         [ #  # ]:          0 :                         aAny <<= aPoints.GetPointSequenceSequence();
    1478         [ #  # ]:          0 :                         xPropSet->setPropertyValue(
    1479         [ #  # ]:          0 :                             OUString("Geometry"), aAny);
    1480                 :            :                     }
    1481                 :         12 :                 }
    1482                 :            :             }
    1483                 :            : 
    1484                 :            :             // set pos, size, shear and rotate
    1485         [ +  - ]:         12 :             SetTransformation();
    1486                 :            : 
    1487         [ +  - ]:         12 :             SdXMLShapeContext::StartElement(xAttrList);
    1488         [ +  - ]:         12 :         }
    1489                 :            :     }
    1490                 :         12 : }
    1491                 :            : 
    1492                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1493                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1494                 :            : 
    1495 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLTextBoxShapeContext, SdXMLShapeContext );
    1496                 :            : 
    1497                 :        112 : SdXMLTextBoxShapeContext::SdXMLTextBoxShapeContext(
    1498                 :            :     SvXMLImport& rImport,
    1499                 :            :     sal_uInt16 nPrfx,
    1500                 :            :     const OUString& rLocalName,
    1501                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    1502                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    1503                 :            :     sal_Bool bTemporaryShape)
    1504                 :            : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    1505                 :        112 :     mnRadius(0)
    1506                 :            : {
    1507                 :        112 : }
    1508                 :            : 
    1509                 :            : //////////////////////////////////////////////////////////////////////////////
    1510                 :            : 
    1511                 :        112 : SdXMLTextBoxShapeContext::~SdXMLTextBoxShapeContext()
    1512                 :            : {
    1513         [ -  + ]:        224 : }
    1514                 :            : 
    1515                 :            : //////////////////////////////////////////////////////////////////////////////
    1516                 :            : 
    1517                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    1518                 :        905 : void SdXMLTextBoxShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    1519                 :            : {
    1520         [ +  + ]:        905 :     if( XML_NAMESPACE_DRAW == nPrefix )
    1521                 :            :     {
    1522         [ -  + ]:        196 :         if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
    1523                 :            :         {
    1524                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1525                 :          0 :                     mnRadius, rValue);
    1526                 :        905 :             return;
    1527                 :            :         }
    1528                 :            :     }
    1529                 :            : 
    1530                 :        905 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    1531                 :            : }
    1532                 :            : 
    1533                 :            : //////////////////////////////////////////////////////////////////////////////
    1534                 :            : 
    1535                 :        112 : void SdXMLTextBoxShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
    1536                 :            : {
    1537                 :            :     // create textbox shape
    1538                 :        112 :     sal_Bool bIsPresShape = sal_False;
    1539                 :        112 :     bool bClearText = false;
    1540                 :            : 
    1541                 :        112 :     const char *pService = NULL;
    1542                 :            : 
    1543         [ +  - ]:        112 :     if( isPresentationShape() )
    1544                 :            :     {
    1545                 :            :         // check if the current document supports presentation shapes
    1546 [ +  - ][ +  - ]:        112 :         if( GetImport().GetShapeImport()->IsPresentationShapesSupported() )
                 [ +  - ]
    1547                 :            :         {
    1548         [ +  + ]:        112 :             if( IsXMLToken( maPresentationClass, XML_PRESENTATION_SUBTITLE ))
    1549                 :            :             {
    1550                 :            :                 // XmlShapeTypePresSubtitleShape
    1551                 :          4 :                 pService = "com.sun.star.presentation.SubtitleShape";
    1552                 :            :             }
    1553         [ +  + ]:        108 :             else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OUTLINE ) )
    1554                 :            :             {
    1555                 :            :                 // XmlShapeTypePresOutlinerShape
    1556                 :          7 :                 pService = "com.sun.star.presentation.OutlinerShape";
    1557                 :            :             }
    1558         [ +  + ]:        101 :             else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_NOTES ) )
    1559                 :            :             {
    1560                 :            :                 // XmlShapeTypePresNotesShape
    1561                 :         35 :                 pService = "com.sun.star.presentation.NotesShape";
    1562                 :            :             }
    1563         [ +  + ]:         66 :             else if( IsXMLToken( maPresentationClass, XML_HEADER ) )
    1564                 :            :             {
    1565                 :            :                 // XmlShapeTypePresHeaderShape
    1566                 :         10 :                 pService = "com.sun.star.presentation.HeaderShape";
    1567                 :         10 :                 bClearText = true;
    1568                 :            :             }
    1569         [ +  + ]:         56 :             else if( IsXMLToken( maPresentationClass, XML_FOOTER ) )
    1570                 :            :             {
    1571                 :            :                 // XmlShapeTypePresFooterShape
    1572                 :         15 :                 pService = "com.sun.star.presentation.FooterShape";
    1573                 :         15 :                 bClearText = true;
    1574                 :            :             }
    1575         [ +  + ]:         41 :             else if( IsXMLToken( maPresentationClass, XML_PAGE_NUMBER ) )
    1576                 :            :             {
    1577                 :            :                 // XmlShapeTypePresSlideNumberShape
    1578                 :         15 :                 pService = "com.sun.star.presentation.SlideNumberShape";
    1579                 :         15 :                 bClearText = true;
    1580                 :            :             }
    1581         [ +  + ]:         26 :             else if( IsXMLToken( maPresentationClass, XML_DATE_TIME ) )
    1582                 :            :             {
    1583                 :            :                 // XmlShapeTypePresDateTimeShape
    1584                 :         15 :                 pService = "com.sun.star.presentation.DateTimeShape";
    1585                 :         15 :                 bClearText = true;
    1586                 :            :             }
    1587                 :            :             else //  IsXMLToken( maPresentationClass, XML_PRESENTATION_TITLE ) )
    1588                 :            :             {
    1589                 :            :                 // XmlShapeTypePresTitleTextShape
    1590                 :         11 :                 pService = "com.sun.star.presentation.TitleTextShape";
    1591                 :            :             }
    1592                 :        112 :             bIsPresShape = sal_True;
    1593                 :            :         }
    1594                 :            :     }
    1595                 :            : 
    1596         [ -  + ]:        112 :     if( NULL == pService )
    1597                 :            :     {
    1598                 :            :         // normal text shape
    1599                 :          0 :         pService = "com.sun.star.drawing.TextShape";
    1600                 :            :     }
    1601                 :            : 
    1602                 :            :     // Add, set Style and properties from base shape
    1603                 :        112 :     AddShape(pService);
    1604                 :            : 
    1605         [ +  - ]:        112 :     if( mxShape.is() )
    1606                 :            :     {
    1607                 :        112 :         SetStyle();
    1608                 :        112 :         SetLayer();
    1609                 :            : 
    1610         [ +  - ]:        112 :         if(bIsPresShape)
    1611                 :            :         {
    1612         [ +  - ]:        112 :             uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
    1613         [ +  - ]:        112 :             if(xProps.is())
    1614                 :            :             {
    1615 [ +  - ][ +  - ]:        112 :                 uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
    1616         [ +  - ]:        112 :                 if( xPropsInfo.is() )
    1617                 :            :                 {
    1618 [ +  + ][ +  - ]:        112 :                     if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString("IsEmptyPresentationObject" )))
         [ +  - ][ +  - ]
         [ +  + ][ +  + ]
           [ +  +  #  #  
                   #  # ]
    1619 [ +  - ][ +  - ]:         55 :                         xProps->setPropertyValue( OUString("IsEmptyPresentationObject" ), ::cppu::bool2any( sal_False ) );
                 [ +  - ]
    1620                 :            : 
    1621 [ -  + ][ #  # ]:        112 :                     if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString("IsPlaceholderDependent" )))
         [ #  # ][ #  # ]
         [ -  + ][ -  + ]
           [ -  +  #  #  
                   #  # ]
    1622 [ #  # ][ #  # ]:          0 :                         xProps->setPropertyValue( OUString("IsPlaceholderDependent" ), ::cppu::bool2any( sal_False ) );
                 [ #  # ]
    1623                 :        112 :                 }
    1624                 :        112 :             }
    1625                 :            :         }
    1626                 :            : 
    1627         [ +  + ]:        112 :         if( bClearText )
    1628                 :            :         {
    1629         [ +  - ]:         55 :             uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
    1630                 :         55 :             OUString aEmpty;
    1631 [ +  - ][ +  - ]:         55 :             xText->setString( aEmpty );
    1632                 :            :         }
    1633                 :            : 
    1634                 :            :         // set parameters on shape
    1635                 :            : //A AW->CL: Eventually You need to strip scale and translate from the transformation
    1636                 :            : //A to reach the same goal again.
    1637                 :            : //A     if(!bIsPresShape || mbIsUserTransformed)
    1638                 :            : //A     {
    1639                 :            : //A         // set pos and size on shape, this should remove binding
    1640                 :            : //A         // to pres object on masterpage
    1641                 :            : //A         SetSizeAndPosition();
    1642                 :            : //A     }
    1643                 :            : 
    1644                 :            :         // set pos, size, shear and rotate
    1645                 :        112 :         SetTransformation();
    1646                 :            : 
    1647         [ -  + ]:        112 :         if(mnRadius)
    1648                 :            :         {
    1649         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
    1650         [ #  # ]:          0 :             if(xPropSet.is())
    1651                 :            :             {
    1652                 :            :                 try
    1653                 :            :                 {
    1654 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString("CornerRadius"), uno::makeAny( mnRadius ) );
         [ #  # ][ #  # ]
    1655                 :            :                 }
    1656         [ #  # ]:          0 :                 catch(const uno::Exception&)
    1657                 :            :                 {
    1658                 :            :                     OSL_FAIL( "exception during setting of corner radius!");
    1659                 :            :                 }
    1660                 :          0 :             }
    1661                 :            :         }
    1662                 :            : 
    1663                 :        112 :         SdXMLShapeContext::StartElement(mxAttrList);
    1664                 :            :     }
    1665                 :        112 : }
    1666                 :            : 
    1667                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1668                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1669                 :            : 
    1670 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLControlShapeContext, SdXMLShapeContext );
    1671                 :            : 
    1672                 :         37 : SdXMLControlShapeContext::SdXMLControlShapeContext(
    1673                 :            :     SvXMLImport& rImport,
    1674                 :            :     sal_uInt16 nPrfx,
    1675                 :            :     const OUString& rLocalName,
    1676                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    1677                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    1678                 :            :     sal_Bool bTemporaryShape)
    1679                 :         37 : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
    1680                 :            : {
    1681                 :         37 : }
    1682                 :            : 
    1683                 :            : //////////////////////////////////////////////////////////////////////////////
    1684                 :            : 
    1685                 :         37 : SdXMLControlShapeContext::~SdXMLControlShapeContext()
    1686                 :            : {
    1687         [ -  + ]:         74 : }
    1688                 :            : 
    1689                 :            : //////////////////////////////////////////////////////////////////////////////
    1690                 :            : 
    1691                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    1692                 :        367 : void SdXMLControlShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    1693                 :            : {
    1694         [ +  + ]:        367 :     if( XML_NAMESPACE_DRAW == nPrefix )
    1695                 :            :     {
    1696         [ +  + ]:        128 :         if( IsXMLToken( rLocalName, XML_CONTROL ) )
    1697                 :            :         {
    1698                 :         37 :             maFormId = rValue;
    1699                 :        367 :             return;
    1700                 :            :         }
    1701                 :            :     }
    1702                 :            : 
    1703                 :        330 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    1704                 :            : }
    1705                 :            : 
    1706                 :         37 : void SdXMLControlShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
    1707                 :            : {
    1708                 :            :     // create Control shape
    1709                 :            :     // add, set style and properties from base shape
    1710                 :         37 :     AddShape("com.sun.star.drawing.ControlShape");
    1711         [ +  - ]:         37 :     if( mxShape.is() )
    1712                 :            :     {
    1713                 :            :         DBG_ASSERT( !maFormId.isEmpty(), "draw:control without a form:id attribute!" );
    1714         [ +  - ]:         37 :         if( !maFormId.isEmpty() )
    1715                 :            :         {
    1716         [ +  - ]:         37 :             if( GetImport().IsFormsSupported() )
    1717                 :            :             {
    1718 [ +  - ][ +  - ]:         37 :                 uno::Reference< awt::XControlModel > xControlModel( GetImport().GetFormImport()->lookupControl( maFormId ), uno::UNO_QUERY );
         [ +  - ][ +  - ]
                 [ +  - ]
    1719         [ +  - ]:         37 :                 if( xControlModel.is() )
    1720                 :            :                 {
    1721         [ +  - ]:         37 :                     uno::Reference< drawing::XControlShape > xControl( mxShape, uno::UNO_QUERY );
    1722         [ +  - ]:         37 :                     if( xControl.is() )
    1723 [ +  - ][ +  - ]:         37 :                         xControl->setControl(  xControlModel );
    1724                 :            : 
    1725                 :         37 :                 }
    1726                 :            :             }
    1727                 :            :         }
    1728                 :            : 
    1729                 :         37 :         SetStyle();
    1730                 :         37 :         SetLayer();
    1731                 :            : 
    1732                 :            :         // set pos, size, shear and rotate
    1733                 :         37 :         SetTransformation();
    1734                 :            : 
    1735                 :         37 :         SdXMLShapeContext::StartElement(xAttrList);
    1736                 :            :     }
    1737                 :         37 : }
    1738                 :            : 
    1739                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1740                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1741                 :            : 
    1742 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLConnectorShapeContext, SdXMLShapeContext );
    1743                 :            : 
    1744                 :          0 : SdXMLConnectorShapeContext::SdXMLConnectorShapeContext(
    1745                 :            :     SvXMLImport& rImport,
    1746                 :            :     sal_uInt16 nPrfx,
    1747                 :            :     const OUString& rLocalName,
    1748                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    1749                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    1750                 :            :     sal_Bool bTemporaryShape)
    1751                 :            : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    1752                 :            :     maStart(0,0),
    1753                 :            :     maEnd(1,1),
    1754                 :            :     mnType( (sal_uInt16)drawing::ConnectorType_STANDARD ),
    1755                 :            :     mnStartGlueId(-1),
    1756                 :            :     mnEndGlueId(-1),
    1757                 :            :     mnDelta1(0),
    1758                 :            :     mnDelta2(0),
    1759                 :          0 :     mnDelta3(0)
    1760                 :            : {
    1761                 :          0 : }
    1762                 :            : 
    1763                 :            : //////////////////////////////////////////////////////////////////////////////
    1764                 :            : 
    1765                 :          0 : SdXMLConnectorShapeContext::~SdXMLConnectorShapeContext()
    1766                 :            : {
    1767         [ #  # ]:          0 : }
    1768                 :            : 
    1769                 :            : //////////////////////////////////////////////////////////////////////////////
    1770                 :            : 
    1771                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    1772                 :          0 : void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    1773                 :            : {
    1774      [ #  #  # ]:          0 :     switch( nPrefix )
    1775                 :            :     {
    1776                 :            :     case XML_NAMESPACE_DRAW:
    1777                 :            :     {
    1778         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_START_SHAPE ) )
    1779                 :            :         {
    1780                 :          0 :             maStartShapeId = rValue;
    1781                 :          0 :             return;
    1782                 :            :         }
    1783         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_START_GLUE_POINT ) )
    1784                 :            :         {
    1785                 :          0 :             mnStartGlueId = rValue.toInt32();
    1786                 :          0 :             return;
    1787                 :            :         }
    1788         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_END_SHAPE ) )
    1789                 :            :         {
    1790                 :          0 :             maEndShapeId = rValue;
    1791                 :          0 :             return;
    1792                 :            :         }
    1793         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_END_GLUE_POINT ) )
    1794                 :            :         {
    1795                 :          0 :             mnEndGlueId = rValue.toInt32();
    1796                 :          0 :             return;
    1797                 :            :         }
    1798         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_LINE_SKEW ) )
    1799                 :            :         {
    1800         [ #  # ]:          0 :             SvXMLTokenEnumerator aTokenEnum( rValue );
    1801                 :          0 :             OUString aToken;
    1802 [ #  # ][ #  # ]:          0 :             if( aTokenEnum.getNextToken( aToken ) )
    1803                 :            :             {
    1804                 :          0 :                 GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1805         [ #  # ]:          0 :                         mnDelta1, aToken);
    1806 [ #  # ][ #  # ]:          0 :                 if( aTokenEnum.getNextToken( aToken ) )
    1807                 :            :                 {
    1808                 :          0 :                     GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1809         [ #  # ]:          0 :                             mnDelta2, aToken);
    1810 [ #  # ][ #  # ]:          0 :                     if( aTokenEnum.getNextToken( aToken ) )
    1811                 :            :                     {
    1812                 :          0 :                         GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1813         [ #  # ]:          0 :                                 mnDelta3, aToken);
    1814                 :            :                     }
    1815                 :            :                 }
    1816                 :            :             }
    1817                 :          0 :             return;
    1818                 :            :         }
    1819         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_TYPE ) )
    1820                 :            :         {
    1821                 :          0 :             SvXMLUnitConverter::convertEnum( mnType, rValue, aXML_ConnectionKind_EnumMap );
    1822                 :          0 :             return;
    1823                 :            :         }
    1824                 :            :     }
    1825                 :            :     case XML_NAMESPACE_SVG:
    1826                 :            :     {
    1827         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_X1 ) )
    1828                 :            :         {
    1829                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1830                 :          0 :                     maStart.X, rValue);
    1831                 :          0 :             return;
    1832                 :            :         }
    1833         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_Y1 ) )
    1834                 :            :         {
    1835                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1836                 :          0 :                     maStart.Y, rValue);
    1837                 :          0 :             return;
    1838                 :            :         }
    1839         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_X2 ) )
    1840                 :            :         {
    1841                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1842                 :          0 :                     maEnd.X, rValue);
    1843                 :          0 :             return;
    1844                 :            :         }
    1845         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_Y2 ) )
    1846                 :            :         {
    1847                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    1848                 :          0 :                     maEnd.Y, rValue);
    1849                 :          0 :             return;
    1850                 :            :         }
    1851         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_D ) )
    1852                 :            :         {
    1853         [ #  # ]:          0 :             SdXMLImExViewBox aViewBox( 0, 0, 1, 1 );
    1854                 :          0 :             awt::Point aPoint( 0, 0 );
    1855                 :          0 :             awt::Size aSize( 1, 1 );
    1856                 :            : 
    1857         [ #  # ]:          0 :             SdXMLImExSvgDElement aPoints( rValue, aViewBox, aPoint, aSize, GetImport() );
    1858                 :            : 
    1859         [ #  # ]:          0 :             if ( aPoints.IsCurve() )
    1860                 :            :             {
    1861                 :            :                 drawing::PolyPolygonBezierCoords aSourcePolyPolygon(
    1862                 :          0 :                     aPoints.GetPointSequenceSequence(),
    1863         [ #  # ]:          0 :                     aPoints.GetFlagSequenceSequence());
    1864 [ #  # ][ #  # ]:          0 :                 maPath <<= aSourcePolyPolygon;
    1865                 :            :             }
    1866                 :            :             else
    1867                 :            :             {
    1868                 :          0 :                 const drawing::PointSequenceSequence& rOuterSeq = aPoints.GetPointSequenceSequence();
    1869         [ #  # ]:          0 :                 drawing::FlagSequenceSequence aFlagSeqSeq( rOuterSeq.getLength() );
    1870         [ #  # ]:          0 :                 for ( int a = 0; a < rOuterSeq.getLength(); a++ )
    1871 [ #  # ][ #  # ]:          0 :                     aFlagSeqSeq[ a ] = drawing::FlagSequence( rOuterSeq[ a ].getLength() );
         [ #  # ][ #  # ]
    1872                 :            : 
    1873                 :            :                 drawing::PolyPolygonBezierCoords aSourcePolyPolygon(
    1874                 :          0 :                     aPoints.GetPointSequenceSequence(),
    1875         [ #  # ]:          0 :                     aFlagSeqSeq );
    1876 [ #  # ][ #  # ]:          0 :                 maPath <<= aSourcePolyPolygon;
                 [ #  # ]
    1877         [ #  # ]:          0 :             }
    1878                 :            :         }
    1879                 :            :     }
    1880                 :            :     }
    1881                 :            : 
    1882                 :          0 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    1883                 :            : }
    1884                 :            : 
    1885                 :            : //////////////////////////////////////////////////////////////////////////////
    1886                 :            : 
    1887                 :          0 : void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
    1888                 :            : {
    1889                 :            :     // #107928#
    1890                 :            :     // For security reasons, do not add empty connectors. There may have been an error in EA2
    1891                 :            :     // that created empty, far set off connectors (e.g. 63 meters below top of document). This
    1892                 :            :     // is not guaranteed, but it's definitely safe to not add empty connectors.
    1893                 :          0 :     sal_Bool bDoAdd(sal_True);
    1894                 :            : 
    1895   [ #  #  #  # ]:          0 :     if(    maStartShapeId.isEmpty()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1896                 :          0 :         && maEndShapeId.isEmpty()
    1897                 :            :         && maStart.X == maEnd.X
    1898                 :            :         && maStart.Y == maEnd.Y
    1899                 :            :         && 0 == mnDelta1
    1900                 :            :         && 0 == mnDelta2
    1901                 :            :         && 0 == mnDelta3
    1902                 :            :         )
    1903                 :            :     {
    1904                 :          0 :         bDoAdd = sal_False;
    1905                 :            :     }
    1906                 :            : 
    1907         [ #  # ]:          0 :     if(bDoAdd)
    1908                 :            :     {
    1909                 :            :         // create Connector shape
    1910                 :            :         // add, set style and properties from base shape
    1911                 :          0 :         AddShape("com.sun.star.drawing.ConnectorShape");
    1912         [ #  # ]:          0 :         if(mxShape.is())
    1913                 :            :         {
    1914                 :            :             // add connection ids
    1915         [ #  # ]:          0 :             if( !maStartShapeId.isEmpty() )
    1916 [ #  # ][ #  # ]:          0 :                 GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_True, maStartShapeId, mnStartGlueId );
         [ #  # ][ #  # ]
    1917         [ #  # ]:          0 :             if( !maEndShapeId.isEmpty() )
    1918 [ #  # ][ #  # ]:          0 :                 GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_False, maEndShapeId, mnEndGlueId );
         [ #  # ][ #  # ]
    1919                 :            : 
    1920         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
    1921         [ #  # ]:          0 :             if( xProps.is() )
    1922                 :            :             {
    1923                 :          0 :                 uno::Any aAny;
    1924         [ #  # ]:          0 :                 aAny <<= maStart;
    1925 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue(OUString("StartPosition"), aAny);
    1926                 :            : 
    1927         [ #  # ]:          0 :                 aAny <<= maEnd;
    1928 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue(OUString("EndPosition"), aAny );
    1929                 :            : 
    1930         [ #  # ]:          0 :                 aAny <<= (drawing::ConnectorType)mnType;
    1931 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue(OUString("EdgeKind"), aAny );
    1932                 :            : 
    1933         [ #  # ]:          0 :                 aAny <<= mnDelta1;
    1934 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue(OUString("EdgeLine1Delta"), aAny );
    1935                 :            : 
    1936         [ #  # ]:          0 :                 aAny <<= mnDelta2;
    1937 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue(OUString("EdgeLine2Delta"), aAny );
    1938                 :            : 
    1939         [ #  # ]:          0 :                 aAny <<= mnDelta3;
    1940 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue(OUString("EdgeLine3Delta"), aAny );
    1941                 :            :             }
    1942         [ #  # ]:          0 :             SetStyle();
    1943         [ #  # ]:          0 :             SetLayer();
    1944                 :            : 
    1945         [ #  # ]:          0 :             if ( maPath.hasValue() )
    1946                 :            :             {
    1947                 :            :                 // #i115492#
    1948                 :            :                 // Ignore svg:d attribute for text documents created by OpenOffice.org
    1949                 :            :                 // versions before OOo 3.3, because these OOo versions are storing
    1950                 :            :                 // svg:d values not using the correct unit.
    1951                 :          0 :                 bool bApplySVGD( true );
    1952 [ #  # ][ #  # ]:          0 :                 if ( uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() )
    1953                 :            :                 {
    1954                 :          0 :                     sal_Int32 nUPD( 0 );
    1955                 :          0 :                     sal_Int32 nBuild( 0 );
    1956         [ #  # ]:          0 :                     const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild );
    1957 [ #  # ][ #  # ]:          0 :                     if ( GetImport().IsTextDocInOOoFileFormat() ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1958                 :            :                          ( bBuildIdFound &&
    1959                 :            :                            ( ( nUPD == 641 ) || ( nUPD == 645 ) ||  // prior OOo 2.0
    1960                 :            :                              ( nUPD == 680 ) ||                     // OOo 2.x
    1961                 :            :                              ( nUPD == 300 ) ||                     // OOo 3.0 - OOo 3.0.1
    1962                 :            :                              ( nUPD == 310 ) ||                     // OOo 3.1 - OOo 3.1.1
    1963                 :            :                              ( nUPD == 320 ) ) ) )                  // OOo 3.2 - OOo 3.2.1
    1964                 :            :                     {
    1965                 :          0 :                         bApplySVGD = false;
    1966                 :            :                     }
    1967                 :            :                 }
    1968                 :            : 
    1969         [ #  # ]:          0 :                 if ( bApplySVGD )
    1970                 :            :                 {
    1971 [ #  # ][ #  # ]:          0 :                     xProps->setPropertyValue( OUString("PolyPolygonBezier" ), maPath );
    1972                 :            :                 }
    1973                 :            :             }
    1974                 :            : 
    1975         [ #  # ]:          0 :             SdXMLShapeContext::StartElement(xAttrList);
    1976                 :            :         }
    1977                 :            :     }
    1978                 :          0 : }
    1979                 :            : 
    1980                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1981                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1982                 :            : 
    1983 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLMeasureShapeContext, SdXMLShapeContext );
    1984                 :            : 
    1985                 :          0 : SdXMLMeasureShapeContext::SdXMLMeasureShapeContext(
    1986                 :            :     SvXMLImport& rImport,
    1987                 :            :     sal_uInt16 nPrfx,
    1988                 :            :     const OUString& rLocalName,
    1989                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    1990                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    1991                 :            :     sal_Bool bTemporaryShape)
    1992                 :            : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    1993                 :            :     maStart(0,0),
    1994                 :          0 :     maEnd(1,1)
    1995                 :            : {
    1996                 :          0 : }
    1997                 :            : 
    1998                 :            : //////////////////////////////////////////////////////////////////////////////
    1999                 :            : 
    2000                 :          0 : SdXMLMeasureShapeContext::~SdXMLMeasureShapeContext()
    2001                 :            : {
    2002         [ #  # ]:          0 : }
    2003                 :            : 
    2004                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    2005                 :          0 : void SdXMLMeasureShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    2006                 :            : {
    2007         [ #  # ]:          0 :     switch( nPrefix )
    2008                 :            :     {
    2009                 :            :     case XML_NAMESPACE_SVG:
    2010                 :            :     {
    2011         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_X1 ) )
    2012                 :            :         {
    2013                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    2014                 :          0 :                     maStart.X, rValue);
    2015                 :          0 :             return;
    2016                 :            :         }
    2017         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_Y1 ) )
    2018                 :            :         {
    2019                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    2020                 :          0 :                     maStart.Y, rValue);
    2021                 :          0 :             return;
    2022                 :            :         }
    2023         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_X2 ) )
    2024                 :            :         {
    2025                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    2026                 :          0 :                     maEnd.X, rValue);
    2027                 :          0 :             return;
    2028                 :            :         }
    2029         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_Y2 ) )
    2030                 :            :         {
    2031                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    2032                 :          0 :                     maEnd.Y, rValue);
    2033                 :          0 :             return;
    2034                 :            :         }
    2035                 :            :     }
    2036                 :            :     }
    2037                 :            : 
    2038                 :          0 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    2039                 :            : }
    2040                 :            : 
    2041                 :            : //////////////////////////////////////////////////////////////////////////////
    2042                 :            : 
    2043                 :          0 : void SdXMLMeasureShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
    2044                 :            : {
    2045                 :            :     // create Measure shape
    2046                 :            :     // add, set style and properties from base shape
    2047                 :          0 :     AddShape("com.sun.star.drawing.MeasureShape");
    2048         [ #  # ]:          0 :     if(mxShape.is())
    2049                 :            :     {
    2050         [ #  # ]:          0 :         SetStyle();
    2051         [ #  # ]:          0 :         SetLayer();
    2052                 :            : 
    2053         [ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
    2054         [ #  # ]:          0 :         if( xProps.is() )
    2055                 :            :         {
    2056                 :          0 :             uno::Any aAny;
    2057         [ #  # ]:          0 :             aAny <<= maStart;
    2058 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue(OUString("StartPosition"), aAny);
    2059                 :            : 
    2060         [ #  # ]:          0 :             aAny <<= maEnd;
    2061 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue(OUString("EndPosition"), aAny );
    2062                 :            :         }
    2063                 :            : 
    2064                 :            :         // delete pre created fields
    2065         [ #  # ]:          0 :         uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
    2066         [ #  # ]:          0 :         if( xText.is() )
    2067                 :            :         {
    2068                 :          0 :             const OUString aEmpty(  " "  );
    2069 [ #  # ][ #  # ]:          0 :             xText->setString( aEmpty );
    2070                 :            :         }
    2071                 :            : 
    2072         [ #  # ]:          0 :         SdXMLShapeContext::StartElement(xAttrList);
    2073                 :            :     }
    2074                 :          0 : }
    2075                 :            : 
    2076                 :          0 : void SdXMLMeasureShapeContext::EndElement()
    2077                 :            : {
    2078                 :            :     do
    2079                 :            :     {
    2080                 :            :         // delete pre created fields
    2081         [ #  # ]:          0 :         uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
    2082         [ #  # ]:          0 :         if( !xText.is() )
    2083                 :            :             break;
    2084                 :            : 
    2085 [ #  # ][ #  # ]:          0 :         uno::Reference< text::XTextCursor > xCursor( xText->createTextCursor() );
    2086         [ #  # ]:          0 :         if( !xCursor.is() )
    2087                 :            :             break;
    2088                 :            : 
    2089                 :          0 :         const OUString aEmpty;
    2090 [ #  # ][ #  # ]:          0 :         xCursor->collapseToStart();
    2091 [ #  # ][ #  # ]:          0 :         xCursor->goRight( 1, sal_True );
    2092 [ #  # ][ #  # ]:          0 :         xCursor->setString( aEmpty );
         [ #  # ][ #  # ]
    2093                 :            :     }
    2094                 :            :     while(0);
    2095                 :            : 
    2096                 :          0 :     SdXMLShapeContext::EndElement();
    2097                 :          0 : }
    2098                 :            : 
    2099                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2100                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2101                 :            : 
    2102 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLPageShapeContext, SdXMLShapeContext );
    2103                 :            : 
    2104                 :         77 : SdXMLPageShapeContext::SdXMLPageShapeContext(
    2105                 :            :     SvXMLImport& rImport,
    2106                 :            :     sal_uInt16 nPrfx,
    2107                 :            :     const OUString& rLocalName,
    2108                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    2109                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    2110                 :            :     sal_Bool bTemporaryShape)
    2111                 :         77 : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), mnPageNumber(0)
    2112                 :            : {
    2113                 :         77 :     mbClearDefaultAttributes = false;
    2114                 :         77 : }
    2115                 :            : 
    2116                 :            : //////////////////////////////////////////////////////////////////////////////
    2117                 :            : 
    2118                 :         77 : SdXMLPageShapeContext::~SdXMLPageShapeContext()
    2119                 :            : {
    2120         [ -  + ]:        154 : }
    2121                 :            : 
    2122                 :            : //////////////////////////////////////////////////////////////////////////////
    2123                 :            : 
    2124                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    2125                 :        483 : void SdXMLPageShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    2126                 :            : {
    2127         [ +  + ]:        483 :     if( XML_NAMESPACE_DRAW == nPrefix )
    2128                 :            :     {
    2129         [ +  + ]:        133 :         if( IsXMLToken( rLocalName, XML_PAGE_NUMBER ) )
    2130                 :            :         {
    2131                 :         28 :             mnPageNumber = rValue.toInt32();
    2132                 :        483 :             return;
    2133                 :            :         }
    2134                 :            :     }
    2135                 :            : 
    2136                 :        455 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    2137                 :            : }
    2138                 :            : 
    2139                 :            : //////////////////////////////////////////////////////////////////////////////
    2140                 :            : 
    2141                 :         77 : void SdXMLPageShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
    2142                 :            : {
    2143                 :            :     // create Page shape
    2144                 :            :     // add, set style and properties from base shape
    2145                 :            : 
    2146                 :            :     // #86163# take into account which type of PageShape needs to
    2147                 :            :     // be constructed. It's an pres shape if presentation:XML_CLASS == XML_PRESENTATION_PAGE.
    2148                 :         77 :     sal_Bool bIsPresentation = !maPresentationClass.isEmpty() &&
    2149 [ +  - ][ +  - ]:         77 :            GetImport().GetShapeImport()->IsPresentationShapesSupported();
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
         [ #  # ][ +  + ]
    2150                 :            : 
    2151         [ +  - ]:         77 :     uno::Reference< lang::XServiceInfo > xInfo( mxShapes, uno::UNO_QUERY );
    2152 [ +  - ][ +  - ]:         77 :     const sal_Bool bIsOnHandoutPage = xInfo.is() && xInfo->supportsService( OUString( "com.sun.star.presentation.HandoutMasterPage") );
         [ +  - ][ +  + ]
         [ +  - ][ +  - ]
           [ #  #  #  # ]
    2153                 :            : 
    2154         [ +  + ]:         77 :     if( bIsOnHandoutPage )
    2155                 :            :     {
    2156         [ +  - ]:         42 :         AddShape("com.sun.star.presentation.HandoutShape");
    2157                 :            :     }
    2158                 :            :     else
    2159                 :            :     {
    2160 [ +  - ][ +  - ]:         35 :         if(bIsPresentation && !IsXMLToken( maPresentationClass, XML_PRESENTATION_PAGE ) )
         [ -  + ][ -  + ]
    2161                 :            :         {
    2162                 :          0 :             bIsPresentation = sal_False;
    2163                 :            :         }
    2164                 :            : 
    2165         [ +  - ]:         35 :         if(bIsPresentation)
    2166                 :            :         {
    2167         [ +  - ]:         35 :             AddShape("com.sun.star.presentation.PageShape");
    2168                 :            :         }
    2169                 :            :         else
    2170                 :            :         {
    2171         [ #  # ]:          0 :             AddShape("com.sun.star.drawing.PageShape");
    2172                 :            :         }
    2173                 :            :     }
    2174                 :            : 
    2175         [ +  - ]:         77 :     if(mxShape.is())
    2176                 :            :     {
    2177         [ +  - ]:         77 :         SetStyle();
    2178         [ +  - ]:         77 :         SetLayer();
    2179                 :            : 
    2180                 :            :         // set pos, size, shear and rotate
    2181         [ +  - ]:         77 :         SetTransformation();
    2182                 :            : 
    2183         [ +  - ]:         77 :         uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
    2184         [ +  - ]:         77 :         if(xPropSet.is())
    2185                 :            :         {
    2186 [ +  - ][ +  - ]:         77 :             uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
    2187                 :         77 :             const OUString aPageNumberStr("PageNumber");
    2188 [ +  - ][ +  - ]:         77 :             if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
         [ +  - ][ +  - ]
                 [ +  - ]
    2189 [ +  - ][ +  - ]:         77 :                 xPropSet->setPropertyValue(aPageNumberStr, uno::makeAny( mnPageNumber ));
                 [ +  - ]
    2190                 :            :         }
    2191                 :            : 
    2192         [ +  - ]:         77 :         SdXMLShapeContext::StartElement(xAttrList);
    2193                 :         77 :     }
    2194                 :         77 : }
    2195                 :            : 
    2196                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2197                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2198                 :            : 
    2199 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLCaptionShapeContext, SdXMLShapeContext );
    2200                 :            : 
    2201                 :          8 : SdXMLCaptionShapeContext::SdXMLCaptionShapeContext(
    2202                 :            :     SvXMLImport& rImport,
    2203                 :            :     sal_uInt16 nPrfx,
    2204                 :            :     const OUString& rLocalName,
    2205                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    2206                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    2207                 :            :     sal_Bool bTemporaryShape)
    2208                 :            : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    2209                 :            :     // #86616# for correct edge rounding import mnRadius needs to be initialized
    2210                 :          8 :     mnRadius( 0L )
    2211                 :            : {
    2212                 :          8 : }
    2213                 :            : 
    2214                 :            : //////////////////////////////////////////////////////////////////////////////
    2215                 :            : 
    2216                 :          8 : SdXMLCaptionShapeContext::~SdXMLCaptionShapeContext()
    2217                 :            : {
    2218         [ -  + ]:         16 : }
    2219                 :            : 
    2220                 :            : //////////////////////////////////////////////////////////////////////////////
    2221                 :            : 
    2222                 :          8 : void SdXMLCaptionShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
    2223                 :            : {
    2224                 :            :     // create Caption shape
    2225                 :            :     // add, set style and properties from base shape
    2226                 :          8 :     AddShape("com.sun.star.drawing.CaptionShape");
    2227         [ +  - ]:          8 :     if( mxShape.is() )
    2228                 :            :     {
    2229         [ +  - ]:          8 :         SetStyle();
    2230         [ +  - ]:          8 :         SetLayer();
    2231                 :            : 
    2232         [ +  - ]:          8 :         uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
    2233                 :            : 
    2234                 :            :         // SJ: If AutoGrowWidthItem is set, SetTransformation will lead to the wrong SnapRect
    2235                 :            :         // because NbcAdjustTextFrameWidthAndHeight() is called (text is set later and center alignment
    2236                 :            :         // is the default setting, so the top left reference point that is used by the caption point is
    2237                 :            :         // no longer correct) There are two ways to solve this problem, temporarily disabling the
    2238                 :            :         // autogrowwith as we are doing here or to apply the CaptionPoint after setting text
    2239                 :          8 :         sal_Bool bIsAutoGrowWidth = sal_False;
    2240         [ +  - ]:          8 :         if ( xProps.is() )
    2241                 :            :         {
    2242 [ +  - ][ +  - ]:          8 :             uno::Any aAny( xProps->getPropertyValue( OUString("TextAutoGrowWidth" ) ) );
    2243                 :          8 :             aAny >>= bIsAutoGrowWidth;
    2244                 :            : 
    2245         [ -  + ]:          8 :             if ( bIsAutoGrowWidth )
    2246 [ #  # ][ #  # ]:          8 :                 xProps->setPropertyValue( OUString("TextAutoGrowWidth"), uno::makeAny( sal_False ) );
                 [ #  # ]
    2247                 :            :         }
    2248                 :            : 
    2249                 :            :         // set pos, size, shear and rotate
    2250         [ +  - ]:          8 :         SetTransformation();
    2251         [ +  - ]:          8 :         if( xProps.is() )
    2252 [ +  - ][ +  - ]:          8 :             xProps->setPropertyValue(OUString("CaptionPoint"), uno::makeAny( maCaptionPoint ) );
                 [ +  - ]
    2253                 :            : 
    2254         [ -  + ]:          8 :         if ( bIsAutoGrowWidth )
    2255 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( OUString("TextAutoGrowWidth"), uno::makeAny( sal_True ) );
                 [ #  # ]
    2256                 :            : 
    2257         [ -  + ]:          8 :         if(mnRadius)
    2258                 :            :         {
    2259         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
    2260         [ #  # ]:          0 :             if(xPropSet.is())
    2261                 :            :             {
    2262                 :            :                 try
    2263                 :            :                 {
    2264 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue(OUString("CornerRadius"), uno::makeAny( mnRadius ) );
         [ #  # ][ #  # ]
    2265                 :            :                 }
    2266         [ #  # ]:          0 :                 catch(const uno::Exception&)
    2267                 :            :                 {
    2268                 :            :                     OSL_FAIL( "exception during setting of corner radius!");
    2269                 :            :                 }
    2270                 :          0 :             }
    2271                 :            :         }
    2272                 :            : 
    2273         [ +  - ]:          8 :         SdXMLShapeContext::StartElement(xAttrList);
    2274                 :            :     }
    2275                 :          8 : }
    2276                 :            : 
    2277                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    2278                 :         29 : void SdXMLCaptionShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    2279                 :            : {
    2280         [ +  + ]:         29 :     if( XML_NAMESPACE_DRAW == nPrefix )
    2281                 :            :     {
    2282         [ +  + ]:         12 :         if( IsXMLToken( rLocalName, XML_CAPTION_POINT_X ) )
    2283                 :            :         {
    2284                 :          3 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    2285                 :          3 :                     maCaptionPoint.X, rValue);
    2286                 :          3 :             return;
    2287                 :            :         }
    2288         [ +  + ]:          9 :         if( IsXMLToken( rLocalName, XML_CAPTION_POINT_Y ) )
    2289                 :            :         {
    2290                 :          3 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    2291                 :          3 :                     maCaptionPoint.Y, rValue);
    2292                 :          3 :             return;
    2293                 :            :         }
    2294         [ -  + ]:          6 :         if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) )
    2295                 :            :         {
    2296                 :          0 :             GetImport().GetMM100UnitConverter().convertMeasureToCore(
    2297                 :          0 :                     mnRadius, rValue);
    2298                 :          0 :             return;
    2299                 :            :         }
    2300                 :            :     }
    2301                 :         29 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    2302                 :            : }
    2303                 :            : 
    2304                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2305                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2306                 :            : 
    2307 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLGraphicObjectShapeContext, SdXMLShapeContext );
    2308                 :            : 
    2309                 :          8 : SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext(
    2310                 :            :     SvXMLImport& rImport,
    2311                 :            :     sal_uInt16 nPrfx,
    2312                 :            :     const OUString& rLocalName,
    2313                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    2314                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    2315                 :            :     sal_Bool bTemporaryShape)
    2316                 :            : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    2317                 :          8 :     maURL()
    2318                 :            : {
    2319                 :          8 : }
    2320                 :            : 
    2321                 :            : //////////////////////////////////////////////////////////////////////////////
    2322                 :            : 
    2323                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    2324                 :        114 : void SdXMLGraphicObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    2325                 :            : {
    2326         [ +  + ]:        114 :     if( XML_NAMESPACE_XLINK == nPrefix )
    2327                 :            :     {
    2328         [ +  + ]:         32 :         if( IsXMLToken( rLocalName, XML_HREF ) )
    2329                 :            :         {
    2330                 :          8 :             maURL = rValue;
    2331                 :        114 :             return;
    2332                 :            :         }
    2333                 :            :     }
    2334                 :            : 
    2335                 :        106 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    2336                 :            : }
    2337                 :            : 
    2338                 :            : //////////////////////////////////////////////////////////////////////////////
    2339                 :            : 
    2340                 :          8 : void SdXMLGraphicObjectShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
    2341                 :            : {
    2342                 :            :     // create graphic object shape
    2343                 :            :     const char *pService;
    2344                 :            : 
    2345 [ +  - ][ +  + ]:          8 :     if( IsXMLToken( maPresentationClass, XML_GRAPHIC ) && GetImport().GetShapeImport()->IsPresentationShapesSupported() )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  + ]
           [ +  +  #  # ]
    2346                 :            :     {
    2347                 :          3 :         pService = "com.sun.star.presentation.GraphicObjectShape";
    2348                 :            :     }
    2349                 :            :     else
    2350                 :            :     {
    2351                 :          5 :         pService = "com.sun.star.drawing.GraphicObjectShape";
    2352                 :            :     }
    2353                 :            : 
    2354                 :          8 :     AddShape( pService );
    2355                 :            : 
    2356         [ +  - ]:          8 :     if(mxShape.is())
    2357                 :            :     {
    2358         [ +  - ]:          8 :         SetStyle();
    2359         [ +  - ]:          8 :         SetLayer();
    2360                 :            : 
    2361         [ +  - ]:          8 :         uno::Reference< beans::XPropertySet > xPropset(mxShape, uno::UNO_QUERY);
    2362         [ +  - ]:          8 :         if(xPropset.is())
    2363                 :            :         {
    2364                 :            :             // since OOo 1.x had no line or fill style for graphics, but may create
    2365                 :            :             // documents with them, we have to override them here
    2366                 :            :             sal_Int32 nUPD, nBuildId;
    2367 [ +  - ][ +  + ]:          8 :             if( GetImport().getBuildIds( nUPD, nBuildId ) && (nUPD == 645) ) try
         [ -  + ][ -  + ]
    2368                 :            :             {
    2369 [ #  # ][ #  # ]:          0 :                 xPropset->setPropertyValue( OUString("FillStyle"), Any( FillStyle_NONE ) );
                 [ #  # ]
    2370 [ #  # ][ #  # ]:          0 :                 xPropset->setPropertyValue( OUString("LineStyle"), Any( LineStyle_NONE ) );
         [ #  # ][ #  # ]
    2371                 :            :             }
    2372         [ #  # ]:          0 :             catch(const Exception&)
    2373                 :            :             {
    2374                 :            :             }
    2375                 :            : 
    2376 [ +  - ][ +  - ]:          8 :             uno::Reference< beans::XPropertySetInfo > xPropsInfo( xPropset->getPropertySetInfo() );
    2377 [ +  - ][ +  - ]:          8 :             if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString("IsEmptyPresentationObject" )))
         [ +  - ][ +  + ]
         [ +  - ][ +  - ]
           [ +  +  #  #  
                   #  # ]
    2378 [ +  - ][ +  - ]:          3 :                 xPropset->setPropertyValue( OUString("IsEmptyPresentationObject" ), ::cppu::bool2any( mbIsPlaceholder ) );
                 [ +  - ]
    2379                 :            : 
    2380         [ +  - ]:          8 :             if( !mbIsPlaceholder )
    2381                 :            :             {
    2382         [ +  - ]:          8 :                 if( !maURL.isEmpty() )
    2383                 :            :                 {
    2384                 :          8 :                     uno::Any aAny;
    2385 [ +  - ][ +  - ]:          8 :                     aAny <<= GetImport().ResolveGraphicObjectURL( maURL, GetImport().isGraphicLoadOnDemandSupported() );
                 [ +  - ]
    2386                 :            :                     try
    2387                 :            :                     {
    2388 [ +  - ][ +  - ]:          8 :                         xPropset->setPropertyValue( OUString("GraphicURL" ), aAny );
    2389 [ +  - ][ #  # ]:          8 :                         xPropset->setPropertyValue( OUString("GraphicStreamURL" ), aAny );
                 [ +  - ]
    2390                 :            :                     }
    2391         [ #  # ]:          0 :                     catch (const lang::IllegalArgumentException&)
    2392                 :            :                     {
    2393                 :          8 :                     }
    2394                 :            :                 }
    2395                 :          8 :             }
    2396                 :            :         }
    2397                 :            : 
    2398         [ +  + ]:          8 :         if(mbIsUserTransformed)
    2399                 :            :         {
    2400         [ +  - ]:          3 :             uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
    2401         [ +  - ]:          3 :             if(xProps.is())
    2402                 :            :             {
    2403 [ +  - ][ +  - ]:          3 :                 uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
    2404         [ +  - ]:          3 :                 if( xPropsInfo.is() )
    2405                 :            :                 {
    2406 [ +  - ][ +  - ]:          3 :                     if( xPropsInfo->hasPropertyByName(OUString("IsPlaceholderDependent" )))
                 [ +  - ]
    2407 [ +  - ][ +  - ]:          3 :                         xProps->setPropertyValue( OUString("IsPlaceholderDependent" ), ::cppu::bool2any( sal_False ) );
                 [ +  - ]
    2408                 :          3 :                 }
    2409                 :          3 :             }
    2410                 :            :         }
    2411                 :            : 
    2412                 :            :         // set pos, size, shear and rotate
    2413         [ +  - ]:          8 :         SetTransformation();
    2414                 :            : 
    2415         [ +  - ]:          8 :         SdXMLShapeContext::StartElement(mxAttrList);
    2416                 :            :     }
    2417                 :          8 : }
    2418                 :            : 
    2419                 :          8 : void SdXMLGraphicObjectShapeContext::EndElement()
    2420                 :            : {
    2421         [ -  + ]:          8 :     if( mxBase64Stream.is() )
    2422                 :            :     {
    2423         [ #  # ]:          0 :         OUString sURL( GetImport().ResolveGraphicObjectURLFromBase64( mxBase64Stream ) );
    2424         [ #  # ]:          0 :         if( !sURL.isEmpty() )
    2425                 :            :         {
    2426                 :            :             try
    2427                 :            :             {
    2428         [ #  # ]:          0 :                 uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
    2429         [ #  # ]:          0 :                 if(xProps.is())
    2430                 :            :                 {
    2431         [ #  # ]:          0 :                     const uno::Any aAny( uno::makeAny( sURL ) );
    2432 [ #  # ][ #  # ]:          0 :                     xProps->setPropertyValue( OUString("GraphicURL" ), aAny );
    2433 [ #  # ][ #  # ]:          0 :                     xProps->setPropertyValue( OUString("GraphicStreamURL" ), aAny );
    2434         [ #  # ]:          0 :                 }
    2435                 :            :             }
    2436         [ #  # ]:          0 :             catch (const lang::IllegalArgumentException&)
    2437                 :            :             {
    2438                 :            :             }
    2439                 :          0 :         }
    2440                 :            :     }
    2441                 :            : 
    2442                 :          8 :     SdXMLShapeContext::EndElement();
    2443                 :          8 : }
    2444                 :            : 
    2445                 :            : 
    2446                 :            : //////////////////////////////////////////////////////////////////////////////
    2447                 :            : 
    2448                 :          3 : SvXMLImportContext* SdXMLGraphicObjectShapeContext::CreateChildContext(
    2449                 :            :     sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
    2450                 :            :     const uno::Reference<xml::sax::XAttributeList>& xAttrList )
    2451                 :            : {
    2452                 :          3 :     SvXMLImportContext* pContext = NULL;
    2453                 :            : 
    2454   [ -  +  #  # ]:          3 :     if( (XML_NAMESPACE_OFFICE == nPrefix) &&
                 [ -  + ]
    2455                 :          0 :              xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_BINARY_DATA ) )
    2456                 :            :     {
    2457 [ #  # ][ #  # ]:          0 :         if( maURL.isEmpty() && !mxBase64Stream.is() )
                 [ #  # ]
    2458                 :            :         {
    2459         [ #  # ]:          0 :             mxBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
    2460         [ #  # ]:          0 :             if( mxBase64Stream.is() )
    2461                 :          0 :                 pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
    2462                 :            :                                                     rLocalName, xAttrList,
    2463         [ #  # ]:          0 :                                                     mxBase64Stream );
    2464                 :            :         }
    2465                 :            :     }
    2466                 :            : 
    2467                 :            :     // delegate to parent class if no context could be created
    2468         [ +  - ]:          3 :     if ( NULL == pContext )
    2469                 :            :         pContext = SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName,
    2470                 :          3 :                                                          xAttrList);
    2471                 :            : 
    2472                 :          3 :     return pContext;
    2473                 :            : }
    2474                 :            : 
    2475                 :            : //////////////////////////////////////////////////////////////////////////////
    2476                 :            : 
    2477                 :          8 : SdXMLGraphicObjectShapeContext::~SdXMLGraphicObjectShapeContext()
    2478                 :            : {
    2479                 :            : 
    2480         [ -  + ]:         16 : }
    2481                 :            : 
    2482                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2483                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2484                 :            : 
    2485 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLChartShapeContext, SdXMLShapeContext );
    2486                 :            : 
    2487                 :          0 : SdXMLChartShapeContext::SdXMLChartShapeContext(
    2488                 :            :     SvXMLImport& rImport,
    2489                 :            :     sal_uInt16 nPrfx,
    2490                 :            :     const OUString& rLocalName,
    2491                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    2492                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    2493                 :            :     sal_Bool bTemporaryShape)
    2494                 :            : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    2495                 :          0 :     mpChartContext( NULL )
    2496                 :            : {
    2497                 :          0 : }
    2498                 :            : 
    2499                 :            : //////////////////////////////////////////////////////////////////////////////
    2500                 :            : 
    2501                 :          0 : SdXMLChartShapeContext::~SdXMLChartShapeContext()
    2502                 :            : {
    2503         [ #  # ]:          0 :     if( mpChartContext )
    2504 [ #  # ][ #  # ]:          0 :         delete mpChartContext;
    2505         [ #  # ]:          0 : }
    2506                 :            : 
    2507                 :            : //////////////////////////////////////////////////////////////////////////////
    2508                 :            : 
    2509                 :          0 : void SdXMLChartShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
    2510                 :            : {
    2511                 :          0 :     const sal_Bool bIsPresentation = isPresentationShape();
    2512                 :            : 
    2513         [ #  # ]:          0 :     AddShape( bIsPresentation ? "com.sun.star.presentation.ChartShape" : "com.sun.star.drawing.OLE2Shape" );
    2514                 :            : 
    2515         [ #  # ]:          0 :     if(mxShape.is())
    2516                 :            :     {
    2517                 :          0 :         SetStyle();
    2518                 :          0 :         SetLayer();
    2519                 :            : 
    2520         [ #  # ]:          0 :         if( !mbIsPlaceholder )
    2521                 :            :         {
    2522         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
    2523         [ #  # ]:          0 :             if(xProps.is())
    2524                 :            :             {
    2525 [ #  # ][ #  # ]:          0 :                 uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
    2526 [ #  # ][ #  # ]:          0 :                 if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString("IsEmptyPresentationObject" )))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    2527 [ #  # ][ #  # ]:          0 :                     xProps->setPropertyValue( OUString("IsEmptyPresentationObject" ), ::cppu::bool2any( sal_False ) );
                 [ #  # ]
    2528                 :            : 
    2529                 :          0 :                 uno::Any aAny;
    2530                 :            : 
    2531                 :          0 :                 const OUString aCLSID( "12DCAE26-281F-416F-a234-c3086127382e");
    2532                 :            : 
    2533         [ #  # ]:          0 :                 aAny <<= aCLSID;
    2534 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue( OUString("CLSID" ), aAny );
    2535                 :            : 
    2536 [ #  # ][ #  # ]:          0 :                 aAny = xProps->getPropertyValue( OUString("Model" ) );
    2537                 :          0 :                 uno::Reference< frame::XModel > xChartModel;
    2538 [ #  # ][ #  # ]:          0 :                 if( aAny >>= xChartModel )
    2539                 :            :                 {
    2540 [ #  # ][ #  # ]:          0 :                     mpChartContext = GetImport().GetChartImport()->CreateChartContext( GetImport(), XML_NAMESPACE_SVG, GetXMLToken(XML_CHART), xChartModel, xAttrList );
         [ #  # ][ #  # ]
                 [ #  # ]
    2541                 :          0 :                 }
    2542                 :          0 :             }
    2543                 :            :         }
    2544                 :            : 
    2545         [ #  # ]:          0 :         if(mbIsUserTransformed)
    2546                 :            :         {
    2547         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
    2548         [ #  # ]:          0 :             if(xProps.is())
    2549                 :            :             {
    2550 [ #  # ][ #  # ]:          0 :                 uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
    2551         [ #  # ]:          0 :                 if( xPropsInfo.is() )
    2552                 :            :                 {
    2553 [ #  # ][ #  # ]:          0 :                     if( xPropsInfo->hasPropertyByName(OUString("IsPlaceholderDependent" )))
                 [ #  # ]
    2554 [ #  # ][ #  # ]:          0 :                         xProps->setPropertyValue( OUString("IsPlaceholderDependent" ), ::cppu::bool2any( sal_False ) );
                 [ #  # ]
    2555                 :          0 :                 }
    2556                 :          0 :             }
    2557                 :            :         }
    2558                 :            : 
    2559                 :            : 
    2560                 :            :         // set pos, size, shear and rotate
    2561                 :          0 :         SetTransformation();
    2562                 :            : 
    2563                 :          0 :         SdXMLShapeContext::StartElement(xAttrList);
    2564                 :            : 
    2565         [ #  # ]:          0 :         if( mpChartContext )
    2566                 :          0 :             mpChartContext->StartElement( xAttrList );
    2567                 :            :     }
    2568                 :          0 : }
    2569                 :            : 
    2570                 :          0 : void SdXMLChartShapeContext::EndElement()
    2571                 :            : {
    2572         [ #  # ]:          0 :     if( mpChartContext )
    2573                 :          0 :         mpChartContext->EndElement();
    2574                 :            : 
    2575                 :          0 :     SdXMLShapeContext::EndElement();
    2576                 :          0 : }
    2577                 :            : 
    2578                 :          0 : void SdXMLChartShapeContext::Characters( const ::rtl::OUString& rChars )
    2579                 :            : {
    2580         [ #  # ]:          0 :     if( mpChartContext )
    2581                 :          0 :         mpChartContext->Characters( rChars );
    2582                 :          0 : }
    2583                 :            : 
    2584                 :          0 : SvXMLImportContext * SdXMLChartShapeContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
    2585                 :            :         const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
    2586                 :            : {
    2587         [ #  # ]:          0 :     if( mpChartContext )
    2588                 :          0 :         return mpChartContext->CreateChildContext( nPrefix, rLocalName, xAttrList );
    2589                 :            : 
    2590                 :          0 :     return NULL;
    2591                 :            : }
    2592                 :            : 
    2593                 :            : //////////////////////////////////////////////////////////////////////////////
    2594                 :            : 
    2595 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLObjectShapeContext, SdXMLShapeContext );
    2596                 :            : 
    2597                 :          0 : SdXMLObjectShapeContext::SdXMLObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
    2598                 :            :         const rtl::OUString& rLocalName,
    2599                 :            :         const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    2600                 :            :         com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
    2601                 :            :         sal_Bool bTemporaryShape)
    2602                 :          0 : : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
    2603                 :            : {
    2604                 :          0 : }
    2605                 :            : 
    2606                 :          0 : SdXMLObjectShapeContext::~SdXMLObjectShapeContext()
    2607                 :            : {
    2608         [ #  # ]:          0 : }
    2609                 :            : 
    2610                 :          0 : void SdXMLObjectShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
    2611                 :            : {
    2612                 :            :     // #96717# in theorie, if we don't have a url we shouldn't even
    2613                 :            :     // export this ole shape. But practical its to risky right now
    2614                 :            :     // to change this so we better dispose this on load
    2615                 :            :     //if( !mbIsPlaceholder && ImpIsEmptyURL(maHref) )
    2616                 :            :     //  return;
    2617                 :            : 
    2618                 :            :     // #100592# this BugFix prevents that a shape is created. CL
    2619                 :            :     // is thinking about an alternative.
    2620                 :            :     // #i13140# Check for more than empty string in maHref, there are
    2621                 :            :     // other possibilities that maHref results in empty container
    2622                 :            :     // storage names
    2623 [ #  # ][ #  # ]:          0 :     if( !(GetImport().getImportFlags() & IMPORT_EMBEDDED) && !mbIsPlaceholder && ImpIsEmptyURL(maHref) )
         [ #  # ][ #  # ]
    2624                 :          0 :         return;
    2625                 :            : 
    2626                 :          0 :     const char* pService = "com.sun.star.drawing.OLE2Shape";
    2627                 :            : 
    2628 [ #  # ][ #  # ]:          0 :     sal_Bool bIsPresShape = !maPresentationClass.isEmpty() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2629                 :            : 
    2630         [ #  # ]:          0 :     if( bIsPresShape )
    2631                 :            :     {
    2632         [ #  # ]:          0 :         if( IsXMLToken( maPresentationClass, XML_PRESENTATION_CHART ) )
    2633                 :            :         {
    2634                 :          0 :             pService = "com.sun.star.presentation.ChartShape";
    2635                 :            :         }
    2636         [ #  # ]:          0 :         else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) )
    2637                 :            :         {
    2638                 :          0 :             pService = "com.sun.star.presentation.CalcShape";
    2639                 :            :         }
    2640         [ #  # ]:          0 :         else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
    2641                 :            :         {
    2642                 :          0 :             pService = "com.sun.star.presentation.OLE2Shape";
    2643                 :            :         }
    2644                 :            :     }
    2645                 :            : 
    2646                 :          0 :     AddShape( pService );
    2647                 :            : 
    2648         [ #  # ]:          0 :     if( mxShape.is() )
    2649                 :            :     {
    2650                 :          0 :         SetLayer();
    2651                 :            : 
    2652         [ #  # ]:          0 :         if(bIsPresShape)
    2653                 :            :         {
    2654         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
    2655         [ #  # ]:          0 :             if(xProps.is())
    2656                 :            :             {
    2657 [ #  # ][ #  # ]:          0 :                 uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
    2658         [ #  # ]:          0 :                 if( xPropsInfo.is() )
    2659                 :            :                 {
    2660 [ #  # ][ #  # ]:          0 :                     if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString("IsEmptyPresentationObject" )))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    2661 [ #  # ][ #  # ]:          0 :                         xProps->setPropertyValue( OUString("IsEmptyPresentationObject" ), ::cppu::bool2any( sal_False ) );
                 [ #  # ]
    2662                 :            : 
    2663 [ #  # ][ #  # ]:          0 :                     if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString("IsPlaceholderDependent" )))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    2664 [ #  # ][ #  # ]:          0 :                         xProps->setPropertyValue( OUString("IsPlaceholderDependent" ), ::cppu::bool2any( sal_False ) );
                 [ #  # ]
    2665                 :          0 :                 }
    2666                 :          0 :             }
    2667                 :            :         }
    2668                 :            : 
    2669 [ #  # ][ #  # ]:          0 :         if( !mbIsPlaceholder && !maHref.isEmpty() )
                 [ #  # ]
    2670                 :            :         {
    2671         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
    2672                 :            : 
    2673         [ #  # ]:          0 :             if( xProps.is() )
    2674                 :            :             {
    2675         [ #  # ]:          0 :                 OUString aPersistName = GetImport().ResolveEmbeddedObjectURL( maHref, maCLSID );
    2676                 :            : 
    2677 [ #  # ][ #  # ]:          0 :                 if ( GetImport().IsPackageURL( maHref ) )
    2678                 :            :                 {
    2679                 :          0 :                     const OUString  sURL( "vnd.sun.star.EmbeddedObject:" );
    2680                 :            : 
    2681         [ #  # ]:          0 :                     if ( aPersistName.compareTo( sURL, sURL.getLength() ) == 0 )
    2682                 :          0 :                         aPersistName = aPersistName.copy( sURL.getLength() );
    2683                 :            : 
    2684         [ #  # ]:          0 :                     xProps->setPropertyValue( OUString(  "PersistName"  ),
    2685 [ #  # ][ #  # ]:          0 :                                               uno::makeAny( aPersistName ) );
    2686                 :            :                 }
    2687                 :            :                 else
    2688                 :            :                 {
    2689                 :            :                     // this is OOo link object
    2690         [ #  # ]:          0 :                     xProps->setPropertyValue( OUString(  "LinkURL"  ),
    2691 [ #  # ][ #  # ]:          0 :                                               uno::makeAny( aPersistName ) );
    2692                 :          0 :                 }
    2693                 :          0 :             }
    2694                 :            :         }
    2695                 :            : 
    2696                 :            :         // set pos, size, shear and rotate
    2697                 :          0 :         SetTransformation();
    2698                 :            : 
    2699                 :          0 :         SetStyle();
    2700                 :            : 
    2701 [ #  # ][ #  # ]:          0 :         GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
    2702                 :            :     }
    2703                 :            : }
    2704                 :            : 
    2705                 :          0 : void SdXMLObjectShapeContext::EndElement()
    2706                 :            : {
    2707                 :            :     // #100592#
    2708         [ #  # ]:          0 :     if( mxBase64Stream.is() )
    2709                 :            :     {
    2710         [ #  # ]:          0 :         OUString aPersistName( GetImport().ResolveEmbeddedObjectURLFromBase64() );
    2711                 :          0 :         const OUString  sURL( "vnd.sun.star.EmbeddedObject:" );
    2712                 :            : 
    2713                 :          0 :         aPersistName = aPersistName.copy( sURL.getLength() );
    2714                 :            : 
    2715         [ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
    2716         [ #  # ]:          0 :         if( xProps.is() )
    2717 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( OUString(  "PersistName"  ), uno::makeAny( aPersistName ) );
                 [ #  # ]
    2718                 :            :     }
    2719                 :            : 
    2720                 :          0 :     SdXMLShapeContext::EndElement();
    2721                 :          0 : }
    2722                 :            : 
    2723                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    2724                 :          0 : void SdXMLObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    2725                 :            : {
    2726      [ #  #  # ]:          0 :     switch( nPrefix )
    2727                 :            :     {
    2728                 :            :     case XML_NAMESPACE_DRAW:
    2729         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_CLASS_ID ) )
    2730                 :            :         {
    2731                 :          0 :             maCLSID = rValue;
    2732                 :          0 :             return;
    2733                 :            :         }
    2734                 :          0 :         break;
    2735                 :            :     case XML_NAMESPACE_XLINK:
    2736         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_HREF ) )
    2737                 :            :         {
    2738                 :          0 :             maHref = rValue;
    2739                 :          0 :             return;
    2740                 :            :         }
    2741                 :          0 :         break;
    2742                 :            :     }
    2743                 :            : 
    2744                 :          0 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    2745                 :            : }
    2746                 :            : 
    2747                 :          0 : SvXMLImportContext* SdXMLObjectShapeContext::CreateChildContext(
    2748                 :            :     sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
    2749                 :            :     const uno::Reference<xml::sax::XAttributeList>& xAttrList )
    2750                 :            : {
    2751                 :            :     // #100592#
    2752                 :          0 :     SvXMLImportContext* pContext = NULL;
    2753                 :            : 
    2754 [ #  # ][ #  # ]:          0 :     if((XML_NAMESPACE_OFFICE == nPrefix) && IsXMLToken(rLocalName, XML_BINARY_DATA))
                 [ #  # ]
    2755                 :            :     {
    2756         [ #  # ]:          0 :         mxBase64Stream = GetImport().GetStreamForEmbeddedObjectURLFromBase64();
    2757         [ #  # ]:          0 :         if( mxBase64Stream.is() )
    2758                 :          0 :             pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
    2759                 :            :                                                 rLocalName, xAttrList,
    2760         [ #  # ]:          0 :                                                 mxBase64Stream );
    2761                 :            :     }
    2762 [ #  # ][ #  # ]:          0 :     else if( ((XML_NAMESPACE_OFFICE == nPrefix) && IsXMLToken(rLocalName, XML_DOCUMENT)) ||
           [ #  #  #  # ]
                 [ #  # ]
    2763                 :          0 :                 ((XML_NAMESPACE_MATH == nPrefix) && IsXMLToken(rLocalName, XML_MATH)) )
    2764                 :            :     {
    2765                 :            :         XMLEmbeddedObjectImportContext *pEContext =
    2766                 :          0 :             new XMLEmbeddedObjectImportContext( GetImport(), nPrefix,
    2767         [ #  # ]:          0 :                                                 rLocalName, xAttrList );
    2768                 :          0 :         maCLSID = pEContext->GetFilterCLSID();
    2769         [ #  # ]:          0 :         if( !maCLSID.isEmpty() )
    2770                 :            :         {
    2771         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
    2772         [ #  # ]:          0 :             if( xPropSet.is() )
    2773                 :            :             {
    2774 [ #  # ][ #  # ]:          0 :                 xPropSet->setPropertyValue( OUString("CLSID" ), uno::makeAny( maCLSID ) );
                 [ #  # ]
    2775                 :            : 
    2776                 :          0 :                 uno::Reference< lang::XComponent > xComp;
    2777 [ #  # ][ #  # ]:          0 :                 xPropSet->getPropertyValue( OUString("Model" ) ) >>= xComp;
                 [ #  # ]
    2778                 :            :                 DBG_ASSERT( xComp.is(), "no xModel for own OLE format" );
    2779         [ #  # ]:          0 :                 pEContext->SetComponent( xComp );
    2780                 :          0 :             }
    2781                 :            :         }
    2782                 :          0 :         pContext = pEContext;
    2783                 :            :     }
    2784                 :            : 
    2785                 :            :     // delegate to parent class if no context could be created
    2786         [ #  # ]:          0 :     if(!pContext)
    2787                 :          0 :         pContext = SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
    2788                 :            : 
    2789                 :          0 :     return pContext;
    2790                 :            : }
    2791                 :            : 
    2792                 :            : //////////////////////////////////////////////////////////////////////////////
    2793                 :            : 
    2794 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLAppletShapeContext, SdXMLShapeContext );
    2795                 :            : 
    2796                 :          0 : SdXMLAppletShapeContext::SdXMLAppletShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
    2797                 :            :         const rtl::OUString& rLocalName,
    2798                 :            :         const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    2799                 :            :         com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
    2800                 :            :         sal_Bool bTemporaryShape)
    2801                 :            : : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    2802         [ #  # ]:          0 :   mbIsScript( sal_False )
    2803                 :            : {
    2804                 :          0 : }
    2805                 :            : 
    2806         [ #  # ]:          0 : SdXMLAppletShapeContext::~SdXMLAppletShapeContext()
    2807                 :            : {
    2808         [ #  # ]:          0 : }
    2809                 :            : 
    2810                 :          0 : void SdXMLAppletShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
    2811                 :            : {
    2812                 :          0 :     const char* pService = "com.sun.star.drawing.AppletShape";
    2813                 :          0 :     AddShape( pService );
    2814                 :            : 
    2815         [ #  # ]:          0 :     if( mxShape.is() )
    2816                 :            :     {
    2817                 :          0 :         SetLayer();
    2818                 :            : 
    2819                 :            :         // set pos, size, shear and rotate
    2820                 :          0 :         SetTransformation();
    2821 [ #  # ][ #  # ]:          0 :         GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
    2822                 :            :     }
    2823                 :          0 : }
    2824                 :            : 
    2825                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    2826                 :          0 : void SdXMLAppletShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    2827                 :            : {
    2828      [ #  #  # ]:          0 :     switch( nPrefix )
    2829                 :            :     {
    2830                 :            :     case XML_NAMESPACE_DRAW:
    2831         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_APPLET_NAME ) )
    2832                 :            :         {
    2833                 :          0 :             maAppletName = rValue;
    2834                 :          0 :             return;
    2835                 :            :         }
    2836         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_CODE ) )
    2837                 :            :         {
    2838                 :          0 :             maAppletCode = rValue;
    2839                 :          0 :             return;
    2840                 :            :         }
    2841         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_MAY_SCRIPT ) )
    2842                 :            :         {
    2843                 :          0 :             mbIsScript = IsXMLToken( rValue, XML_TRUE );
    2844                 :          0 :             return;
    2845                 :            :         }
    2846                 :          0 :         break;
    2847                 :            :     case XML_NAMESPACE_XLINK:
    2848         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_HREF ) )
    2849                 :            :         {
    2850                 :          0 :             maHref = GetImport().GetAbsoluteReference(rValue);
    2851                 :          0 :             return;
    2852                 :            :         }
    2853                 :          0 :         break;
    2854                 :            :     }
    2855                 :            : 
    2856                 :          0 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    2857                 :            : }
    2858                 :            : 
    2859                 :          0 : void SdXMLAppletShapeContext::EndElement()
    2860                 :            : {
    2861         [ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
    2862         [ #  # ]:          0 :     if( xProps.is() )
    2863                 :            :     {
    2864                 :          0 :         uno::Any aAny;
    2865                 :            : 
    2866 [ #  # ][ #  # ]:          0 :         if ( maSize.Width && maSize.Height )
    2867                 :            :         {
    2868                 :            :             // the visual area for applet must be set on loading
    2869                 :          0 :             awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
    2870         [ #  # ]:          0 :             aAny <<= aRect;
    2871 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( OUString(  "VisibleArea"  ), aAny );
    2872                 :            :         }
    2873                 :            : 
    2874         [ #  # ]:          0 :         if( maParams.getLength() )
    2875                 :            :         {
    2876         [ #  # ]:          0 :             aAny <<= maParams;
    2877 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( OUString(  "AppletCommands"  ), aAny );
    2878                 :            :         }
    2879                 :            : 
    2880         [ #  # ]:          0 :         if( !maHref.isEmpty() )
    2881                 :            :         {
    2882         [ #  # ]:          0 :             aAny <<= maHref;
    2883 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( OUString(  "AppletCodeBase"  ), aAny );
    2884                 :            :         }
    2885                 :            : 
    2886         [ #  # ]:          0 :         if( !maAppletName.isEmpty() )
    2887                 :            :         {
    2888         [ #  # ]:          0 :             aAny <<= maAppletName;
    2889 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( OUString(  "AppletName"  ), aAny );
    2890                 :            :         }
    2891                 :            : 
    2892         [ #  # ]:          0 :         if( mbIsScript )
    2893                 :            :         {
    2894         [ #  # ]:          0 :             aAny <<= mbIsScript;
    2895 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( OUString(  "AppletIsScript"  ), aAny );
    2896                 :            : 
    2897                 :            :         }
    2898                 :            : 
    2899         [ #  # ]:          0 :         if( !maAppletCode.isEmpty() )
    2900                 :            :         {
    2901         [ #  # ]:          0 :             aAny <<= maAppletCode;
    2902 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( OUString(  "AppletCode"  ), aAny );
    2903                 :            :         }
    2904                 :            : 
    2905 [ #  # ][ #  # ]:          0 :         aAny <<= ::rtl::OUString( GetImport().GetDocumentBase() );
    2906 [ #  # ][ #  # ]:          0 :         xProps->setPropertyValue( OUString(  "AppletDocBase"  ), aAny );
    2907                 :            : 
    2908         [ #  # ]:          0 :         SetThumbnail();
    2909                 :            :     }
    2910                 :            : 
    2911         [ #  # ]:          0 :     SdXMLShapeContext::EndElement();
    2912                 :          0 : }
    2913                 :            : 
    2914                 :          0 : SvXMLImportContext * SdXMLAppletShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
    2915                 :            : {
    2916 [ #  # ][ #  # ]:          0 :     if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_PARAM ) )
                 [ #  # ]
    2917                 :            :     {
    2918                 :          0 :         OUString aParamName, aParamValue;
    2919 [ #  # ][ #  # ]:          0 :         const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ #  # ]
    2920                 :            :         // now parse the attribute list and look for draw:name and draw:value
    2921         [ #  # ]:          0 :         for(sal_Int16 a(0); a < nAttrCount; a++)
    2922                 :            :         {
    2923 [ #  # ][ #  # ]:          0 :             const OUString& rAttrName = xAttrList->getNameByIndex(a);
    2924                 :          0 :             OUString aLocalName;
    2925         [ #  # ]:          0 :             sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
    2926 [ #  # ][ #  # ]:          0 :             const OUString aValue( xAttrList->getValueByIndex(a) );
    2927                 :            : 
    2928         [ #  # ]:          0 :             if( nPrefix == XML_NAMESPACE_DRAW )
    2929                 :            :             {
    2930 [ #  # ][ #  # ]:          0 :                 if( IsXMLToken( aLocalName, XML_NAME ) )
    2931                 :            :                 {
    2932                 :          0 :                     aParamName = aValue;
    2933                 :            :                 }
    2934 [ #  # ][ #  # ]:          0 :                 else if( IsXMLToken( aLocalName, XML_VALUE ) )
    2935                 :            :                 {
    2936                 :          0 :                     aParamValue = aValue;
    2937                 :            :                 }
    2938                 :            :             }
    2939                 :          0 :         }
    2940                 :            : 
    2941         [ #  # ]:          0 :         if( !aParamName.isEmpty() )
    2942                 :            :         {
    2943                 :          0 :             sal_Int32 nIndex = maParams.getLength();
    2944         [ #  # ]:          0 :             maParams.realloc( nIndex + 1 );
    2945         [ #  # ]:          0 :             maParams[nIndex].Name = aParamName;
    2946         [ #  # ]:          0 :             maParams[nIndex].Handle = -1;
    2947 [ #  # ][ #  # ]:          0 :             maParams[nIndex].Value <<= aParamValue;
    2948         [ #  # ]:          0 :             maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
    2949                 :            :         }
    2950                 :            : 
    2951 [ #  # ][ #  # ]:          0 :         return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
    2952                 :            :     }
    2953                 :            : 
    2954                 :          0 :     return SdXMLShapeContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
    2955                 :            : }
    2956                 :            : 
    2957                 :            : //////////////////////////////////////////////////////////////////////////////
    2958                 :            : 
    2959 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLPluginShapeContext, SdXMLShapeContext );
    2960                 :            : 
    2961                 :          0 : SdXMLPluginShapeContext::SdXMLPluginShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
    2962                 :            :         const rtl::OUString& rLocalName,
    2963                 :            :         const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    2964                 :            :         com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
    2965                 :            :         sal_Bool bTemporaryShape) :
    2966                 :            : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    2967         [ #  # ]:          0 : mbMedia( false )
    2968                 :            : {
    2969                 :          0 : }
    2970                 :            : 
    2971         [ #  # ]:          0 : SdXMLPluginShapeContext::~SdXMLPluginShapeContext()
    2972                 :            : {
    2973         [ #  # ]:          0 : }
    2974                 :            : 
    2975                 :          0 : void SdXMLPluginShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList)
    2976                 :            : {
    2977                 :            :     // watch for MimeType attribute to see if we have a media object
    2978 [ #  # ][ #  # ]:          0 :     for( sal_Int16 n = 0, nAttrCount = ( xAttrList.is() ? xAttrList->getLength() : 0 ); n < nAttrCount; ++n )
    2979                 :            :     {
    2980                 :          0 :         OUString    aLocalName;
    2981 [ #  # ][ #  # ]:          0 :         sal_uInt16  nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( n ), &aLocalName );
                 [ #  # ]
    2982                 :            : 
    2983 [ #  # ][ #  # ]:          0 :         if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( aLocalName, XML_MIME_TYPE ) )
         [ #  # ][ #  # ]
    2984                 :            :         {
    2985 [ #  # ][ #  # ]:          0 :             if( 0 == xAttrList->getValueByIndex( n ).compareToAscii( "application/vnd.sun.star.media" ) )
                 [ #  # ]
    2986                 :          0 :                 mbMedia = true;
    2987                 :            : 
    2988                 :            :             // leave this loop
    2989                 :          0 :             n = nAttrCount - 1;
    2990                 :            :         }
    2991                 :          0 :     }
    2992                 :            : 
    2993                 :            :     const char* pService;
    2994                 :            : 
    2995                 :          0 :     sal_Bool bIsPresShape = sal_False;
    2996                 :            : 
    2997         [ #  # ]:          0 :     if( mbMedia )
    2998                 :            :     {
    2999                 :          0 :         pService = "com.sun.star.drawing.MediaShape";
    3000                 :            : 
    3001 [ #  # ][ #  # ]:          0 :         bIsPresShape = !maPresentationClass.isEmpty() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    3002         [ #  # ]:          0 :         if( bIsPresShape )
    3003                 :            :         {
    3004         [ #  # ]:          0 :             if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
    3005                 :            :             {
    3006                 :          0 :                 pService = "com.sun.star.presentation.MediaShape";
    3007                 :            :             }
    3008                 :            :         }
    3009                 :            :     }
    3010                 :            :     else
    3011                 :          0 :         pService = "com.sun.star.drawing.PluginShape";
    3012                 :            : 
    3013                 :          0 :     AddShape( pService );
    3014                 :            : 
    3015         [ #  # ]:          0 :     if( mxShape.is() )
    3016                 :            :     {
    3017                 :          0 :         SetLayer();
    3018                 :            : 
    3019         [ #  # ]:          0 :         if(bIsPresShape)
    3020                 :            :         {
    3021         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
    3022         [ #  # ]:          0 :             if(xProps.is())
    3023                 :            :             {
    3024 [ #  # ][ #  # ]:          0 :                 uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
    3025         [ #  # ]:          0 :                 if( xPropsInfo.is() )
    3026                 :            :                 {
    3027 [ #  # ][ #  # ]:          0 :                     if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString("IsEmptyPresentationObject" )))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    3028 [ #  # ][ #  # ]:          0 :                         xProps->setPropertyValue( OUString("IsEmptyPresentationObject" ), ::cppu::bool2any( sal_False ) );
                 [ #  # ]
    3029                 :            : 
    3030 [ #  # ][ #  # ]:          0 :                     if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString("IsPlaceholderDependent" )))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    3031 [ #  # ][ #  # ]:          0 :                         xProps->setPropertyValue( OUString("IsPlaceholderDependent" ), ::cppu::bool2any( sal_False ) );
                 [ #  # ]
    3032                 :          0 :                 }
    3033                 :          0 :             }
    3034                 :            :         }
    3035                 :            : 
    3036                 :            :         // set pos, size, shear and rotate
    3037                 :          0 :         SetTransformation();
    3038 [ #  # ][ #  # ]:          0 :         GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
    3039                 :            :     }
    3040                 :          0 : }
    3041                 :            : 
    3042                 :            : static ::rtl::OUString
    3043                 :          0 : lcl_GetMediaReference(SvXMLImport const& rImport, ::rtl::OUString const& rURL)
    3044                 :            : {
    3045         [ #  # ]:          0 :     if (rImport.IsPackageURL(rURL))
    3046                 :            :     {
    3047                 :          0 :         return ::rtl::OUString( "vnd.sun.star.Package:") + rURL;
    3048                 :            :     }
    3049                 :            :     else
    3050                 :            :     {
    3051                 :          0 :         return rImport.GetAbsoluteReference(rURL);
    3052                 :            :     }
    3053                 :            : }
    3054                 :            : 
    3055                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    3056                 :          0 : void SdXMLPluginShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    3057                 :            : {
    3058      [ #  #  # ]:          0 :     switch( nPrefix )
    3059                 :            :     {
    3060                 :            :     case XML_NAMESPACE_DRAW:
    3061         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_MIME_TYPE ) )
    3062                 :            :         {
    3063                 :          0 :             maMimeType = rValue;
    3064                 :          0 :             return;
    3065                 :            :         }
    3066                 :          0 :         break;
    3067                 :            :     case XML_NAMESPACE_XLINK:
    3068         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_HREF ) )
    3069                 :            :         {
    3070                 :          0 :             maHref = lcl_GetMediaReference(GetImport(), rValue);
    3071                 :          0 :             return;
    3072                 :            :         }
    3073                 :          0 :         break;
    3074                 :            :     }
    3075                 :            : 
    3076                 :          0 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    3077                 :            : }
    3078                 :            : 
    3079                 :          0 : void SdXMLPluginShapeContext::EndElement()
    3080                 :            : {
    3081         [ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
    3082                 :            : 
    3083         [ #  # ]:          0 :     if( xProps.is() )
    3084                 :            :     {
    3085                 :          0 :         uno::Any aAny;
    3086                 :            : 
    3087 [ #  # ][ #  # ]:          0 :         if ( maSize.Width && maSize.Height )
    3088                 :            :         {
    3089                 :          0 :             const rtl::OUString sVisibleArea(  "VisibleArea"  );
    3090 [ #  # ][ #  # ]:          0 :             uno::Reference< beans::XPropertySetInfo > aXPropSetInfo( xProps->getPropertySetInfo() );
    3091 [ #  # ][ #  # ]:          0 :             if ( !aXPropSetInfo.is() || aXPropSetInfo->hasPropertyByName( sVisibleArea ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    3092                 :            :             {
    3093                 :            :                 // the visual area for a plugin must be set on loading
    3094                 :          0 :                 awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
    3095         [ #  # ]:          0 :                 aAny <<= aRect;
    3096 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue( sVisibleArea, aAny );
    3097                 :          0 :             }
    3098                 :            :         }
    3099                 :            : 
    3100         [ #  # ]:          0 :         if( !mbMedia )
    3101                 :            :         {
    3102                 :            :             // in case we have a plugin object
    3103         [ #  # ]:          0 :             if( maParams.getLength() )
    3104                 :            :             {
    3105         [ #  # ]:          0 :                 aAny <<= maParams;
    3106 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue( OUString(  "PluginCommands"  ), aAny );
    3107                 :            :             }
    3108                 :            : 
    3109         [ #  # ]:          0 :             if( !maMimeType.isEmpty() )
    3110                 :            :             {
    3111         [ #  # ]:          0 :                 aAny <<= maMimeType;
    3112 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue( OUString(  "PluginMimeType"  ), aAny );
    3113                 :            :             }
    3114                 :            : 
    3115         [ #  # ]:          0 :             if( !maHref.isEmpty() )
    3116                 :            :             {
    3117         [ #  # ]:          0 :                 aAny <<= maHref;
    3118 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue( OUString(  "PluginURL"  ), aAny );
    3119                 :            :             }
    3120                 :            :         }
    3121                 :            :         else
    3122                 :            :         {
    3123                 :            :             // in case we have a media object
    3124         [ #  # ]:          0 :             xProps->setPropertyValue(
    3125                 :            :                     OUString("MediaURL"),
    3126 [ #  # ][ #  # ]:          0 :                     uno::makeAny(maHref));
    3127                 :            : 
    3128         [ #  # ]:          0 :             for( sal_Int32 nParam = 0; nParam < maParams.getLength(); ++nParam )
    3129                 :            :             {
    3130         [ #  # ]:          0 :                 const OUString& rName = maParams[ nParam ].Name;
    3131                 :            : 
    3132         [ #  # ]:          0 :                 if( 0 == rName.compareToAscii( "Loop" ) )
    3133                 :            :                 {
    3134                 :          0 :                     OUString aValueStr;
    3135         [ #  # ]:          0 :                     maParams[ nParam ].Value >>= aValueStr;
    3136         [ #  # ]:          0 :                     xProps->setPropertyValue( OUString(  "Loop"  ),
    3137 [ #  # ][ #  # ]:          0 :                         uno::makeAny( static_cast< sal_Bool >( 0 == aValueStr.compareToAscii( "true" ) ) ) );
    3138                 :            :                 }
    3139         [ #  # ]:          0 :                 else if( 0 == rName.compareToAscii( "Mute" ) )
    3140                 :            :                 {
    3141                 :          0 :                     OUString aValueStr;
    3142         [ #  # ]:          0 :                     maParams[ nParam ].Value >>= aValueStr;
    3143         [ #  # ]:          0 :                     xProps->setPropertyValue( OUString(  "Mute"  ),
    3144 [ #  # ][ #  # ]:          0 :                         uno::makeAny( static_cast< sal_Bool >( 0 == aValueStr.compareToAscii( "true" ) ) ) );
    3145                 :            :                 }
    3146         [ #  # ]:          0 :                 else if( 0 == rName.compareToAscii( "VolumeDB" ) )
    3147                 :            :                 {
    3148                 :          0 :                     OUString aValueStr;
    3149         [ #  # ]:          0 :                     maParams[ nParam ].Value >>= aValueStr;
    3150         [ #  # ]:          0 :                     xProps->setPropertyValue( OUString(  "VolumeDB"  ),
    3151 [ #  # ][ #  # ]:          0 :                                                 uno::makeAny( static_cast< sal_Int16 >( aValueStr.toInt32() ) ) );
    3152                 :            :                 }
    3153         [ #  # ]:          0 :                 else if( 0 == rName.compareToAscii( "Zoom" ) )
    3154                 :            :                 {
    3155                 :          0 :                     OUString            aZoomStr;
    3156                 :            :                     media::ZoomLevel    eZoomLevel;
    3157                 :            : 
    3158         [ #  # ]:          0 :                     maParams[ nParam ].Value >>= aZoomStr;
    3159                 :            : 
    3160         [ #  # ]:          0 :                     if( 0 == aZoomStr.compareToAscii( "25%" ) )
    3161                 :          0 :                         eZoomLevel = media::ZoomLevel_ZOOM_1_TO_4;
    3162         [ #  # ]:          0 :                     else if( 0 == aZoomStr.compareToAscii( "50%" ) )
    3163                 :          0 :                         eZoomLevel = media::ZoomLevel_ZOOM_1_TO_2;
    3164         [ #  # ]:          0 :                     else if( 0 == aZoomStr.compareToAscii( "100%" ) )
    3165                 :          0 :                         eZoomLevel = media::ZoomLevel_ORIGINAL;
    3166         [ #  # ]:          0 :                     else if( 0 == aZoomStr.compareToAscii( "200%" ) )
    3167                 :          0 :                         eZoomLevel = media::ZoomLevel_ZOOM_2_TO_1;
    3168         [ #  # ]:          0 :                     else if( 0 == aZoomStr.compareToAscii( "400%" ) )
    3169                 :          0 :                         eZoomLevel = media::ZoomLevel_ZOOM_4_TO_1;
    3170         [ #  # ]:          0 :                     else if( 0 == aZoomStr.compareToAscii( "fit" ) )
    3171                 :          0 :                         eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW;
    3172         [ #  # ]:          0 :                     else if( 0 == aZoomStr.compareToAscii( "fixedfit" ) )
    3173                 :          0 :                         eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT;
    3174         [ #  # ]:          0 :                     else if( 0 == aZoomStr.compareToAscii( "fullscreen" ) )
    3175                 :          0 :                         eZoomLevel = media::ZoomLevel_FULLSCREEN;
    3176                 :            :                     else
    3177                 :          0 :                         eZoomLevel = media::ZoomLevel_NOT_AVAILABLE;
    3178                 :            : 
    3179 [ #  # ][ #  # ]:          0 :                     xProps->setPropertyValue( OUString(  "Zoom"  ), uno::makeAny( eZoomLevel ) );
                 [ #  # ]
    3180                 :            :                 }
    3181                 :            :             }
    3182                 :            :         }
    3183                 :            : 
    3184         [ #  # ]:          0 :         SetThumbnail();
    3185                 :            :     }
    3186                 :            : 
    3187         [ #  # ]:          0 :     SdXMLShapeContext::EndElement();
    3188                 :          0 : }
    3189                 :            : 
    3190                 :          0 : SvXMLImportContext * SdXMLPluginShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
    3191                 :            : {
    3192 [ #  # ][ #  # ]:          0 :     if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_PARAM ) )
                 [ #  # ]
    3193                 :            :     {
    3194                 :          0 :         OUString aParamName, aParamValue;
    3195 [ #  # ][ #  # ]:          0 :         const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ #  # ]
    3196                 :            :         // now parse the attribute list and look for draw:name and draw:value
    3197         [ #  # ]:          0 :         for(sal_Int16 a(0); a < nAttrCount; a++)
    3198                 :            :         {
    3199 [ #  # ][ #  # ]:          0 :             const OUString& rAttrName = xAttrList->getNameByIndex(a);
    3200                 :          0 :             OUString aLocalName;
    3201         [ #  # ]:          0 :             sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
    3202 [ #  # ][ #  # ]:          0 :             const OUString aValue( xAttrList->getValueByIndex(a) );
    3203                 :            : 
    3204         [ #  # ]:          0 :             if( nPrefix == XML_NAMESPACE_DRAW )
    3205                 :            :             {
    3206 [ #  # ][ #  # ]:          0 :                 if( IsXMLToken( aLocalName, XML_NAME ) )
    3207                 :            :                 {
    3208                 :          0 :                     aParamName = aValue;
    3209                 :            :                 }
    3210 [ #  # ][ #  # ]:          0 :                 else if( IsXMLToken( aLocalName, XML_VALUE ) )
    3211                 :            :                 {
    3212                 :          0 :                     aParamValue = aValue;
    3213                 :            :                 }
    3214                 :            :             }
    3215                 :            : 
    3216         [ #  # ]:          0 :             if( !aParamName.isEmpty() )
    3217                 :            :             {
    3218                 :          0 :                 sal_Int32 nIndex = maParams.getLength();
    3219         [ #  # ]:          0 :                 maParams.realloc( nIndex + 1 );
    3220         [ #  # ]:          0 :                 maParams[nIndex].Name = aParamName;
    3221         [ #  # ]:          0 :                 maParams[nIndex].Handle = -1;
    3222 [ #  # ][ #  # ]:          0 :                 maParams[nIndex].Value <<= aParamValue;
    3223         [ #  # ]:          0 :                 maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE;
    3224                 :            :             }
    3225                 :          0 :         }
    3226                 :            : 
    3227 [ #  # ][ #  # ]:          0 :         return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
    3228                 :            :     }
    3229                 :            : 
    3230                 :          0 :     return SdXMLShapeContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList );
    3231                 :            : }
    3232                 :            : 
    3233                 :            : //////////////////////////////////////////////////////////////////////////////
    3234                 :            : 
    3235 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLFloatingFrameShapeContext, SdXMLShapeContext );
    3236                 :            : 
    3237                 :          0 : SdXMLFloatingFrameShapeContext::SdXMLFloatingFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
    3238                 :            :         const rtl::OUString& rLocalName,
    3239                 :            :         const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    3240                 :            :         com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
    3241                 :            :         sal_Bool bTemporaryShape)
    3242                 :          0 : : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
    3243                 :            : {
    3244                 :          0 : }
    3245                 :            : 
    3246                 :          0 : SdXMLFloatingFrameShapeContext::~SdXMLFloatingFrameShapeContext()
    3247                 :            : {
    3248         [ #  # ]:          0 : }
    3249                 :            : 
    3250                 :          0 : void SdXMLFloatingFrameShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& )
    3251                 :            : {
    3252                 :          0 :     const char* pService = "com.sun.star.drawing.FrameShape";
    3253                 :          0 :     AddShape( pService );
    3254                 :            : 
    3255         [ #  # ]:          0 :     if( mxShape.is() )
    3256                 :            :     {
    3257         [ #  # ]:          0 :         SetLayer();
    3258                 :            : 
    3259                 :            :         // set pos, size, shear and rotate
    3260         [ #  # ]:          0 :         SetTransformation();
    3261                 :            : 
    3262         [ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
    3263         [ #  # ]:          0 :         if( xProps.is() )
    3264                 :            :         {
    3265                 :          0 :             uno::Any aAny;
    3266                 :            : 
    3267         [ #  # ]:          0 :             if( !maFrameName.isEmpty() )
    3268                 :            :             {
    3269         [ #  # ]:          0 :                 aAny <<= maFrameName;
    3270 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue( OUString(  "FrameName"  ), aAny );
    3271                 :            :             }
    3272                 :            : 
    3273         [ #  # ]:          0 :             if( !maHref.isEmpty() )
    3274                 :            :             {
    3275         [ #  # ]:          0 :                 aAny <<= maHref;
    3276 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue( OUString(  "FrameURL"  ), aAny );
    3277                 :          0 :             }
    3278                 :            :         }
    3279                 :            : 
    3280         [ #  # ]:          0 :         SetStyle();
    3281                 :            : 
    3282 [ #  # ][ #  # ]:          0 :         GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
         [ #  # ][ #  # ]
    3283                 :            :     }
    3284                 :          0 : }
    3285                 :            : 
    3286                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    3287                 :          0 : void SdXMLFloatingFrameShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    3288                 :            : {
    3289      [ #  #  # ]:          0 :     switch( nPrefix )
    3290                 :            :     {
    3291                 :            :     case XML_NAMESPACE_DRAW:
    3292         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_FRAME_NAME ) )
    3293                 :            :         {
    3294                 :          0 :             maFrameName = rValue;
    3295                 :          0 :             return;
    3296                 :            :         }
    3297                 :          0 :         break;
    3298                 :            :     case XML_NAMESPACE_XLINK:
    3299         [ #  # ]:          0 :         if( IsXMLToken( rLocalName, XML_HREF ) )
    3300                 :            :         {
    3301                 :          0 :             maHref = GetImport().GetAbsoluteReference(rValue);
    3302                 :          0 :             return;
    3303                 :            :         }
    3304                 :          0 :         break;
    3305                 :            :     }
    3306                 :            : 
    3307                 :          0 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    3308                 :            : }
    3309                 :            : 
    3310                 :          0 : void SdXMLFloatingFrameShapeContext::EndElement()
    3311                 :            : {
    3312         [ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
    3313                 :            : 
    3314         [ #  # ]:          0 :     if( xProps.is() )
    3315                 :            :     {
    3316 [ #  # ][ #  # ]:          0 :         if ( maSize.Width && maSize.Height )
    3317                 :            :         {
    3318                 :            :             // the visual area for a floating frame must be set on loading
    3319                 :          0 :             awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height );
    3320                 :          0 :             uno::Any aAny;
    3321         [ #  # ]:          0 :             aAny <<= aRect;
    3322 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( OUString(  "VisibleArea"  ), aAny );
    3323                 :            :         }
    3324                 :            :     }
    3325                 :            : 
    3326         [ #  # ]:          0 :     SetThumbnail();
    3327         [ #  # ]:          0 :     SdXMLShapeContext::EndElement();
    3328                 :          0 : }
    3329                 :            : 
    3330                 :            : //////////////////////////////////////////////////////////////////////////////
    3331                 :            : 
    3332 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLFrameShapeContext, SdXMLShapeContext );
    3333                 :            : 
    3334                 :        126 : SdXMLFrameShapeContext::SdXMLFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
    3335                 :            :         const rtl::OUString& rLocalName,
    3336                 :            :         const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    3337                 :            :         com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
    3338                 :            :         sal_Bool bTemporaryShape)
    3339                 :            : : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
    3340                 :        126 :     mbSupportsReplacement( sal_False )
    3341                 :            : {
    3342         [ +  - ]:        126 :     uno::Reference < util::XCloneable > xClone( xAttrList, uno::UNO_QUERY );
    3343         [ +  - ]:        126 :     if( xClone.is() )
    3344 [ +  - ][ +  - ]:        126 :         mxAttrList.set( xClone->createClone(), uno::UNO_QUERY );
                 [ +  - ]
    3345                 :            :     else
    3346 [ #  # ][ #  # ]:        126 :         mxAttrList = new SvXMLAttributeList( xAttrList );
                 [ #  # ]
    3347                 :            : 
    3348                 :        126 : }
    3349                 :            : 
    3350 [ +  - ][ +  - ]:        126 : SdXMLFrameShapeContext::~SdXMLFrameShapeContext()
    3351                 :            : {
    3352         [ -  + ]:        252 : }
    3353                 :            : 
    3354                 :        132 : SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPrefix,
    3355                 :            :     const OUString& rLocalName,
    3356                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList )
    3357                 :            : {
    3358                 :        132 :     SvXMLImportContext * pContext = 0;
    3359                 :            : 
    3360         [ +  + ]:        132 :     if( !mxImplContext.Is() )
    3361                 :            :     {
    3362                 :            : 
    3363                 :        126 :         SvXMLShapeContext* pShapeContext= GetImport().GetShapeImport()->CreateFrameChildContext(
    3364 [ +  - ][ +  - ]:        252 :                         GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList );
    3365                 :            : 
    3366                 :        126 :         pContext = pShapeContext;
    3367                 :            : 
    3368                 :            :         // propagate the hyperlink to child context
    3369         [ -  + ]:        126 :         if ( !msHyperlink.isEmpty() )
    3370                 :          0 :             pShapeContext->setHyperlink( msHyperlink );
    3371                 :            : 
    3372                 :        126 :         mxImplContext = pContext;
    3373                 :        126 :         mbSupportsReplacement = IsXMLToken( rLocalName, XML_OBJECT ) ||
    3374 [ -  + ][ +  - ]:        126 :                                 IsXMLToken( rLocalName, XML_OBJECT_OLE );
    3375                 :            :     }
    3376 [ -  + ][ #  # ]:          6 :     else if( mbSupportsReplacement && !mxReplImplContext &&
           [ #  #  #  # ]
                 [ -  + ]
    3377                 :            :              XML_NAMESPACE_DRAW == nPrefix &&
    3378                 :          0 :              IsXMLToken( rLocalName, XML_IMAGE ) )
    3379                 :            :     {
    3380                 :            :         // read replacement image
    3381                 :          0 :         SvXMLImportContext *pImplContext = &mxImplContext;
    3382                 :            :         SdXMLShapeContext *pSContext =
    3383 [ #  # ][ #  # ]:          0 :             PTR_CAST( SdXMLShapeContext, pImplContext );
    3384         [ #  # ]:          0 :         if( pSContext )
    3385                 :            :         {
    3386                 :            :             uno::Reference < beans::XPropertySet > xPropSet(
    3387         [ #  # ]:          0 :                     pSContext->getShape(), uno::UNO_QUERY );
    3388         [ #  # ]:          0 :             if( xPropSet.is() )
    3389                 :            :             {
    3390                 :          0 :                 pContext = new XMLReplacementImageContext( GetImport(),
    3391 [ #  # ][ #  # ]:          0 :                                     nPrefix, rLocalName, xAttrList, xPropSet );
    3392         [ #  # ]:          0 :                 mxReplImplContext = pContext;
    3393                 :          0 :             }
    3394                 :            :         }
    3395                 :            :     }
    3396   [ -  +  #  #  :         18 :     else if(
                   #  # ]
           [ -  +  #  # ]
           [ +  -  +  -  
           -  + ][ -  + ]
    3397                 :            :             ( nPrefix == XML_NAMESPACE_SVG &&   // #i68101#
    3398                 :          0 :                 (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) ) ||
    3399                 :          0 :              (nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) ) ||
    3400                 :          6 :              (nPrefix == XML_NAMESPACE_DRAW && (IsXMLToken( rLocalName, XML_GLUE_POINT ) ||
    3401                 :          6 :                                                 IsXMLToken( rLocalName, XML_THUMBNAIL ) ) ) )
    3402                 :            :     {
    3403                 :          0 :         SvXMLImportContext *pImplContext = &mxImplContext;
    3404                 :          0 :         pContext = PTR_CAST( SdXMLShapeContext, pImplContext )->CreateChildContext( nPrefix,
    3405   [ #  #  #  # ]:          0 :                                                                         rLocalName, xAttrList );
    3406                 :            :     }
    3407 [ +  - ][ -  + ]:          6 :     else if ( (XML_NAMESPACE_DRAW == nPrefix) && IsXMLToken( rLocalName, XML_IMAGE_MAP ) )
                 [ -  + ]
    3408                 :            :     {
    3409         [ #  # ]:          0 :         SdXMLShapeContext *pSContext = dynamic_cast< SdXMLShapeContext* >( &mxImplContext );
    3410         [ #  # ]:          0 :         if( pSContext )
    3411                 :            :         {
    3412         [ #  # ]:          0 :             uno::Reference < beans::XPropertySet > xPropSet( pSContext->getShape(), uno::UNO_QUERY );
    3413         [ #  # ]:          0 :             if (xPropSet.is())
    3414                 :            :             {
    3415 [ #  # ][ #  # ]:          0 :                 pContext = new XMLImageMapContext(GetImport(), nPrefix, rLocalName, xPropSet);
    3416                 :          0 :             }
    3417                 :            :         }
    3418                 :            :     }
    3419                 :            : 
    3420                 :            :     // call parent for content
    3421         [ +  + ]:        132 :     if(!pContext)
    3422                 :          6 :         pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
    3423                 :            : 
    3424                 :        132 :     return pContext;
    3425                 :            : }
    3426                 :            : 
    3427                 :        126 : void SdXMLFrameShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
    3428                 :            : {
    3429                 :            :     // ignore
    3430                 :        126 : }
    3431                 :            : 
    3432                 :        126 : void SdXMLFrameShapeContext::EndElement()
    3433                 :            : {
    3434         [ -  + ]:        126 :     if( !mxImplContext.Is() )
    3435                 :            :     {
    3436                 :            :         // now check if this is an empty presentation object
    3437         [ #  # ]:          0 :         sal_Int16 nAttrCount = mxAttrList.is() ? mxAttrList->getLength() : 0;
    3438         [ #  # ]:          0 :         for(sal_Int16 a(0); a < nAttrCount; a++)
    3439                 :            :         {
    3440                 :          0 :             OUString aLocalName;
    3441 [ #  # ][ #  # ]:          0 :             sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(mxAttrList->getNameByIndex(a), &aLocalName);
                 [ #  # ]
    3442                 :            : 
    3443         [ #  # ]:          0 :             if( nPrefix == XML_NAMESPACE_PRESENTATION )
    3444                 :            :             {
    3445 [ #  # ][ #  # ]:          0 :                 if( IsXMLToken( aLocalName, XML_PLACEHOLDER ) )
    3446                 :            :                 {
    3447 [ #  # ][ #  # ]:          0 :                     mbIsPlaceholder = IsXMLToken( mxAttrList->getValueByIndex(a), XML_TRUE );
                 [ #  # ]
    3448                 :            :                 }
    3449 [ #  # ][ #  # ]:          0 :                 else if( IsXMLToken( aLocalName, XML_CLASS ) )
    3450                 :            :                 {
    3451 [ #  # ][ #  # ]:          0 :                     maPresentationClass = mxAttrList->getValueByIndex(a);
    3452                 :            :                 }
    3453                 :            :             }
    3454                 :          0 :         }
    3455                 :            : 
    3456 [ #  # ][ #  # ]:          0 :         if( (!maPresentationClass.isEmpty()) && mbIsPlaceholder )
                 [ #  # ]
    3457                 :            :         {
    3458                 :          0 :             uno::Reference< xml::sax::XAttributeList> xEmpty;
    3459                 :            : 
    3460                 :          0 :             enum XMLTokenEnum eToken = XML_TEXT_BOX;
    3461                 :            : 
    3462 [ #  # ][ #  # ]:          0 :             if( IsXMLToken( maPresentationClass, XML_GRAPHIC ) )
    3463                 :            :             {
    3464                 :          0 :                 eToken = XML_IMAGE;
    3465                 :            : 
    3466                 :            :             }
    3467 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_PAGE ) )
    3468                 :            :             {
    3469                 :          0 :                 eToken = XML_PAGE_THUMBNAIL;
    3470                 :            :             }
    3471 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_CHART ) ||
         [ #  # ][ #  # ]
                 [ #  # ]
    3472         [ #  # ]:          0 :                      IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) ||
    3473         [ #  # ]:          0 :                      IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
    3474                 :            :             {
    3475                 :          0 :                 eToken = XML_OBJECT;
    3476                 :            :             }
    3477                 :            : 
    3478                 :          0 :             mxImplContext = GetImport().GetShapeImport()->CreateFrameChildContext(
    3479 [ #  # ][ #  # ]:          0 :                     GetImport(), XML_NAMESPACE_DRAW, GetXMLToken( eToken ), mxAttrList, mxShapes, xEmpty );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    3480                 :            : 
    3481         [ #  # ]:          0 :             if( mxImplContext.Is() )
    3482                 :            :             {
    3483         [ #  # ]:          0 :                 mxImplContext->StartElement( mxAttrList );
    3484         [ #  # ]:          0 :                 mxImplContext->EndElement();
    3485                 :          0 :             }
    3486                 :            :         }
    3487                 :            :     }
    3488                 :            : 
    3489                 :        126 :     mxImplContext = 0;
    3490                 :        126 :     SdXMLShapeContext::EndElement();
    3491                 :        126 : }
    3492                 :            : 
    3493                 :       1023 : void SdXMLFrameShapeContext::processAttribute( sal_uInt16,
    3494                 :            :         const ::rtl::OUString&, const ::rtl::OUString& )
    3495                 :            : {
    3496                 :            :     // ignore
    3497                 :       1023 : }
    3498                 :            : 
    3499 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLCustomShapeContext, SdXMLShapeContext );
    3500                 :            : 
    3501                 :        186 : SdXMLCustomShapeContext::SdXMLCustomShapeContext(
    3502                 :            :     SvXMLImport& rImport,
    3503                 :            :     sal_uInt16 nPrfx,
    3504                 :            :     const OUString& rLocalName,
    3505                 :            :     const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
    3506                 :            :     uno::Reference< drawing::XShapes >& rShapes,
    3507                 :            :     sal_Bool bTemporaryShape)
    3508         [ +  - ]:        186 : :   SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
    3509                 :            : {
    3510                 :        186 : }
    3511                 :            : 
    3512                 :            : //////////////////////////////////////////////////////////////////////////////
    3513                 :            : 
    3514                 :        186 : SdXMLCustomShapeContext::~SdXMLCustomShapeContext()
    3515                 :            : {
    3516         [ -  + ]:        372 : }
    3517                 :            : 
    3518                 :            : //////////////////////////////////////////////////////////////////////////////
    3519                 :            : 
    3520                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    3521                 :       1296 : void SdXMLCustomShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    3522                 :            : {
    3523         [ +  + ]:       1296 :     if( XML_NAMESPACE_DRAW == nPrefix )
    3524                 :            :     {
    3525         [ -  + ]:        549 :         if( IsXMLToken( rLocalName, XML_ENGINE ) )
    3526                 :            :         {
    3527                 :          0 :             maCustomShapeEngine = rValue;
    3528                 :          0 :             return;
    3529                 :            :         }
    3530         [ -  + ]:        549 :         if ( IsXMLToken( rLocalName, XML_DATA ) )
    3531                 :            :         {
    3532                 :          0 :             maCustomShapeData = rValue;
    3533                 :          0 :             return;
    3534                 :            :         }
    3535                 :            :     }
    3536                 :       1296 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    3537                 :            : }
    3538                 :            : 
    3539                 :            : //////////////////////////////////////////////////////////////////////////////
    3540                 :            : 
    3541                 :        186 : void SdXMLCustomShapeContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
    3542                 :            : {
    3543                 :            :     // create rectangle shape
    3544                 :        186 :     AddShape("com.sun.star.drawing.CustomShape");
    3545         [ +  - ]:        186 :     if ( mxShape.is() )
    3546                 :            :     {
    3547                 :            :         // Add, set Style and properties from base shape
    3548                 :        186 :         SetStyle();
    3549                 :        186 :         SetLayer();
    3550                 :            : 
    3551                 :            :         // set pos, size, shear and rotate
    3552                 :        186 :         SetTransformation();
    3553                 :            : 
    3554                 :            :         try
    3555                 :            :         {
    3556         [ +  - ]:        186 :             uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
    3557         [ +  - ]:        186 :             if( xPropSet.is() )
    3558                 :            :             {
    3559         [ -  + ]:        186 :                 if ( !maCustomShapeEngine.isEmpty() )
    3560                 :            :                 {
    3561                 :          0 :                     uno::Any aAny;
    3562         [ #  # ]:          0 :                     aAny <<= maCustomShapeEngine;
    3563 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue( EASGet( EAS_CustomShapeEngine ), aAny );
                 [ #  # ]
    3564                 :            :                 }
    3565         [ -  + ]:        186 :                 if ( !maCustomShapeData.isEmpty() )
    3566                 :            :                 {
    3567                 :          0 :                     uno::Any aAny;
    3568         [ #  # ]:          0 :                     aAny <<= maCustomShapeData;
    3569 [ #  # ][ #  # ]:          0 :                     xPropSet->setPropertyValue( EASGet( EAS_CustomShapeData ), aAny );
                 [ #  # ]
    3570                 :            :                 }
    3571         [ #  # ]:        186 :             }
    3572                 :            :         }
    3573                 :          0 :         catch(const uno::Exception&)
    3574                 :            :         {
    3575                 :            :             OSL_FAIL( "could not set enhanced customshape geometry" );
    3576                 :            :         }
    3577                 :        186 :         SdXMLShapeContext::StartElement(xAttrList);
    3578                 :            :     }
    3579                 :        186 : }
    3580                 :            : 
    3581                 :        186 : void SdXMLCustomShapeContext::EndElement()
    3582                 :            : {
    3583         [ +  - ]:        186 :     if ( !maCustomShapeGeometry.empty() )
    3584                 :            :     {
    3585                 :        186 :         const rtl::OUString sCustomShapeGeometry    (  "CustomShapeGeometry"  );
    3586                 :            : 
    3587                 :            :         // converting the vector to a sequence
    3588         [ +  - ]:        186 :         uno::Sequence< beans::PropertyValue > aSeq( maCustomShapeGeometry.size() );
    3589         [ +  - ]:        186 :         beans::PropertyValue* pValues = aSeq.getArray();
    3590         [ +  - ]:        186 :         std::vector< beans::PropertyValue >::const_iterator aIter( maCustomShapeGeometry.begin() );
    3591         [ +  - ]:        186 :         std::vector< beans::PropertyValue >::const_iterator aEnd( maCustomShapeGeometry.end() );
    3592 [ +  - ][ +  + ]:       1146 :         while ( aIter != aEnd )
    3593         [ +  - ]:        960 :             *pValues++ = *aIter++;
    3594                 :            : 
    3595                 :            :         try
    3596                 :            :         {
    3597         [ +  - ]:        186 :             uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
    3598         [ +  - ]:        186 :             if( xPropSet.is() )
    3599                 :            :             {
    3600                 :        186 :                 uno::Any aAny;
    3601         [ +  - ]:        186 :                 aAny <<= aSeq;
    3602 [ +  - ][ +  - ]:        186 :                 xPropSet->setPropertyValue( sCustomShapeGeometry, aAny );
    3603         [ #  # ]:        186 :             }
    3604                 :            :         }
    3605         [ #  # ]:          0 :         catch(const uno::Exception&)
    3606                 :            :         {
    3607                 :            :             OSL_FAIL( "could not set enhanced customshape geometry" );
    3608                 :            :         }
    3609                 :            : 
    3610                 :        186 :         sal_Int32 nUPD( 0 );
    3611                 :        186 :         sal_Int32 nBuild( 0 );
    3612         [ +  - ]:        186 :         GetImport().getBuildIds( nUPD, nBuild );
    3613 [ -  + ][ #  # ]:        186 :         if( ((nUPD >= 640 && nUPD <= 645) || (nUPD == 680)) && (nBuild <= 9221) )
         [ -  + ][ #  # ]
    3614                 :            :         {
    3615         [ #  # ]:          0 :             Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( mxShape, UNO_QUERY );
    3616         [ #  # ]:          0 :             if( xDefaulter.is() )
    3617                 :            :             {
    3618                 :          0 :                 rtl::OUString aEmptyType;
    3619 [ #  # ][ #  # ]:          0 :                 xDefaulter->createCustomShapeDefaults( aEmptyType );
    3620                 :          0 :             }
    3621         [ +  - ]:        186 :         }
    3622                 :            :     }
    3623                 :            : 
    3624                 :        186 :     SdXMLShapeContext::EndElement();
    3625                 :        186 : }
    3626                 :            : 
    3627                 :            : //////////////////////////////////////////////////////////////////////////////
    3628                 :            : 
    3629                 :        372 : SvXMLImportContext* SdXMLCustomShapeContext::CreateChildContext(
    3630                 :            :     sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
    3631                 :            :     const uno::Reference<xml::sax::XAttributeList>& xAttrList )
    3632                 :            : {
    3633                 :        372 :     SvXMLImportContext* pContext = NULL;
    3634         [ +  + ]:        372 :     if ( XML_NAMESPACE_DRAW == nPrefix )
    3635                 :            :     {
    3636         [ +  - ]:        186 :         if ( IsXMLToken( rLocalName, XML_ENHANCED_GEOMETRY ) )
    3637                 :            :         {
    3638         [ +  - ]:        186 :             uno::Reference< beans::XPropertySet > xPropSet( mxShape,uno::UNO_QUERY );
    3639         [ +  - ]:        186 :             if ( xPropSet.is() )
    3640 [ +  - ][ +  - ]:        186 :                 pContext = new XMLEnhancedCustomShapeContext( GetImport(), mxShape, nPrefix, rLocalName, maCustomShapeGeometry );
    3641                 :            :         }
    3642                 :            :     }
    3643                 :            :     // delegate to parent class if no context could be created
    3644         [ +  + ]:        372 :     if ( NULL == pContext )
    3645                 :            :         pContext = SdXMLShapeContext::CreateChildContext( nPrefix, rLocalName,
    3646                 :        186 :                                                          xAttrList);
    3647                 :        372 :     return pContext;
    3648                 :            : }
    3649                 :            : 
    3650                 :            : ///////////////////////////////////////////////////////////////////////
    3651                 :            : 
    3652                 :            : //////////////////////////////////////////////////////////////////////////////
    3653                 :            : 
    3654 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLTableShapeContext, SdXMLShapeContext );
    3655                 :            : 
    3656                 :          6 : SdXMLTableShapeContext::SdXMLTableShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes )
    3657                 :          6 : : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, sal_False )
    3658                 :            : {
    3659                 :          6 :     memset( &maTemplateStylesUsed, 0, sizeof( maTemplateStylesUsed ) );
    3660                 :          6 : }
    3661                 :            : 
    3662         [ +  - ]:          6 : SdXMLTableShapeContext::~SdXMLTableShapeContext()
    3663                 :            : {
    3664         [ -  + ]:         12 : }
    3665                 :            : 
    3666                 :          6 : void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
    3667                 :            : {
    3668                 :          6 :     const char* pService = "com.sun.star.drawing.TableShape";
    3669                 :            : 
    3670 [ -  + ][ #  # ]:          6 :     sal_Bool bIsPresShape = !maPresentationClass.isEmpty() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
         [ #  # ][ #  # ]
         [ #  # ][ -  + ]
                 [ #  # ]
    3671         [ -  + ]:          6 :     if( bIsPresShape )
    3672                 :            :     {
    3673         [ #  # ]:          0 :         if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) )
    3674                 :            :         {
    3675                 :          0 :             pService = "com.sun.star.presentation.TableShape";
    3676                 :            :         }
    3677                 :            :     }
    3678                 :            : 
    3679                 :          6 :     AddShape( pService );
    3680                 :            : 
    3681         [ +  - ]:          6 :     if( mxShape.is() )
    3682                 :            :     {
    3683         [ +  - ]:          6 :         SetLayer();
    3684                 :            : 
    3685         [ +  - ]:          6 :         uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY);
    3686                 :            : 
    3687         [ -  + ]:          6 :         if(bIsPresShape)
    3688                 :            :         {
    3689         [ #  # ]:          0 :             if(xProps.is())
    3690                 :            :             {
    3691 [ #  # ][ #  # ]:          0 :                 uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
    3692         [ #  # ]:          0 :                 if( xPropsInfo.is() )
    3693                 :            :                 {
    3694 [ #  # ][ #  # ]:          0 :                     if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString("IsEmptyPresentationObject" )))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    3695 [ #  # ][ #  # ]:          0 :                         xProps->setPropertyValue( OUString("IsEmptyPresentationObject" ), ::cppu::bool2any( sal_False ) );
                 [ #  # ]
    3696                 :            : 
    3697 [ #  # ][ #  # ]:          0 :                     if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString("IsPlaceholderDependent" )))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    3698 [ #  # ][ #  # ]:          0 :                         xProps->setPropertyValue( OUString("IsPlaceholderDependent" ), ::cppu::bool2any( sal_False ) );
                 [ #  # ]
    3699                 :          0 :                 }
    3700                 :            :             }
    3701                 :            :         }
    3702                 :            : 
    3703         [ +  - ]:          6 :         SetStyle();
    3704                 :            : 
    3705         [ +  - ]:          6 :         if( xProps.is() )
    3706                 :            :         {
    3707         [ +  - ]:          6 :             if( !msTemplateStyleName.isEmpty() ) try
    3708                 :            :             {
    3709         [ +  - ]:          6 :                 Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetImport().GetModel(), UNO_QUERY_THROW );
    3710 [ +  - ][ +  - ]:          6 :                 Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
    3711                 :          6 :                 const OUString sFamilyName( "table"  );
    3712 [ +  - ][ +  - ]:          6 :                 Reference< XNameAccess > xTableFamily( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
                 [ +  - ]
    3713 [ +  - ][ +  - ]:          6 :                 Reference< XStyle > xTableStyle( xTableFamily->getByName( msTemplateStyleName ), UNO_QUERY_THROW );
                 [ +  - ]
    3714 [ +  - ][ +  - ]:          6 :                 xProps->setPropertyValue( OUString(  "TableTemplate"  ), Any( xTableStyle ) );
         [ #  # ][ +  - ]
    3715                 :            :             }
    3716         [ #  # ]:          0 :             catch(const Exception&)
    3717                 :            :             {
    3718                 :            :                 OSL_FAIL("SdXMLTableShapeContext::StartElement(), exception caught!");
    3719                 :            :             }
    3720                 :            : 
    3721                 :          6 :             const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
    3722 [ +  + ][ +  - ]:         42 :             for( int i = 0; pEntry->msApiName && (i < 6); i++, pEntry++ )
                 [ +  + ]
    3723                 :            :             {
    3724                 :            :                 try
    3725                 :            :                 {
    3726         [ +  - ]:         36 :                     const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
    3727 [ +  - ][ +  - ]:         36 :                     xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i] ) );
         [ +  - ][ #  # ]
    3728                 :            :                 }
    3729         [ #  # ]:          0 :                 catch(const Exception&)
    3730                 :            :                 {
    3731                 :            :                     OSL_FAIL("SdXMLTableShapeContext::StartElement(), exception caught!");
    3732                 :            :                 }
    3733                 :            :             }
    3734                 :            :         }
    3735                 :            : 
    3736 [ +  - ][ +  - ]:          6 :         GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
         [ +  - ][ +  - ]
    3737                 :            : 
    3738 [ +  - ][ +  - ]:          6 :         const rtl::Reference< XMLTableImport >& xTableImport( GetImport().GetShapeImport()->GetShapeTableImport() );
         [ +  - ][ +  - ]
    3739 [ +  - ][ +  - ]:          6 :         if( xTableImport.is() && xProps.is() )
                 [ +  - ]
    3740                 :            :         {
    3741                 :            :             uno::Reference< table::XColumnRowRange > xColumnRowRange(
    3742 [ +  - ][ +  - ]:          6 :                 xProps->getPropertyValue( OUString("Model" ) ), uno::UNO_QUERY );
                 [ +  - ]
    3743                 :            : 
    3744         [ +  - ]:          6 :             if( xColumnRowRange.is() )
    3745 [ +  - ][ +  - ]:          6 :                 mxTableImportContext = xTableImport->CreateTableContext( GetPrefix(), GetLocalName(), xColumnRowRange );
    3746                 :            : 
    3747         [ +  - ]:          6 :             if( mxTableImportContext.Is() )
    3748         [ +  - ]:          6 :                 mxTableImportContext->StartElement( xAttrList );
    3749                 :          6 :         }
    3750                 :            :     }
    3751                 :          6 : }
    3752                 :            : 
    3753                 :          6 : void SdXMLTableShapeContext::EndElement()
    3754                 :            : {
    3755         [ +  - ]:          6 :     if( mxTableImportContext.Is() )
    3756                 :          6 :         mxTableImportContext->EndElement();
    3757                 :            : 
    3758                 :          6 :     SdXMLShapeContext::EndElement();
    3759                 :            : 
    3760         [ +  - ]:          6 :     if( mxShape.is() )
    3761                 :            :     {
    3762                 :            :         // set pos, size, shear and rotate
    3763                 :          6 :         SetTransformation();
    3764                 :            :     }
    3765                 :          6 : }
    3766                 :            : 
    3767                 :            : // this is called from the parent group for each unparsed attribute in the attribute list
    3768                 :         54 : void SdXMLTableShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
    3769                 :            : {
    3770         [ +  + ]:         54 :     if( nPrefix == XML_NAMESPACE_TABLE )
    3771                 :            :     {
    3772         [ +  + ]:         18 :         if( IsXMLToken( rLocalName, XML_TEMPLATE_NAME ) )
    3773                 :            :         {
    3774                 :          6 :             msTemplateStyleName = rValue;
    3775                 :            :         }
    3776                 :            :         else
    3777                 :            :         {
    3778                 :         12 :             int i = 0;
    3779                 :         12 :             const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0];
    3780 [ +  - ][ +  - ]:         54 :             while( pEntry->msApiName && (i < 6) )
                 [ +  - ]
    3781                 :            :             {
    3782         [ +  + ]:         36 :                 if( IsXMLToken( rLocalName, pEntry->meXMLName ) )
    3783                 :            :                 {
    3784         [ +  - ]:         12 :                     if( IsXMLToken( rValue, XML_TRUE ) )
    3785                 :         12 :                         maTemplateStylesUsed[i] = sal_True;
    3786                 :         12 :                     break;
    3787                 :            :                 }
    3788                 :         24 :                 pEntry++;
    3789                 :         24 :                 i++;
    3790                 :            :             }
    3791                 :            :         }
    3792                 :            :     }
    3793                 :         54 :     SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue );
    3794                 :         54 : }
    3795                 :            : 
    3796                 :         54 : SvXMLImportContext* SdXMLTableShapeContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& xAttrList )
    3797                 :            : {
    3798 [ +  - ][ +  - ]:         54 :     if( mxTableImportContext.Is() && (nPrefix == XML_NAMESPACE_TABLE) )
                 [ +  - ]
    3799                 :         54 :         return mxTableImportContext->CreateChildContext(nPrefix, rLocalName, xAttrList);
    3800                 :            :     else
    3801                 :         54 :         return SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
    3802                 :            : }
    3803                 :            : 
    3804                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10