LCOV - code coverage report
Current view: top level - xmloff/source/draw - shapeexport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 295 493 59.8 %
Date: 2012-08-25 Functions: 18 18 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 429 1386 31.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <memory>
      31                 :            : 
      32                 :            : #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
      33                 :            : #include <com/sun/star/presentation/ClickAction.hpp>
      34                 :            : #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
      35                 :            : #include <com/sun/star/container/XChild.hpp>
      36                 :            : #include <com/sun/star/text/XText.hpp>
      37                 :            : #include <com/sun/star/chart/XChartDocument.hpp>
      38                 :            : #include <com/sun/star/drawing/XControlShape.hpp>
      39                 :            : #include <com/sun/star/style/XStyle.hpp>
      40                 :            : #include <com/sun/star/drawing/XGluePointsSupplier.hpp>
      41                 :            : #include <com/sun/star/container/XIdentifierAccess.hpp>
      42                 :            : #include <com/sun/star/drawing/GluePoint2.hpp>
      43                 :            : #include <com/sun/star/drawing/Alignment.hpp>
      44                 :            : #include <com/sun/star/drawing/EscapeDirection.hpp>
      45                 :            : #include <com/sun/star/table/XColumnRowRange.hpp>
      46                 :            : #include <xmloff/xmluconv.hxx>
      47                 :            : #include "PropertySetMerger.hxx"
      48                 :            : 
      49                 :            : #include <xmloff/shapeexport.hxx>
      50                 :            : #include "sdpropls.hxx"
      51                 :            : #include "sdxmlexp_impl.hxx"
      52                 :            : #include <xmloff/families.hxx>
      53                 :            : #include <tools/debug.hxx>
      54                 :            : #include <xmloff/contextid.hxx>
      55                 :            : #include <xmloff/xmltoken.hxx>
      56                 :            : #include <sot/clsids.hxx>
      57                 :            : #include <tools/globname.hxx>
      58                 :            : #include <com/sun/star/beans/XPropertyState.hpp>
      59                 :            : 
      60                 :            : #include <comphelper/processfactory.hxx>
      61                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      62                 :            : #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
      63                 :            : 
      64                 :            : #include "xmloff/xmlnmspe.hxx"
      65                 :            : 
      66                 :            : using ::rtl::OUString;
      67                 :            : using ::rtl::OUStringBuffer;
      68                 :            : 
      69                 :            : using namespace ::com::sun::star;
      70                 :            : using namespace ::xmloff::token;
      71                 :            : 
      72                 :            : //////////////////////////////////////////////////////////////////////////////
      73                 :            : 
      74                 :        107 : XMLShapeExport::XMLShapeExport(SvXMLExport& rExp,
      75                 :            :                                 SvXMLExportPropertyMapper *pExtMapper )
      76                 :            : :   mrExport( rExp ),
      77                 :            :     mnNextUniqueShapeId(1),
      78                 :            :     maShapesInfos(),
      79                 :        107 :     maCurrentShapesIter(maShapesInfos.end()),
      80                 :            :     mbExportLayer( sal_False ),
      81                 :            :     // #88546# init to sal_False
      82                 :            :     mbHandleProgressBar( sal_False ),
      83                 :            :     msZIndex( "ZOrder" ),
      84                 :            :     msPrintable( "Printable" ),
      85                 :            :     msVisible( "Visible" ),
      86                 :            :     msEmptyPres( "IsEmptyPresentationObject" ),
      87                 :            :     msModel( "Model" ),
      88                 :            :     msStartShape( "StartShape" ),
      89                 :            :     msEndShape( "EndShape" ),
      90                 :            :     msOnClick( "OnClick" ),
      91                 :            :     msEventType( "EventType" ),
      92                 :            :     msPresentation( "Presentation" ),
      93                 :            :     msMacroName( "MacroName" ),
      94                 :            :     msScript( "Script" ),
      95                 :            :     msLibrary( "Library" ),
      96                 :            :     msClickAction( "ClickAction" ),
      97                 :            :     msBookmark( "Bookmark" ),
      98                 :            :     msEffect( "Effect" ),
      99                 :            :     msPlayFull( "PlayFull" ),
     100                 :            :     msVerb( "Verb" ),
     101                 :            :     msSoundURL( "SoundURL" ),
     102                 :            :     msSpeed( "Speed" ),
     103 [ +  - ][ +  - ]:        107 :     msStarBasic( "StarBasic" )
     104                 :            : {
     105                 :            :     // construct PropertyHandlerFactory
     106 [ +  - ][ +  - ]:        107 :     mxSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), rExp );
                 [ +  - ]
     107                 :            :     // construct PropertySetMapper
     108 [ +  - ][ +  - ]:        107 :     mxPropertySetMapper = CreateShapePropMapper( mrExport );
     109         [ +  + ]:        107 :     if( pExtMapper )
     110                 :            :     {
     111         [ +  - ]:         42 :         UniReference < SvXMLExportPropertyMapper > xExtMapper( pExtMapper );
     112 [ +  - ][ +  - ]:         42 :         mxPropertySetMapper->ChainExportMapper( xExtMapper );
                 [ +  - ]
     113                 :            :     }
     114                 :            : 
     115                 :            : /*
     116                 :            :     // chain text attributes
     117                 :            :     xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp));
     118                 :            : */
     119                 :            : 
     120                 :            :     mrExport.GetAutoStylePool()->AddFamily(
     121                 :            :         XML_STYLE_FAMILY_SD_GRAPHICS_ID,
     122                 :            :         OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME),
     123                 :            :         GetPropertySetMapper(),
     124 [ +  - ][ +  - ]:        107 :         OUString(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     125                 :            :     mrExport.GetAutoStylePool()->AddFamily(
     126                 :            :         XML_STYLE_FAMILY_SD_PRESENTATION_ID,
     127                 :            :         OUString(XML_STYLE_FAMILY_SD_PRESENTATION_NAME),
     128                 :            :         GetPropertySetMapper(),
     129 [ +  - ][ +  - ]:        107 :         OUString(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     130                 :            : 
     131                 :        107 :     maCurrentInfo = maShapeInfos.end();
     132                 :            : 
     133                 :            :     // create table export helper and let him add his families in time
     134         [ +  - ]:        107 :     GetShapeTableExport();
     135                 :        107 : }
     136                 :            : 
     137                 :            : ///////////////////////////////////////////////////////////////////////
     138                 :            : 
     139 [ +  - ][ +  - ]:        107 : XMLShapeExport::~XMLShapeExport()
         [ +  - ][ +  - ]
     140                 :            : {
     141         [ -  + ]:        206 : }
     142                 :            : 
     143                 :            : ///////////////////////////////////////////////////////////////////////
     144                 :            : 
     145                 :            : // sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format
     146                 :        100 : uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement( const uno::Reference< drawing::XShape >& xShape )
     147                 :            : {
     148                 :        100 :     uno::Reference< drawing::XShape > xCustomShapeReplacement;
     149                 :            : 
     150         [ +  + ]:        100 :     if( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 )
     151                 :            :     {
     152 [ +  - ][ +  - ]:         50 :         String aType( (OUString)xShape->getShapeType() );
                 [ +  - ]
     153 [ -  + ][ +  - ]:         50 :         if( aType.EqualsAscii( (const sal_Char*)"com.sun.star.drawing.CustomShape" ) )
     154                 :            :         {
     155         [ #  # ]:          0 :             uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
     156         [ #  # ]:          0 :             if( xSet.is() )
     157                 :            :             {
     158                 :          0 :                 rtl::OUString aEngine;
     159 [ #  # ][ #  # ]:          0 :                 xSet->getPropertyValue( OUString(  "CustomShapeEngine"  ) ) >>= aEngine;
     160         [ #  # ]:          0 :                 if ( aEngine.isEmpty() )
     161                 :          0 :                     aEngine = OUString(  "com.sun.star.drawing.EnhancedCustomShapeEngine"  );
     162                 :            : 
     163         [ #  # ]:          0 :                 uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
     164                 :            : 
     165 [ #  # ][ #  # ]:          0 :                 if ( !aEngine.isEmpty() && xFactory.is() )
                 [ #  # ]
     166                 :            :                 {
     167         [ #  # ]:          0 :                     uno::Sequence< uno::Any > aArgument( 1 );
     168         [ #  # ]:          0 :                     uno::Sequence< beans::PropertyValue > aPropValues( 2 );
     169         [ #  # ]:          0 :                     aPropValues[ 0 ].Name = rtl::OUString( "CustomShape" );
     170 [ #  # ][ #  # ]:          0 :                     aPropValues[ 0 ].Value <<= xShape;
     171                 :          0 :                     sal_Bool bForceGroupWithText = sal_True;
     172         [ #  # ]:          0 :                     aPropValues[ 1 ].Name = rtl::OUString( "ForceGroupWithText" );
     173 [ #  # ][ #  # ]:          0 :                     aPropValues[ 1 ].Value <<= bForceGroupWithText;
     174 [ #  # ][ #  # ]:          0 :                     aArgument[ 0 ] <<= aPropValues;
     175 [ #  # ][ #  # ]:          0 :                     uno::Reference< uno::XInterface > xInterface( xFactory->createInstanceWithArguments( aEngine, aArgument ) );
     176         [ #  # ]:          0 :                     if ( xInterface.is() )
     177                 :            :                     {
     178                 :            :                         uno::Reference< drawing::XCustomShapeEngine > xCustomShapeEngine(
     179         [ #  # ]:          0 :                             uno::Reference< drawing::XCustomShapeEngine >( xInterface, uno::UNO_QUERY ) );
     180         [ #  # ]:          0 :                         if ( xCustomShapeEngine.is() )
     181 [ #  # ][ #  # ]:          0 :                             xCustomShapeReplacement = xCustomShapeEngine->render();
                 [ #  # ]
     182 [ #  # ][ #  # ]:          0 :                     }
     183                 :          0 :                 }
     184                 :          0 :             }
     185         [ +  - ]:         50 :         }
     186                 :            :     }
     187                 :        100 :     return xCustomShapeReplacement;
     188                 :            : }
     189                 :            : 
     190                 :            : // This method collects all automatic styles for the given XShape
     191                 :        100 : void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShape >& xShape )
     192                 :            : {
     193         [ +  - ]:        100 :     if( maCurrentShapesIter == maShapesInfos.end() )
     194                 :            :     {
     195                 :            :         OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" );
     196                 :            :         return;
     197                 :            :     }
     198                 :        100 :     sal_Int32 nZIndex = 0;
     199         [ +  - ]:        100 :     uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
     200         [ +  - ]:        100 :     if( xSet.is() )
     201 [ +  - ][ +  - ]:        100 :         xSet->getPropertyValue(msZIndex) >>= nZIndex;
     202                 :            : 
     203                 :        100 :     ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
     204                 :            : 
     205         [ -  + ]:        100 :     if( (sal_Int32)aShapeInfoVector.size() <= nZIndex )
     206                 :            :     {
     207                 :            :         OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): no shape info allocated for a given shape" );
     208                 :            :         return;
     209                 :            :     }
     210                 :            : 
     211                 :        100 :     ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex];
     212                 :            : 
     213         [ +  - ]:        100 :     uno::Reference< drawing::XShape > xCustomShapeReplacement = checkForCustomShapeReplacement( xShape );
     214         [ -  + ]:        100 :     if ( xCustomShapeReplacement.is() )
     215         [ #  # ]:          0 :         aShapeInfo.xCustomShapeReplacement = xCustomShapeReplacement;
     216                 :            : 
     217                 :            :     // -----------------------------
     218                 :            :     // first compute the shapes type
     219                 :            :     // -----------------------------
     220         [ +  - ]:        100 :     ImpCalcShapeType(xShape, aShapeInfo.meShapeType);
     221                 :            : 
     222                 :            :     const bool bObjSupportsText =
     223                 :            :         aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape &&
     224                 :            :         aShapeInfo.meShapeType != XmlShapeTypePresChartShape &&
     225                 :            :         aShapeInfo.meShapeType != XmlShapeTypeDrawOLE2Shape &&
     226                 :            :         aShapeInfo.meShapeType != XmlShapeTypePresOLE2Shape &&
     227                 :            :         aShapeInfo.meShapeType != XmlShapeTypeDrawSheetShape &&
     228                 :            :         aShapeInfo.meShapeType != XmlShapeTypePresSheetShape &&
     229                 :            :         aShapeInfo.meShapeType != XmlShapeTypeDraw3DSceneObject &&
     230                 :            :         aShapeInfo.meShapeType != XmlShapeTypeDraw3DCubeObject &&
     231                 :            :         aShapeInfo.meShapeType != XmlShapeTypeDraw3DSphereObject &&
     232                 :            :         aShapeInfo.meShapeType != XmlShapeTypeDraw3DLatheObject &&
     233                 :            :         aShapeInfo.meShapeType != XmlShapeTypeDraw3DExtrudeObject &&
     234                 :            :         aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape &&
     235                 :            :         aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
     236 [ +  - ][ +  - ]:        100 :         aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape;
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
     237                 :            : 
     238                 :            :     const bool bObjSupportsStyle =
     239                 :        100 :         aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape;
     240                 :            : 
     241                 :        100 :     sal_Bool bIsEmptyPresObj = sal_False;
     242                 :            : 
     243         [ +  - ]:        100 :     uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
     244         [ -  + ]:        100 :     if ( aShapeInfo.xCustomShapeReplacement.is() )
     245                 :          0 :         xPropSet.clear();
     246                 :            : 
     247                 :            :     // ----------------
     248                 :            :     // prep text styles
     249                 :            :     // ----------------
     250 [ +  - ][ +  + ]:        100 :     if( xPropSet.is() && bObjSupportsText )
                 [ +  + ]
     251                 :            :     {
     252         [ +  - ]:         92 :         uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
     253 [ +  + ][ +  - ]:         92 :         if(xText.is() && !xText->getString().isEmpty())
         [ +  - ][ +  + ]
                 [ +  + ]
           [ +  +  #  # ]
     254                 :            :         {
     255 [ +  - ][ +  - ]:         56 :             uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
     256                 :            : 
     257 [ +  - ][ +  - ]:         56 :             if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(msEmptyPres) )
         [ +  - ][ +  - ]
                 [ +  - ]
     258                 :            :             {
     259 [ +  - ][ +  - ]:         56 :                 uno::Any aAny = xPropSet->getPropertyValue(msEmptyPres);
     260                 :         56 :                 aAny >>= bIsEmptyPresObj;
     261                 :            :             }
     262                 :            : 
     263         [ +  + ]:         56 :             if(!bIsEmptyPresObj)
     264                 :            :             {
     265 [ +  - ][ +  - ]:         44 :                 GetExport().GetTextParagraphExport()->collectTextAutoStyles( xText );
         [ +  - ][ +  - ]
     266                 :         56 :             }
     267                 :         92 :         }
     268                 :            :     }
     269                 :            : 
     270                 :            :     // ------------------------------
     271                 :            :     // compute the shape parent style
     272                 :            :     // ------------------------------
     273         [ +  - ]:        100 :     if( xPropSet.is() )
     274                 :            :     {
     275 [ +  - ][ +  - ]:        100 :         uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( xPropSet->getPropertySetInfo() );
     276                 :            : 
     277                 :        100 :         OUString aParentName;
     278                 :        100 :         uno::Reference< style::XStyle > xStyle;
     279                 :            : 
     280         [ +  - ]:        100 :         if( bObjSupportsStyle )
     281                 :            :         {
     282 [ +  - ][ +  - ]:        100 :             if( xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName( OUString("Style")) )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
           [ +  -  #  #  
                   #  # ]
     283 [ +  - ][ +  - ]:        100 :                 xPropSet->getPropertyValue(OUString("Style")) >>= xStyle;
                 [ +  - ]
     284                 :            : 
     285         [ +  + ]:        100 :             if(xStyle.is())
     286                 :            :             {
     287                 :            :                 // get family ID
     288         [ +  - ]:         72 :                 uno::Reference< beans::XPropertySet > xStylePropSet(xStyle, uno::UNO_QUERY);
     289                 :            :                 DBG_ASSERT( xStylePropSet.is(), "style without a XPropertySet?" );
     290                 :            :                 try
     291                 :            :                 {
     292         [ +  - ]:         72 :                     if(xStylePropSet.is())
     293                 :            :                     {
     294                 :         72 :                         OUString aFamilyName;
     295 [ +  - ][ +  - ]:         72 :                         xStylePropSet->getPropertyValue(OUString("Family")) >>= aFamilyName;
     296 [ +  + ][ +  + ]:         72 :                         if( !aFamilyName.isEmpty() && aFamilyName != "graphics" )
                 [ +  - ]
     297         [ #  # ]:         72 :                             aShapeInfo.mnFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID;
     298                 :            :                     }
     299                 :            :                 }
     300         [ #  # ]:          0 :                 catch(const beans::UnknownPropertyException&)
     301                 :            :                 {
     302                 :            :                     // Ignored.
     303                 :            :                     DBG_ASSERT(false,
     304                 :            :                         "XMLShapeExport::collectShapeAutoStyles: style has no 'Family' property");
     305                 :            :                 }
     306                 :            : 
     307                 :            :                 // get parent-style name
     308         [ +  + ]:         72 :                 if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == aShapeInfo.mnFamily)
     309                 :            :                 {
     310                 :         56 :                     aParentName = msPresentationStylePrefix;
     311                 :            :                 }
     312                 :            : 
     313 [ +  - ][ +  - ]:         72 :                 aParentName += xStyle->getName();
     314                 :            :             }
     315                 :            :         }
     316                 :            : 
     317                 :            :         // filter propset
     318         [ +  - ]:        100 :         std::vector< XMLPropertyState > xPropStates;
     319                 :            : 
     320                 :        100 :         sal_Int32 nCount = 0;
     321 [ +  + ][ +  - ]:        100 :         if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) )
     322                 :            :         {
     323 [ +  - ][ +  - ]:        100 :             xPropStates = GetPropertySetMapper()->Filter( xPropSet );
         [ +  - ][ +  - ]
     324                 :            : 
     325         [ -  + ]:        100 :             if (XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType)
     326                 :            :             {
     327                 :            :                 // for control shapes, we additionally need the number format style (if any)
     328         [ #  # ]:          0 :                 uno::Reference< drawing::XControlShape > xControl(xShape, uno::UNO_QUERY);
     329                 :            :                 DBG_ASSERT(xControl.is(), "XMLShapeExport::collectShapeAutoStyles: ShapeType control, but no XControlShape!");
     330         [ #  # ]:          0 :                 if (xControl.is())
     331                 :            :                 {
     332 [ #  # ][ #  # ]:          0 :                     uno::Reference< beans::XPropertySet > xControlModel(xControl->getControl(), uno::UNO_QUERY);
                 [ #  # ]
     333                 :            :                     DBG_ASSERT(xControlModel.is(), "XMLShapeExport::collectShapeAutoStyles: no control model on the control shape!");
     334                 :            : 
     335 [ #  # ][ #  # ]:          0 :                     ::rtl::OUString sNumberStyle = mrExport.GetFormExport()->getControlNumberStyle(xControlModel);
         [ #  # ][ #  # ]
     336         [ #  # ]:          0 :                     if (!sNumberStyle.isEmpty())
     337                 :            :                     {
     338 [ #  # ][ #  # ]:          0 :                         sal_Int32 nIndex = GetPropertySetMapper()->getPropertySetMapper()->FindEntryIndex(CTF_SD_CONTROL_SHAPE_DATA_STYLE);
         [ #  # ][ #  # ]
                 [ #  # ]
     339                 :            :                             // TODO : this retrieval of the index could be moved into the ctor, holding the index
     340                 :            :                             //          as member, thus saving time.
     341                 :            :                         DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!");
     342                 :            : 
     343         [ #  # ]:          0 :                         XMLPropertyState aNewState(nIndex, uno::makeAny(sNumberStyle));
     344         [ #  # ]:          0 :                         xPropStates.push_back(aNewState);
     345                 :          0 :                     }
     346                 :          0 :                 }
     347                 :            :             }
     348                 :            : 
     349                 :        100 :             std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin();
     350                 :        100 :             std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end();
     351 [ +  - ][ +  + ]:        532 :             while( aIter != aEnd )
     352                 :            :             {
     353         [ +  + ]:        432 :                 if( aIter->mnIndex != -1 )
     354                 :        260 :                     nCount++;
     355                 :        432 :                 ++aIter;
     356                 :            :             }
     357                 :            :         }
     358                 :            : 
     359         [ +  + ]:        100 :         if(nCount == 0)
     360                 :            :         {
     361                 :            :             // no hard attributes, use parent style name for export
     362                 :         40 :             aShapeInfo.msStyleName = aParentName;
     363                 :            :         }
     364                 :            :         else
     365                 :            :         {
     366                 :            :             // there are filtered properties -> hard attributes
     367                 :            :             // try to find this style in AutoStylePool
     368 [ +  - ][ +  - ]:         60 :             aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Find(aShapeInfo.mnFamily, aParentName, xPropStates);
         [ +  - ][ +  - ]
     369                 :            : 
     370         [ +  + ]:         60 :             if(aShapeInfo.msStyleName.isEmpty())
     371                 :            :             {
     372                 :            :                 // Style did not exist, add it to AutoStalePool
     373 [ +  - ][ +  - ]:         36 :                 aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Add(aShapeInfo.mnFamily, aParentName, xPropStates);
         [ +  - ][ +  - ]
     374                 :            :             }
     375                 :            :         }
     376                 :            : 
     377                 :            :         // optionaly generate auto style for text attributes
     378 [ +  + ][ +  - ]:        100 :         if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) && bObjSupportsText )
                 [ +  + ]
     379                 :            :         {
     380 [ +  - ][ +  - ]:         92 :             xPropStates = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter( xPropSet );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     381                 :            : 
     382                 :            :             // ----------------------------------------------------------------------
     383                 :            :             // yet more additionally, we need to care for the ParaAdjust property
     384         [ -  + ]:         92 :             if ( XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType )
     385                 :            :             {
     386 [ #  # ][ #  # ]:          0 :                 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
     387         [ #  # ]:          0 :                 uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
     388 [ #  # ][ #  # ]:          0 :                 if ( xPropSetInfo.is() && xPropState.is() )
                 [ #  # ]
     389                 :            :                 {
     390                 :            :                     // this is because:
     391                 :            :                     // * if controls shapes have a ParaAdjust property, then this is the Align property of the control model
     392                 :            :                     // * control models are allowed to have an Align of "void"
     393                 :            :                     // * the Default for control model's Align is TextAlign_LEFT
     394                 :            :                     // * defaults for style properties are not written, but we need to write the "left",
     395                 :            :                     //   because we need to distiguish this "left" from the case where not align attribute
     396                 :            :                     //   is present which means "void"
     397 [ #  # ][ #  # ]:          0 :                     static const ::rtl::OUString s_sParaAdjustPropertyName(  "ParaAdjust"  );
     398 [ #  # ][ #  # ]:          0 :                     if  (   xPropSetInfo->hasPropertyByName( s_sParaAdjustPropertyName )
         [ #  # ][ #  # ]
                 [ #  # ]
     399 [ #  # ][ #  # ]:          0 :                         &&  ( beans::PropertyState_DEFAULT_VALUE == xPropState->getPropertyState( s_sParaAdjustPropertyName ) )
     400                 :            :                         )
     401                 :            :                     {
     402 [ #  # ][ #  # ]:          0 :                         sal_Int32 nIndex = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     403                 :            :                             // TODO : this retrieval of the index should be moved into the ctor, holding the index
     404                 :            :                             //          as member, thus saving time.
     405                 :            :                         DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for the ParaAdjust context id!");
     406                 :            : 
     407 [ #  # ][ #  # ]:          0 :                         uno::Any aParaAdjustValue = xPropSet->getPropertyValue( s_sParaAdjustPropertyName );
     408                 :          0 :                         XMLPropertyState aAlignDefaultState( nIndex, aParaAdjustValue );
     409                 :            : 
     410         [ #  # ]:          0 :                         xPropStates.push_back( aAlignDefaultState );
     411                 :            :                     }
     412                 :          0 :                 }
     413                 :            :             }
     414                 :            :             // ----------------------------------------------------------------------
     415                 :            : 
     416                 :         92 :             nCount = 0;
     417                 :         92 :             std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin();
     418                 :         92 :             std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end();
     419 [ +  - ][ +  + ]:        272 :             while( aIter != aEnd )
     420                 :            :             {
     421         [ +  - ]:        180 :                 if( aIter->mnIndex != -1 )
     422                 :        180 :                     nCount++;
     423                 :        180 :                 ++aIter;
     424                 :            :             }
     425                 :            : 
     426         [ +  + ]:         92 :             if( nCount )
     427                 :            :             {
     428                 :         44 :                 const OUString aEmpty;
     429 [ +  - ][ +  - ]:         44 :                 aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, aEmpty, xPropStates );
         [ +  - ][ +  - ]
     430         [ -  + ]:         44 :                 if(aShapeInfo.msTextStyleName.isEmpty())
     431                 :            :                 {
     432                 :            :                     // Style did not exist, add it to AutoStalePool
     433 [ #  # ][ #  # ]:          0 :                     aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TEXT_PARAGRAPH, aEmpty, xPropStates);
         [ #  # ][ #  # ]
     434                 :         92 :                 }
     435                 :            :             }
     436                 :        100 :         }
     437                 :            :     }
     438                 :            : 
     439                 :            :     // ----------------------------------------
     440                 :            :     // prepare animation informations if needed
     441                 :            :     // ----------------------------------------
     442         [ +  + ]:        100 :     if( mxAnimationsExporter.is() )
     443 [ +  - ][ +  - ]:          8 :         mxAnimationsExporter->prepare( xShape, mrExport );
     444                 :            : 
     445                 :            :     // check for special shapes
     446                 :            : 
     447      [ -  -  + ]:        100 :     switch( aShapeInfo.meShapeType )
     448                 :            :     {
     449                 :            :         case XmlShapeTypeDrawConnectorShape:
     450                 :            :         {
     451                 :          0 :             uno::Reference< uno::XInterface > xConnection;
     452                 :            : 
     453                 :            :             // create shape ids for export later
     454 [ #  # ][ #  # ]:          0 :             xPropSet->getPropertyValue( msStartShape ) >>= xConnection;
                 [ #  # ]
     455         [ #  # ]:          0 :             if( xConnection.is() )
     456 [ #  # ][ #  # ]:          0 :                 mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection );
     457                 :            : 
     458 [ #  # ][ #  # ]:          0 :             xPropSet->getPropertyValue( msEndShape ) >>= xConnection;
                 [ #  # ]
     459         [ #  # ]:          0 :             if( xConnection.is() )
     460 [ #  # ][ #  # ]:          0 :                 mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection );
     461                 :          0 :             break;
     462                 :            :         }
     463                 :            :         case XmlShapeTypePresTableShape:
     464                 :            :         case XmlShapeTypeDrawTableShape:
     465                 :            :         {
     466                 :            :             try
     467                 :            :             {
     468 [ #  # ][ #  # ]:          0 :                 uno::Reference< table::XColumnRowRange > xRange( xSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     469 [ #  # ][ #  # ]:          0 :                 GetShapeTableExport()->collectTableAutoStyles( xRange );
                 [ #  # ]
     470                 :            :             }
     471         [ #  # ]:          0 :             catch(const uno::Exception&)
     472                 :            :             {
     473                 :            :                 OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): exception caught while collection auto styles for a table!" );
     474                 :            :             }
     475                 :          0 :             break;
     476                 :            :         }
     477                 :            :         default:
     478                 :        100 :             break;
     479                 :            :     }
     480                 :            : 
     481         [ +  - ]:        100 :     maShapeInfos.push_back( aShapeInfo );
     482                 :        100 :     maCurrentInfo = maShapeInfos.begin();
     483                 :            : 
     484                 :            :     // -----------------------------------------------------
     485                 :            :     // check for shape collections (group shape or 3d scene)
     486                 :            :     // and collect contained shapes style infos
     487                 :            :     // -----------------------------------------------------
     488                 :        100 :     const uno::Reference< drawing::XShape >& xCollection = aShapeInfo.xCustomShapeReplacement.is()
     489         [ -  + ]:        100 :                                                 ? aShapeInfo.xCustomShapeReplacement : xShape;
     490                 :            :     {
     491         [ +  - ]:        100 :         uno::Reference< drawing::XShapes > xShapes( xCollection, uno::UNO_QUERY );
     492         [ -  + ]:        100 :         if( xShapes.is() )
     493                 :            :         {
     494         [ #  # ]:          0 :             collectShapesAutoStyles( xShapes );
     495                 :        100 :         }
     496         [ +  - ]:        100 :     }
     497                 :            : }
     498                 :            : 
     499                 :            : ///////////////////////////////////////////////////////////////////////
     500                 :            : 
     501                 :            : namespace
     502                 :            : {
     503                 :            :     class NewTextListsHelper
     504                 :            :     {
     505                 :            :         public:
     506                 :        100 :             NewTextListsHelper( SvXMLExport& rExp )
     507                 :        100 :                 : mrExport( rExp )
     508                 :            :             {
     509 [ +  - ][ +  - ]:        100 :                 mrExport.GetTextParagraphExport()->PushNewTextListsHelper();
     510                 :        100 :             }
     511                 :            : 
     512                 :        100 :             ~NewTextListsHelper()
     513                 :            :             {
     514 [ +  - ][ +  - ]:        100 :                 mrExport.GetTextParagraphExport()->PopTextListsHelper();
     515                 :        100 :             }
     516                 :            : 
     517                 :            :         private:
     518                 :            :             SvXMLExport& mrExport;
     519                 :            :     };
     520                 :            : }
     521                 :            : // This method exports the given XShape
     522                 :        100 : void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape,
     523                 :            :                                  sal_Int32 nFeatures /* = SEF_DEFAULT */,
     524                 :            :                                  com::sun::star::awt::Point* pRefPoint /* = NULL */,
     525                 :            :                                  SvXMLAttributeList* pAttrList /* = NULL */ )
     526                 :            : {
     527         [ +  - ]:        100 :     if( maCurrentShapesIter == maShapesInfos.end() )
     528                 :            :     {
     529                 :            :         OSL_FAIL( "XMLShapeExport::exportShape(): no auto styles where collected before export" );
     530                 :            :         return;
     531                 :            :     }
     532                 :        100 :     sal_Int32 nZIndex = 0;
     533         [ +  - ]:        100 :     uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
     534                 :            : 
     535                 :            : 
     536                 :        100 :     ::std::auto_ptr< SvXMLElementExport >  mpHyperlinkElement;
     537                 :            : 
     538                 :            :     // export hyperlinks with <a><shape/></a>. Currently only in draw since draw
     539                 :            :     // does not support document events
     540 [ -  + ][ -  + ]:        100 :     if( xSet.is() && (GetExport().GetModelType() == SvtModuleOptions::E_DRAW) ) try
                 [ +  - ]
     541                 :            :     {
     542                 :          0 :         presentation::ClickAction eAction = presentation::ClickAction_NONE;
     543 [ #  # ][ #  # ]:          0 :         xSet->getPropertyValue(OUString("OnClick")) >>= eAction;
                 [ #  # ]
     544                 :            : 
     545 [ #  # ][ #  # ]:          0 :         if( (eAction == presentation::ClickAction_DOCUMENT) ||
     546                 :            :             (eAction == presentation::ClickAction_BOOKMARK) )
     547                 :            :         {
     548                 :          0 :             OUString sURL;
     549 [ #  # ][ #  # ]:          0 :             xSet->getPropertyValue(msBookmark) >>= sURL;
     550                 :            : 
     551         [ #  # ]:          0 :             if( !sURL.isEmpty() )
     552                 :            :             {
     553         [ #  # ]:          0 :                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
     554         [ #  # ]:          0 :                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
     555         [ #  # ]:          0 :                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
     556 [ #  # ][ #  # ]:          0 :                 mpHyperlinkElement.reset( new SvXMLElementExport(mrExport, XML_NAMESPACE_DRAW, XML_A, sal_True, sal_True) );
     557         [ #  # ]:          0 :             }
     558                 :            :         }
     559                 :            :     }
     560         [ #  # ]:          0 :     catch(const uno::Exception&)
     561                 :            :     {
     562                 :            :         OSL_FAIL("XMLShapeExport::exportShape(): exception during hyperlink export");
     563                 :            :     }
     564                 :            : 
     565                 :            : 
     566         [ +  - ]:        100 :     if( xSet.is() )
     567 [ +  - ][ +  - ]:        100 :         xSet->getPropertyValue(msZIndex) >>= nZIndex;
     568                 :            : 
     569                 :        100 :     ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
     570                 :            : 
     571         [ -  + ]:        100 :     if( (sal_Int32)aShapeInfoVector.size() <= nZIndex )
     572                 :            :     {
     573                 :            :         OSL_FAIL( "XMLShapeExport::exportShape(): no shape info collected for a given shape" );
     574                 :            :         return;
     575                 :            :     }
     576                 :            : 
     577         [ +  - ]:        100 :     NewTextListsHelper aNewTextListsHelper( mrExport );
     578                 :            : 
     579                 :        100 :     const ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex];
     580                 :            : 
     581                 :            : 
     582                 :            : #ifdef DBG_UTIL
     583                 :            :     // ---------------------------------------
     584                 :            :     // check if this is the correct ShapesInfo
     585                 :            :     // ---------------------------------------
     586                 :            :     uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
     587                 :            :     if( xChild.is() )
     588                 :            :     {
     589                 :            :         uno::Reference< drawing::XShapes > xParent( xChild->getParent(), uno::UNO_QUERY );
     590                 :            :         DBG_ASSERT( xParent.is() && xParent.get() == (*maCurrentShapesIter).first.get(), "XMLShapeExport::exportShape(): Wrong call to XMLShapeExport::seekShapes()" );
     591                 :            :     }
     592                 :            : 
     593                 :            :     // -----------------------------
     594                 :            :     // first compute the shapes type
     595                 :            :     // -----------------------------
     596                 :            :     {
     597                 :            :         XmlShapeType eShapeType(XmlShapeTypeNotYetSet);
     598                 :            :         ImpCalcShapeType(xShape, eShapeType);
     599                 :            : 
     600                 :            :         DBG_ASSERT( eShapeType == aShapeInfo.meShapeType, "exportShape callings do not correspond to collectShapeAutoStyles calls!" );
     601                 :            :     }
     602                 :            : #endif
     603                 :            : 
     604                 :            :     // ----------------------------------------
     605                 :            :     // collect animation informations if needed
     606                 :            :     // ----------------------------------------
     607         [ +  + ]:        100 :     if( mxAnimationsExporter.is() )
     608 [ +  - ][ +  - ]:          4 :         mxAnimationsExporter->collect( xShape, mrExport );
     609                 :            : 
     610                 :            :     /* Export shapes name if he has one (#i51726#)
     611                 :            :        Export of the shape name for text documents only if the OpenDocument
     612                 :            :        file format is written - exceptions are group shapes.
     613                 :            :        Note: Writer documents in OpenOffice.org file format doesn't contain
     614                 :            :              any names for shapes, except for group shapes.
     615                 :            :     */
     616                 :            :     {
     617   [ +  -  +  -  :        300 :         if ( ( GetExport().GetModelType() != SvtModuleOptions::E_WRITER &&
             -  +  #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ +  - ]
     618                 :        100 :                GetExport().GetModelType() != SvtModuleOptions::E_WRITERWEB &&
     619                 :        100 :                GetExport().GetModelType() != SvtModuleOptions::E_WRITERGLOBAL ) ||
     620                 :          0 :              ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 ||
     621                 :            :              aShapeInfo.meShapeType == XmlShapeTypeDrawGroupShape ||
     622                 :            :              ( aShapeInfo.meShapeType == XmlShapeTypeDrawCustomShape &&
     623                 :          0 :                aShapeInfo.xCustomShapeReplacement.is() ) )
     624                 :            :         {
     625         [ +  - ]:        100 :             uno::Reference< container::XNamed > xNamed( xShape, uno::UNO_QUERY );
     626         [ +  - ]:        100 :             if( xNamed.is() )
     627                 :            :             {
     628 [ +  - ][ +  - ]:        100 :                 const OUString aName( xNamed->getName() );
     629         [ -  + ]:        100 :                 if( !aName.isEmpty() )
     630         [ #  # ]:        100 :                     mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, aName );
     631                 :        100 :             }
     632                 :            :         }
     633                 :            :     }
     634                 :            : 
     635                 :            :     // ------------------
     636                 :            :     // export style name
     637                 :            :     // ------------------
     638         [ +  + ]:        100 :     if( !aShapeInfo.msStyleName.isEmpty() )
     639                 :            :     {
     640         [ +  + ]:         76 :         if(XML_STYLE_FAMILY_SD_GRAPHICS_ID == aShapeInfo.mnFamily)
     641 [ +  - ][ +  - ]:         20 :             mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) );
     642                 :            :         else
     643 [ +  - ][ +  - ]:         56 :             mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) );
     644                 :            :     }
     645                 :            : 
     646                 :            :     // ------------------
     647                 :            :     // export text style name
     648                 :            :     // ------------------
     649         [ +  + ]:        100 :     if( !aShapeInfo.msTextStyleName.isEmpty() )
     650                 :            :     {
     651         [ +  - ]:         44 :         mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TEXT_STYLE_NAME, aShapeInfo.msTextStyleName );
     652                 :            :     }
     653                 :            : 
     654                 :            :     // --------------------------
     655                 :            :     // export shapes id if needed
     656                 :            :     // --------------------------
     657                 :            :     {
     658         [ +  - ]:        100 :         uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
     659 [ +  - ][ +  - ]:        100 :         const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRef );
     660         [ -  + ]:        100 :         if( !rShapeId.isEmpty() )
     661                 :            :         {
     662         [ #  # ]:          0 :             mrExport.AddAttributeIdLegacy(XML_NAMESPACE_DRAW, rShapeId);
     663                 :        100 :         }
     664                 :            :     }
     665                 :            : 
     666                 :            :     // --------------------------
     667                 :            :     // export layer information
     668                 :            :     // --------------------------
     669         [ +  - ]:        100 :     if( IsLayerExportEnabled() )
     670                 :            :     {
     671                 :            :         // check for group or scene shape and not export layer if this is one
     672         [ +  - ]:        100 :         uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY );
     673         [ +  - ]:        100 :         if( !xShapes.is() )
     674                 :            :         {
     675                 :            :             try
     676                 :            :             {
     677         [ +  - ]:        100 :                 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
     678                 :        100 :                 OUString aLayerName;
     679 [ +  - ][ +  - ]:        100 :                 xProps->getPropertyValue( OUString( "LayerName" ) ) >>= aLayerName;
     680 [ #  # ][ +  - ]:        100 :                 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LAYER, aLayerName );
     681                 :            : 
     682                 :            :             }
     683         [ #  # ]:          0 :             catch(const uno::Exception&)
     684                 :            :             {
     685                 :            :                 OSL_FAIL( "could not export layer name for shape!" );
     686                 :            :             }
     687         [ #  # ]:        100 :         }
     688                 :            :     }
     689                 :            : 
     690                 :            :     // export draw:display (do not export in ODF 1.2 or older)
     691 [ +  - ][ +  - ]:        100 :     if( xSet.is() && ( mrExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) )
         [ +  - ][ +  - ]
     692                 :            :     {
     693 [ +  - ][ +  + ]:        100 :         if( aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape && aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
         [ +  + ][ +  - ]
     694                 :            :             aShapeInfo.meShapeType != XmlShapeTypeHandoutShape && aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape )
     695                 :            : 
     696                 :            :         try
     697                 :            :         {
     698                 :         68 :             sal_Bool bVisible = sal_True;
     699                 :         68 :             sal_Bool bPrintable = sal_True;
     700                 :            : 
     701 [ +  - ][ +  - ]:         68 :             xSet->getPropertyValue(msVisible) >>= bVisible;
     702 [ +  - ][ +  - ]:         68 :             xSet->getPropertyValue(msPrintable) >>= bPrintable;
     703                 :            : 
     704                 :         68 :             XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID;
     705 [ +  - ][ +  - ]:         68 :             const unsigned short nDisplay = (bVisible ? 2 : 0) | (bPrintable ? 1 : 0);
     706   [ -  -  -  + ]:         68 :             switch( nDisplay )
     707                 :            :             {
     708                 :          0 :             case 0: eDisplayToken = XML_NONE; break;
     709                 :          0 :             case 1: eDisplayToken = XML_PRINTER; break;
     710                 :          0 :             case 2: eDisplayToken = XML_SCREEN; break;
     711                 :            :             // case 3: eDisplayToken = XML_ALWAYS break; this is the default
     712                 :            :             }
     713                 :            : 
     714         [ -  + ]:         68 :             if( eDisplayToken != XML_TOKEN_INVALID )
     715         [ #  # ]:         68 :                 mrExport.AddAttribute(XML_NAMESPACE_DRAW_EXT, XML_DISPLAY, eDisplayToken );
     716                 :            :         }
     717         [ #  # ]:          0 :         catch(const uno::Exception&)
     718                 :            :         {
     719                 :            :             OSL_FAIL( "XMLShapeExport::exportShape(), exception caught!" );
     720                 :            :         }
     721                 :            :     }
     722                 :            : 
     723                 :            :     // #82003# test export count
     724                 :            :     // #91587# ALWAYS increment since now ALL to be exported shapes are counted.
     725 [ +  - ][ +  - ]:        100 :     if(mrExport.GetShapeExport()->IsHandleProgressBarEnabled())
         [ +  - ][ +  - ]
     726                 :            :     {
     727 [ +  - ][ +  - ]:        100 :         mrExport.GetProgressBarHelper()->Increment();
     728                 :            :     }
     729                 :            : 
     730         [ +  - ]:        100 :     onExport( xShape );
     731                 :            : 
     732                 :            :     // --------------------
     733                 :            :     // export shape element
     734                 :            :     // --------------------
     735   [ -  -  -  -  :        100 :     switch(aShapeInfo.meShapeType)
          +  -  -  -  -  
          -  -  -  +  -  
          -  -  -  -  -  
             -  -  -  - ]
     736                 :            :     {
     737                 :            :         case XmlShapeTypeDrawRectangleShape:
     738                 :            :         {
     739         [ #  # ]:          0 :             ImpExportRectangleShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     740                 :          0 :             break;
     741                 :            :         }
     742                 :            :         case XmlShapeTypeDrawEllipseShape:
     743                 :            :         {
     744         [ #  # ]:          0 :             ImpExportEllipseShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     745                 :          0 :             break;
     746                 :            :         }
     747                 :            :         case XmlShapeTypeDrawLineShape:
     748                 :            :         {
     749         [ #  # ]:          0 :             ImpExportLineShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     750                 :          0 :             break;
     751                 :            :         }
     752                 :            :         case XmlShapeTypeDrawPolyPolygonShape:  // closed PolyPolygon
     753                 :            :         case XmlShapeTypeDrawPolyLineShape:     // open PolyPolygon
     754                 :            :         case XmlShapeTypeDrawClosedBezierShape: // closed PolyPolygon containing curves
     755                 :            :         case XmlShapeTypeDrawOpenBezierShape:   // open PolyPolygon containing curves
     756                 :            :         {
     757         [ #  # ]:          0 :             ImpExportPolygonShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     758                 :          0 :             break;
     759                 :            :         }
     760                 :            : 
     761                 :            :         case XmlShapeTypeDrawTextShape:
     762                 :            :         case XmlShapeTypePresTitleTextShape:
     763                 :            :         case XmlShapeTypePresOutlinerShape:
     764                 :            :         case XmlShapeTypePresSubtitleShape:
     765                 :            :         case XmlShapeTypePresNotesShape:
     766                 :            :         case XmlShapeTypePresHeaderShape:
     767                 :            :         case XmlShapeTypePresFooterShape:
     768                 :            :         case XmlShapeTypePresSlideNumberShape:
     769                 :            :         case XmlShapeTypePresDateTimeShape:
     770                 :            :         {
     771         [ +  - ]:         68 :             ImpExportTextBoxShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     772                 :         68 :             break;
     773                 :            :         }
     774                 :            : 
     775                 :            :         case XmlShapeTypeDrawGraphicObjectShape:
     776                 :            :         case XmlShapeTypePresGraphicObjectShape:
     777                 :            :         {
     778         [ #  # ]:          0 :             ImpExportGraphicObjectShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     779                 :          0 :             break;
     780                 :            :         }
     781                 :            : 
     782                 :            :         case XmlShapeTypeDrawChartShape:
     783                 :            :         case XmlShapeTypePresChartShape:
     784                 :            :         {
     785         [ #  # ]:          0 :             ImpExportChartShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint, pAttrList );
     786                 :          0 :             break;
     787                 :            :         }
     788                 :            : 
     789                 :            :         case XmlShapeTypeDrawControlShape:
     790                 :            :         {
     791         [ #  # ]:          0 :             ImpExportControlShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     792                 :          0 :             break;
     793                 :            :         }
     794                 :            : 
     795                 :            :         case XmlShapeTypeDrawConnectorShape:
     796                 :            :         {
     797         [ #  # ]:          0 :             ImpExportConnectorShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     798                 :          0 :             break;
     799                 :            :         }
     800                 :            : 
     801                 :            :         case XmlShapeTypeDrawMeasureShape:
     802                 :            :         {
     803         [ #  # ]:          0 :             ImpExportMeasureShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     804                 :          0 :             break;
     805                 :            :         }
     806                 :            : 
     807                 :            :         case XmlShapeTypeDrawOLE2Shape:
     808                 :            :         case XmlShapeTypePresOLE2Shape:
     809                 :            :         case XmlShapeTypeDrawSheetShape:
     810                 :            :         case XmlShapeTypePresSheetShape:
     811                 :            :         {
     812         [ #  # ]:          0 :             ImpExportOLE2Shape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     813                 :          0 :             break;
     814                 :            :         }
     815                 :            : 
     816                 :            :         case XmlShapeTypePresTableShape:
     817                 :            :         case XmlShapeTypeDrawTableShape:
     818                 :            :         {
     819         [ #  # ]:          0 :             ImpExportTableShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     820                 :          0 :             break;
     821                 :            :         }
     822                 :            : 
     823                 :            :         case XmlShapeTypeDrawPageShape:
     824                 :            :         case XmlShapeTypePresPageShape:
     825                 :            :         case XmlShapeTypeHandoutShape:
     826                 :            :         {
     827         [ +  - ]:         32 :             ImpExportPageShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     828                 :         32 :             break;
     829                 :            :         }
     830                 :            : 
     831                 :            :         case XmlShapeTypeDrawCaptionShape:
     832                 :            :         {
     833         [ #  # ]:          0 :             ImpExportCaptionShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     834                 :          0 :             break;
     835                 :            :         }
     836                 :            : 
     837                 :            :         case XmlShapeTypeDraw3DCubeObject:
     838                 :            :         case XmlShapeTypeDraw3DSphereObject:
     839                 :            :         case XmlShapeTypeDraw3DLatheObject:
     840                 :            :         case XmlShapeTypeDraw3DExtrudeObject:
     841                 :            :         {
     842         [ #  # ]:          0 :             ImpExport3DShape(xShape, aShapeInfo.meShapeType);
     843                 :          0 :             break;
     844                 :            :         }
     845                 :            : 
     846                 :            :         case XmlShapeTypeDraw3DSceneObject:
     847                 :            :         {
     848         [ #  # ]:          0 :             ImpExport3DSceneShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     849                 :          0 :             break;
     850                 :            :         }
     851                 :            : 
     852                 :            :         case XmlShapeTypeDrawGroupShape:
     853                 :            :         {
     854                 :            :             // empty group
     855         [ #  # ]:          0 :             ImpExportGroupShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     856                 :          0 :             break;
     857                 :            :         }
     858                 :            : 
     859                 :            :         case XmlShapeTypeDrawFrameShape:
     860                 :            :         {
     861         [ #  # ]:          0 :             ImpExportFrameShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     862                 :          0 :             break;
     863                 :            :         }
     864                 :            : 
     865                 :            :         case XmlShapeTypeDrawAppletShape:
     866                 :            :         {
     867         [ #  # ]:          0 :             ImpExportAppletShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     868                 :          0 :             break;
     869                 :            :         }
     870                 :            : 
     871                 :            :         case XmlShapeTypeDrawPluginShape:
     872                 :            :         {
     873         [ #  # ]:          0 :             ImpExportPluginShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     874                 :          0 :             break;
     875                 :            :         }
     876                 :            : 
     877                 :            :         case XmlShapeTypeDrawCustomShape:
     878                 :            :         {
     879         [ #  # ]:          0 :             if ( aShapeInfo.xCustomShapeReplacement.is() )
     880         [ #  # ]:          0 :                 ImpExportGroupShape( aShapeInfo.xCustomShapeReplacement, XmlShapeTypeDrawGroupShape, nFeatures, pRefPoint );
     881                 :            :             else
     882         [ #  # ]:          0 :                 ImpExportCustomShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     883                 :          0 :             break;
     884                 :            :         }
     885                 :            : 
     886                 :            :         case XmlShapeTypePresMediaShape:
     887                 :            :         case XmlShapeTypeDrawMediaShape:
     888                 :            :         {
     889         [ #  # ]:          0 :             ImpExportMediaShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
     890                 :          0 :             break;
     891                 :            :         }
     892                 :            : 
     893                 :            :         case XmlShapeTypePresOrgChartShape:
     894                 :            :         case XmlShapeTypeUnknown:
     895                 :            :         case XmlShapeTypeNotYetSet:
     896                 :            :         default:
     897                 :            :         {
     898                 :            :             // this should never happen and is an error
     899                 :            :             OSL_FAIL("XMLEXP: WriteShape: unknown or unexpected type of shape in export!");
     900                 :          0 :             break;
     901                 :            :         }
     902                 :            :     }
     903                 :            : 
     904                 :        100 :     mpHyperlinkElement.reset();
     905                 :            : 
     906                 :            :     // #97489# #97111#
     907                 :            :     // if there was an error and no element for the shape was exported
     908                 :            :     // we need to clear the attribute list or the attributes will be
     909                 :            :     // set on the next exported element, which can result in corrupt
     910                 :            :     // xml files due to duplicate attributes
     911                 :            : 
     912                 :        100 :     mrExport.CheckAttrList();   // asserts in non pro if we have attributes left
     913 [ +  - ][ +  - ]:        100 :     mrExport.ClearAttrList();   // clears the attributes
         [ -  + ][ +  - ]
                 [ +  - ]
     914                 :            : }
     915                 :            : 
     916                 :            : ///////////////////////////////////////////////////////////////////////
     917                 :            : 
     918                 :            : // This method collects all automatic styles for the shapes inside the given XShapes collection
     919                 :         20 : void XMLShapeExport::collectShapesAutoStyles( const uno::Reference < drawing::XShapes >& xShapes )
     920                 :            : {
     921                 :         20 :     ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter;
     922                 :         20 :     seekShapes( xShapes );
     923                 :            : 
     924                 :         20 :     uno::Reference< drawing::XShape > xShape;
     925 [ +  - ][ +  - ]:         20 :     const sal_Int32 nShapeCount(xShapes->getCount());
     926         [ +  + ]:        120 :     for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
     927                 :            :     {
     928 [ +  - ][ +  - ]:        100 :         xShapes->getByIndex(nShapeId) >>= xShape;
                 [ +  - ]
     929                 :            :         DBG_ASSERT( xShape.is(), "Shape without a XShape?" );
     930         [ -  + ]:        100 :         if(!xShape.is())
     931                 :          0 :             continue;
     932                 :            : 
     933         [ +  - ]:        100 :         collectShapeAutoStyles( xShape );
     934                 :            :     }
     935                 :            : 
     936                 :         20 :     maCurrentShapesIter = aOldCurrentShapesIter;
     937                 :         20 : }
     938                 :            : 
     939                 :            : ///////////////////////////////////////////////////////////////////////
     940                 :            : 
     941                 :            : // This method exports all XShape inside the given XShapes collection
     942                 :         20 : void XMLShapeExport::exportShapes( const uno::Reference < drawing::XShapes >& xShapes, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */ )
     943                 :            : {
     944                 :         20 :     ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter;
     945                 :         20 :     seekShapes( xShapes );
     946                 :            : 
     947                 :         20 :     uno::Reference< drawing::XShape > xShape;
     948 [ +  - ][ +  - ]:         20 :     const sal_Int32 nShapeCount(xShapes->getCount());
     949         [ +  + ]:        120 :     for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
     950                 :            :     {
     951 [ +  - ][ +  - ]:        100 :         xShapes->getByIndex(nShapeId) >>= xShape;
                 [ +  - ]
     952                 :            :         DBG_ASSERT( xShape.is(), "Shape without a XShape?" );
     953         [ -  + ]:        100 :         if(!xShape.is())
     954                 :          0 :             continue;
     955                 :            : 
     956         [ +  - ]:        100 :         exportShape( xShape, nFeatures, pRefPoint );
     957                 :            :     }
     958                 :            : 
     959                 :         20 :     maCurrentShapesIter = aOldCurrentShapesIter;
     960                 :         20 : }
     961                 :            : 
     962                 :            : ///////////////////////////////////////////////////////////////////////
     963                 :            : 
     964                 :         90 : void XMLShapeExport::seekShapes( const uno::Reference< drawing::XShapes >& xShapes ) throw()
     965                 :            : {
     966         [ +  - ]:         90 :     if( xShapes.is() )
     967                 :            :     {
     968                 :         90 :         maCurrentShapesIter = maShapesInfos.find( xShapes );
     969         [ +  + ]:         90 :         if( maCurrentShapesIter == maShapesInfos.end() )
     970                 :            :         {
     971         [ +  - ]:         66 :             ImplXMLShapeExportInfoVector aNewInfoVector;
     972 [ +  - ][ +  - ]:         66 :             aNewInfoVector.resize( (ShapesInfos::size_type) xShapes->getCount() );
                 [ +  - ]
     973 [ +  - ][ +  - ]:         66 :             maShapesInfos[ xShapes ] = aNewInfoVector;
     974                 :            : 
     975         [ +  - ]:         66 :             maCurrentShapesIter = maShapesInfos.find( xShapes );
     976                 :            : 
     977                 :         66 :             DBG_ASSERT( maCurrentShapesIter != maShapesInfos.end(), "XMLShapeExport::seekShapes(): insert into stl::map failed" );
     978                 :            :         }
     979                 :            : 
     980                 :            :         DBG_ASSERT( (*maCurrentShapesIter).second.size() == (ShapesInfos::size_type)xShapes->getCount(), "XMLShapeExport::seekShapes(): XShapes size varied between calls" );
     981                 :            : 
     982                 :            :     }
     983                 :            :     else
     984                 :            :     {
     985                 :          0 :         maCurrentShapesIter = maShapesInfos.end();
     986                 :            :     }
     987                 :         90 : }
     988                 :            : 
     989                 :            : ///////////////////////////////////////////////////////////////////////
     990                 :            : 
     991                 :         75 : void XMLShapeExport::exportAutoStyles()
     992                 :            : {
     993                 :            :     // export all autostyle infos
     994                 :            : 
     995                 :            :     // ...for graphic
     996                 :            :     {
     997                 :         75 :         GetExport().GetAutoStylePool()->exportXML(
     998                 :            :             XML_STYLE_FAMILY_SD_GRAPHICS_ID
     999                 :         75 :             , GetExport().GetDocHandler(),
    1000                 :         75 :             GetExport().GetMM100UnitConverter(),
    1001                 :         75 :             GetExport().GetNamespaceMap()
    1002 [ +  - ][ +  - ]:         75 :             );
    1003                 :            :     }
    1004                 :            : 
    1005                 :            :     // ...for presentation
    1006                 :            :     {
    1007                 :         75 :         GetExport().GetAutoStylePool()->exportXML(
    1008                 :            :             XML_STYLE_FAMILY_SD_PRESENTATION_ID
    1009                 :         75 :             , GetExport().GetDocHandler(),
    1010                 :         75 :             GetExport().GetMM100UnitConverter(),
    1011                 :         75 :             GetExport().GetNamespaceMap()
    1012 [ +  - ][ +  - ]:         75 :             );
    1013                 :            :     }
    1014                 :            : 
    1015         [ +  - ]:         75 :     if( mxShapeTableExport.is() )
    1016                 :         75 :         mxShapeTableExport->exportAutoStyles();
    1017                 :         75 : }
    1018                 :            : 
    1019                 :            : ///////////////////////////////////////////////////////////////////////
    1020                 :            : 
    1021                 :            : /// returns the export property mapper for external chaining
    1022                 :        171 : SvXMLExportPropertyMapper* XMLShapeExport::CreateShapePropMapper(
    1023                 :            :     SvXMLExport& rExport )
    1024                 :            : {
    1025 [ +  - ][ +  - ]:        171 :     UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rExport.GetModel(), rExport );
                 [ +  - ]
    1026 [ +  - ][ +  - ]:        171 :     UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory );
                 [ +  - ]
    1027                 :            :     SvXMLExportPropertyMapper* pResult =
    1028 [ +  - ][ +  - ]:        171 :         new XMLShapeExportPropertyMapper( xMapper, rExport );
    1029                 :            :     // chain text attributes
    1030 [ +  - ][ +  - ]:        171 :     return pResult;
    1031                 :            : }
    1032                 :            : 
    1033                 :            : ///////////////////////////////////////////////////////////////////////
    1034                 :            : 
    1035                 :        100 : void XMLShapeExport::ImpCalcShapeType(const uno::Reference< drawing::XShape >& xShape,
    1036                 :            :     XmlShapeType& eShapeType)
    1037                 :            : {
    1038                 :            :     // set in every case, so init here
    1039                 :        100 :     eShapeType = XmlShapeTypeUnknown;
    1040                 :            : 
    1041         [ +  - ]:        100 :     uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor(xShape, uno::UNO_QUERY);
    1042         [ +  - ]:        100 :     if(xShapeDescriptor.is())
    1043                 :            :     {
    1044 [ +  - ][ +  - ]:        100 :         String aType((OUString)xShapeDescriptor->getShapeType());
                 [ +  - ]
    1045                 :            : 
    1046 [ +  - ][ +  - ]:        100 :         if(aType.EqualsAscii((const sal_Char*)"com.sun.star.", 0, 13))
    1047                 :            :         {
    1048 [ +  - ][ -  + ]:        100 :             if(aType.EqualsAscii("drawing.", 13, 8))
    1049                 :            :             {
    1050                 :            :                 // drawing shapes
    1051 [ #  # ][ #  # ]:          0 :                 if     (aType.EqualsAscii("Rectangle", 21, 9)) { eShapeType = XmlShapeTypeDrawRectangleShape; }
    1052                 :            : 
    1053                 :            :                 // #i72177# Note: Correcting CustomShape, CustomShape->Custom, len from 9 (was wrong anyways) to 6.
    1054                 :            :                 // As can be seen at the other compares, the appendix "Shape" is left out of the comparison.
    1055 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Custom", 21, 6)) { eShapeType = XmlShapeTypeDrawCustomShape; }
    1056                 :            : 
    1057 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Ellipse", 21, 7)) { eShapeType = XmlShapeTypeDrawEllipseShape; }
    1058 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Control", 21, 7)) { eShapeType = XmlShapeTypeDrawControlShape; }
    1059 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Connector", 21, 9)) { eShapeType = XmlShapeTypeDrawConnectorShape; }
    1060 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Measure", 21, 7)) { eShapeType = XmlShapeTypeDrawMeasureShape; }
    1061 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Line", 21, 4)) { eShapeType = XmlShapeTypeDrawLineShape; }
    1062                 :            : 
    1063                 :            :                 // #i72177# Note: This covers two types by purpose, PolyPolygonShape and PolyPolygonPathShape
    1064 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("PolyPolygon", 21, 11)) { eShapeType = XmlShapeTypeDrawPolyPolygonShape; }
    1065                 :            : 
    1066                 :            :                 // #i72177# Note: This covers two types by purpose, PolyLineShape and PolyLinePathShape
    1067 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("PolyLine", 21, 8)) { eShapeType = XmlShapeTypeDrawPolyLineShape; }
    1068                 :            : 
    1069 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("OpenBezier", 21, 10)) { eShapeType = XmlShapeTypeDrawOpenBezierShape; }
    1070 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("ClosedBezier", 21, 12)) { eShapeType = XmlShapeTypeDrawClosedBezierShape; }
    1071                 :            : 
    1072                 :            :                 // #i72177# FreeHand (opened and closed) now supports the types OpenFreeHandShape and
    1073                 :            :                 // ClosedFreeHandShape respectively. Represent them as bezier shapes
    1074 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("OpenFreeHand", 21, 12)) { eShapeType = XmlShapeTypeDrawOpenBezierShape; }
    1075 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("ClosedFreeHand", 21, 14)) { eShapeType = XmlShapeTypeDrawClosedBezierShape; }
    1076                 :            : 
    1077 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("GraphicObject", 21, 13)) { eShapeType = XmlShapeTypeDrawGraphicObjectShape; }
    1078 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Group", 21, 5)) { eShapeType = XmlShapeTypeDrawGroupShape; }
    1079 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Text", 21, 4)) { eShapeType = XmlShapeTypeDrawTextShape; }
    1080 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("OLE2", 21, 4))
    1081                 :            :                 {
    1082                 :          0 :                     eShapeType = XmlShapeTypeDrawOLE2Shape;
    1083                 :            : 
    1084                 :            :                     // get info about presentation shape
    1085         [ #  # ]:          0 :                     uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
    1086                 :            : 
    1087         [ #  # ]:          0 :                     if(xPropSet.is())
    1088                 :            :                     {
    1089                 :          0 :                         rtl::OUString sCLSID;
    1090 [ #  # ][ #  # ]:          0 :                         if(xPropSet->getPropertyValue(OUString("CLSID")) >>= sCLSID)
                 [ #  # ]
    1091                 :            :                         {
    1092 [ #  # ][ #  # ]:          0 :                             if (sCLSID.equals(mrExport.GetChartExport()->getChartCLSID()))
         [ #  # ][ #  # ]
                 [ #  # ]
    1093                 :            :                             {
    1094                 :          0 :                                 eShapeType = XmlShapeTypeDrawChartShape;
    1095                 :            :                             }
    1096         [ #  # ]:          0 :                             else if (
           [ #  #  #  # ]
    1097 [ #  # ][ #  # ]:          0 :                                 sCLSID.equals(rtl::OUString( SvGlobalName( SO3_SC_CLASSID ).GetHexName()))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    1098                 :            :                                 // #110680#
    1099                 :            :                                 // same reaction for binfilter
    1100 [ #  # ][ #  # ]:          0 :                                 || sCLSID.equals(rtl::OUString( SvGlobalName( BF_SO3_SC_CLASSID ).GetHexName()))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    1101                 :            :                                 )
    1102                 :            :                             {
    1103                 :          0 :                                 eShapeType = XmlShapeTypeDrawSheetShape;
    1104                 :            :                             }
    1105                 :            :                             else
    1106                 :            :                             {
    1107                 :            :                                 // general OLE2 Object
    1108                 :            :                             }
    1109                 :          0 :                         }
    1110                 :          0 :                     }
    1111                 :            :                 }
    1112 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Page", 21, 4)) { eShapeType = XmlShapeTypeDrawPageShape; }
    1113 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Frame", 21, 5)) { eShapeType = XmlShapeTypeDrawFrameShape; }
    1114 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Caption", 21, 7)) { eShapeType = XmlShapeTypeDrawCaptionShape; }
    1115 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Plugin", 21, 6)) { eShapeType = XmlShapeTypeDrawPluginShape; }
    1116 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Applet", 21, 6)) { eShapeType = XmlShapeTypeDrawAppletShape; }
    1117 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("MediaShape", 21, 10)) { eShapeType = XmlShapeTypeDrawMediaShape; }
    1118 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("TableShape", 21, 10)) { eShapeType = XmlShapeTypeDrawTableShape; }
    1119                 :            : 
    1120                 :            :                 // 3D shapes
    1121 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Scene", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DSceneObject; }
    1122 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Cube", 21 + 7, 4)) { eShapeType = XmlShapeTypeDraw3DCubeObject; }
    1123 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Sphere", 21 + 7, 6)) { eShapeType = XmlShapeTypeDraw3DSphereObject; }
    1124 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Lathe", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DLatheObject; }
    1125 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("Extrude", 21 + 7, 7)) { eShapeType = XmlShapeTypeDraw3DExtrudeObject; }
    1126                 :            :             }
    1127 [ +  - ][ +  - ]:        100 :             else if(aType.EqualsAscii("presentation.", 13, 13))
    1128                 :            :             {
    1129                 :            :                 // presentation shapes
    1130 [ +  - ][ +  + ]:        100 :                 if     (aType.EqualsAscii("TitleText", 26, 9)) { eShapeType = XmlShapeTypePresTitleTextShape; }
    1131 [ +  - ][ +  + ]:         92 :                 else if(aType.EqualsAscii("Outliner", 26, 8)) { eShapeType = XmlShapeTypePresOutlinerShape;  }
    1132 [ +  - ][ +  + ]:         88 :                 else if(aType.EqualsAscii("Subtitle", 26, 8)) { eShapeType = XmlShapeTypePresSubtitleShape;  }
    1133 [ +  - ][ -  + ]:         84 :                 else if(aType.EqualsAscii("GraphicObject", 26, 13)) { eShapeType = XmlShapeTypePresGraphicObjectShape;  }
    1134 [ +  - ][ +  + ]:         84 :                 else if(aType.EqualsAscii("Page", 26, 4)) { eShapeType = XmlShapeTypePresPageShape;  }
    1135 [ +  - ][ -  + ]:         76 :                 else if(aType.EqualsAscii("OLE2", 26, 4))
    1136                 :            :                 {
    1137                 :          0 :                     eShapeType = XmlShapeTypePresOLE2Shape;
    1138                 :            : 
    1139                 :            :                     // get info about presentation shape
    1140         [ #  # ]:          0 :                     uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
    1141                 :            : 
    1142         [ #  # ]:          0 :                     if(xPropSet.is()) try
    1143                 :            :                     {
    1144                 :          0 :                         rtl::OUString sCLSID;
    1145 [ #  # ][ #  # ]:          0 :                         if(xPropSet->getPropertyValue(OUString("CLSID")) >>= sCLSID)
                 [ #  # ]
    1146                 :            :                         {
    1147 [ #  # ][ #  # ]:          0 :                             if( sCLSID.equals(rtl::OUString( SvGlobalName( SO3_SC_CLASSID ).GetHexName())) ||
                 [ #  # ]
           [ #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
          #  #  #  #  #  
                      # ]
    1148 [ #  # ][ #  # ]:          0 :                                 sCLSID.equals(rtl::OUString( SvGlobalName( BF_SO3_SC_CLASSID ).GetHexName())) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    1149                 :            :                             {
    1150                 :          0 :                                 eShapeType = XmlShapeTypePresSheetShape;
    1151                 :            :                             }
    1152         [ #  # ]:          0 :                         }
    1153                 :            :                     }
    1154         [ #  # ]:          0 :                     catch(const uno::Exception&)
    1155                 :            :                     {
    1156                 :            :                         OSL_FAIL( "XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" );
    1157                 :          0 :                     }
    1158                 :            :                 }
    1159 [ +  - ][ -  + ]:         76 :                 else if(aType.EqualsAscii("Chart", 26, 5)) { eShapeType = XmlShapeTypePresChartShape;  }
    1160 [ +  - ][ -  + ]:         76 :                 else if(aType.EqualsAscii("OrgChart", 26, 8)) { eShapeType = XmlShapeTypePresOrgChartShape;  }
    1161 [ +  - ][ -  + ]:         76 :                 else if(aType.EqualsAscii("CalcShape", 26, 9)) { eShapeType = XmlShapeTypePresSheetShape; }
    1162 [ +  - ][ -  + ]:         76 :                 else if(aType.EqualsAscii("TableShape", 26, 10)) { eShapeType = XmlShapeTypePresTableShape; }
    1163 [ +  - ][ +  + ]:         76 :                 else if(aType.EqualsAscii("Notes", 26, 5)) { eShapeType = XmlShapeTypePresNotesShape;  }
    1164 [ +  - ][ +  + ]:         68 :                 else if(aType.EqualsAscii("HandoutShape", 26, 12)) { eShapeType = XmlShapeTypeHandoutShape; }
    1165 [ +  - ][ +  + ]:         44 :                 else if(aType.EqualsAscii("HeaderShape", 26, 11)) { eShapeType = XmlShapeTypePresHeaderShape; }
    1166 [ +  - ][ +  + ]:         36 :                 else if(aType.EqualsAscii("FooterShape", 26, 11)) { eShapeType = XmlShapeTypePresFooterShape; }
    1167 [ +  - ][ +  + ]:         24 :                 else if(aType.EqualsAscii("SlideNumberShape", 26, 16)) { eShapeType = XmlShapeTypePresSlideNumberShape; }
    1168 [ +  - ][ +  - ]:         12 :                 else if(aType.EqualsAscii("DateTimeShape", 26, 13)) { eShapeType = XmlShapeTypePresDateTimeShape; }
    1169 [ #  # ][ #  # ]:          0 :                 else if(aType.EqualsAscii("MediaShape", 26, 10)) { eShapeType = XmlShapeTypePresMediaShape; }
    1170                 :            :             }
    1171         [ +  - ]:        100 :         }
    1172                 :        100 :     }
    1173                 :        100 : }
    1174                 :            : 
    1175                 :            : ///////////////////////////////////////////////////////////////////////
    1176                 :            : 
    1177                 :            : extern SvXMLEnumMapEntry aXML_GlueAlignment_EnumMap[];
    1178                 :            : extern SvXMLEnumMapEntry aXML_GlueEscapeDirection_EnumMap[];
    1179                 :            : 
    1180                 :            : /** exports all user defined glue points */
    1181                 :         68 : void XMLShapeExport::ImpExportGluePoints( const uno::Reference< drawing::XShape >& xShape )
    1182                 :            : {
    1183         [ +  - ]:         68 :     uno::Reference< drawing::XGluePointsSupplier > xSupplier( xShape, uno::UNO_QUERY );
    1184         [ -  + ]:         68 :     if( !xSupplier.is() )
    1185                 :            :         return;
    1186                 :            : 
    1187 [ +  - ][ +  - ]:         68 :     uno::Reference< container::XIdentifierAccess > xGluePoints( xSupplier->getGluePoints(), uno::UNO_QUERY );
                 [ +  - ]
    1188         [ -  + ]:         68 :     if( !xGluePoints.is() )
    1189                 :            :         return;
    1190                 :            : 
    1191                 :         68 :     drawing::GluePoint2 aGluePoint;
    1192                 :            : 
    1193 [ +  - ][ +  - ]:         68 :     uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() );
    1194                 :            : 
    1195                 :         68 :     const sal_Int32 nCount = aIdSequence.getLength();
    1196         [ +  + ]:        340 :     for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
    1197                 :            :     {
    1198         [ +  - ]:        272 :         const sal_Int32 nIdentifier = aIdSequence[nIndex];
    1199 [ +  - ][ +  - ]:        272 :         if( (xGluePoints->getByIdentifier( nIdentifier ) >>= aGluePoint) && aGluePoint.IsUserDefined )
         [ +  - ][ +  - ]
         [ -  + ][ +  - ]
           [ -  +  #  # ]
    1200                 :            :         {
    1201                 :            :             // export only user defined glue points
    1202                 :            : 
    1203                 :          0 :             const OUString sId( OUString::valueOf( nIdentifier ) );
    1204         [ #  # ]:          0 :             mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_ID, sId );
    1205                 :            : 
    1206                 :          0 :             mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer,
    1207         [ #  # ]:          0 :                     aGluePoint.Position.X);
    1208 [ #  # ][ #  # ]:          0 :             mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, msBuffer.makeStringAndClear());
    1209                 :            : 
    1210                 :          0 :             mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer,
    1211         [ #  # ]:          0 :                     aGluePoint.Position.Y);
    1212 [ #  # ][ #  # ]:          0 :             mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, msBuffer.makeStringAndClear());
    1213                 :            : 
    1214         [ #  # ]:          0 :             if( !aGluePoint.IsRelative )
    1215                 :            :             {
    1216         [ #  # ]:          0 :                 SvXMLUnitConverter::convertEnum( msBuffer, aGluePoint.PositionAlignment, aXML_GlueAlignment_EnumMap );
    1217 [ #  # ][ #  # ]:          0 :                 mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ALIGN, msBuffer.makeStringAndClear() );
    1218                 :            :             }
    1219                 :            : 
    1220         [ #  # ]:          0 :             if( aGluePoint.Escape != drawing::EscapeDirection_SMART )
    1221                 :            :             {
    1222         [ #  # ]:          0 :                 SvXMLUnitConverter::convertEnum( msBuffer, aGluePoint.Escape, aXML_GlueEscapeDirection_EnumMap );
    1223 [ #  # ][ #  # ]:          0 :                 mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ESCAPE_DIRECTION, msBuffer.makeStringAndClear() );
    1224                 :            :             }
    1225                 :            : 
    1226 [ #  # ][ #  # ]:          0 :             SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_DRAW, XML_GLUE_POINT, sal_True, sal_True);
    1227                 :            :         }
    1228 [ +  - ][ -  + ]:         68 :     }
                 [ +  - ]
    1229                 :            : }
    1230                 :            : 
    1231                 :         33 : void XMLShapeExport::ExportGraphicDefaults()
    1232                 :            : {
    1233 [ +  - ][ +  - ]:         33 :     XMLStyleExport aStEx(mrExport, OUString(), mrExport.GetAutoStylePool().get());
                 [ +  - ]
    1234                 :            : 
    1235                 :            :     // construct PropertySetMapper
    1236 [ +  - ][ +  - ]:         33 :     UniReference< SvXMLExportPropertyMapper > xPropertySetMapper( CreateShapePropMapper( mrExport ) );
    1237                 :         33 :     ((XMLShapeExportPropertyMapper*)xPropertySetMapper.get())->SetAutoStyles( sal_False );
    1238                 :            : 
    1239                 :            :     // chain text attributes
    1240 [ +  - ][ +  - ]:         33 :     xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(mrExport));
         [ +  - ][ +  - ]
                 [ +  - ]
    1241                 :            : 
    1242                 :            :     // chain special Writer/text frame default attributes
    1243 [ +  - ][ +  - ]:         33 :     xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaDefaultExtPropMapper(mrExport));
         [ +  - ][ +  - ]
                 [ +  - ]
    1244                 :            : 
    1245                 :            :     // write graphic family default style
    1246         [ +  - ]:         33 :     uno::Reference< lang::XMultiServiceFactory > xFact( mrExport.GetModel(), uno::UNO_QUERY );
    1247         [ +  - ]:         33 :     if( xFact.is() )
    1248                 :            :     {
    1249                 :            :         try
    1250                 :            :         {
    1251 [ +  - ][ +  - ]:         33 :             uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance( OUString("com.sun.star.drawing.Defaults" ) ), uno::UNO_QUERY );
                 [ +  - ]
    1252         [ +  - ]:         33 :             if( xDefaults.is() )
    1253                 :            :             {
    1254         [ +  - ]:         33 :                 aStEx.exportDefaultStyle( xDefaults, OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xPropertySetMapper );
    1255                 :            : 
    1256                 :            :                 // write graphic family styles
    1257         [ +  - ]:         33 :                 aStEx.exportStyleFamily("graphics", OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME), xPropertySetMapper, sal_False, XML_STYLE_FAMILY_SD_GRAPHICS_ID);
    1258         [ #  # ]:         33 :             }
    1259                 :            :         }
    1260         [ #  # ]:          0 :         catch(const lang::ServiceNotRegisteredException&)
    1261                 :            :         {
    1262                 :            :         }
    1263 [ +  - ][ +  - ]:         33 :     }
    1264                 :         33 : }
    1265                 :            : 
    1266                 :        100 : void XMLShapeExport::onExport( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& )
    1267                 :            : {
    1268                 :        100 : }
    1269                 :            : 
    1270                 :        119 : const rtl::Reference< XMLTableExport >& XMLShapeExport::GetShapeTableExport()
    1271                 :            : {
    1272         [ +  + ]:        119 :     if( !mxShapeTableExport.is() )
    1273                 :            :     {
    1274 [ +  - ][ +  - ]:        107 :         rtl::Reference< XMLPropertyHandlerFactory > xFactory( new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport ) );
                 [ +  - ]
    1275 [ +  - ][ +  - ]:        107 :         UniReference < XMLPropertySetMapper > xMapper( new XMLShapePropertySetMapper( xFactory.get() ) );
         [ +  - ][ +  - ]
                 [ +  - ]
    1276 [ +  - ][ +  - ]:        107 :         rtl::Reference< SvXMLExportPropertyMapper > xPropertySetMapper( new XMLShapeExportPropertyMapper( xMapper, mrExport ) );
                 [ +  - ]
    1277 [ +  - ][ +  - ]:        107 :         mxShapeTableExport = new XMLTableExport( mrExport, xPropertySetMapper, xFactory );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1278                 :            :     }
    1279                 :            : 
    1280                 :        119 :     return mxShapeTableExport;
    1281                 :            : }
    1282                 :            : 
    1283                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10