LCOV - code coverage report
Current view: top level - xmloff/source/draw - eventimp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 205 0.0 %
Date: 2012-08-25 Functions: 0 27 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 339 0.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 <tools/debug.hxx>
      31                 :            : #include <com/sun/star/document/XEventsSupplier.hpp>
      32                 :            : #include <com/sun/star/container/XNameReplace.hpp>
      33                 :            : #include <com/sun/star/presentation/AnimationSpeed.hpp>
      34                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      35                 :            : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      36                 :            : #include <com/sun/star/presentation/ClickAction.hpp>
      37                 :            : #include <tools/urlobj.hxx>
      38                 :            : #include <comphelper/extract.hxx>
      39                 :            : 
      40                 :            : #include <sax/tools/converter.hxx>
      41                 :            : 
      42                 :            : #include <xmloff/xmltoken.hxx>
      43                 :            : #include <xmloff/xmlimp.hxx>
      44                 :            : #include "xmloff/xmlnmspe.hxx"
      45                 :            : #include <xmloff/xmluconv.hxx>
      46                 :            : #include <xmloff/nmspmap.hxx>
      47                 :            : #include "eventimp.hxx"
      48                 :            : #include "anim.hxx"
      49                 :            : 
      50                 :            : using ::rtl::OUString;
      51                 :            : using ::rtl::OUStringBuffer;
      52                 :            : 
      53                 :            : using namespace ::std;
      54                 :            : using namespace ::cppu;
      55                 :            : using namespace ::com::sun::star;
      56                 :            : using namespace ::com::sun::star::xml;
      57                 :            : using namespace ::com::sun::star::xml::sax;
      58                 :            : using namespace ::com::sun::star::uno;
      59                 :            : using namespace ::com::sun::star::drawing;
      60                 :            : using namespace ::com::sun::star::beans;
      61                 :            : using namespace ::com::sun::star::lang;
      62                 :            : using namespace ::com::sun::star::document;
      63                 :            : using namespace ::com::sun::star::container;
      64                 :            : using namespace ::com::sun::star::presentation;
      65                 :            : using namespace ::xmloff::token;
      66                 :            : 
      67                 :            : ///////////////////////////////////////////////////////////////////////
      68                 :            : 
      69                 :            : SvXMLEnumMapEntry const aXML_EventActions_EnumMap[] =
      70                 :            : {
      71                 :            :     { XML_NONE,             ClickAction_NONE    },
      72                 :            :     { XML_PREVIOUS_PAGE,    ClickAction_PREVPAGE },
      73                 :            :     { XML_NEXT_PAGE,        ClickAction_NEXTPAGE },
      74                 :            :     { XML_FIRST_PAGE,       ClickAction_FIRSTPAGE },
      75                 :            :     { XML_LAST_PAGE,        ClickAction_LASTPAGE },
      76                 :            :     { XML_HIDE,             ClickAction_INVISIBLE },
      77                 :            :     { XML_STOP,             ClickAction_STOPPRESENTATION },
      78                 :            :     { XML_EXECUTE,          ClickAction_PROGRAM },
      79                 :            :     { XML_SHOW,             ClickAction_BOOKMARK },
      80                 :            :     { XML_SHOW,             ClickAction_DOCUMENT },
      81                 :            :     { XML_EXECUTE_MACRO,    ClickAction_MACRO },
      82                 :            :     { XML_VERB,             ClickAction_VERB },
      83                 :            :     { XML_FADE_OUT,         ClickAction_VANISH },
      84                 :            :     { XML_SOUND,            ClickAction_SOUND },
      85                 :            :     { XML_TOKEN_INVALID, 0 }
      86                 :            : };
      87                 :            : 
      88                 :            : ///////////////////////////////////////////////////////////////////////
      89                 :            : 
      90                 :            : class SdXMLEventContext : public SvXMLImportContext
      91                 :            : {
      92                 :            : private:
      93                 :            :     com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
      94                 :            : 
      95                 :            : public:
      96                 :            :     TYPEINFO();
      97                 :            : 
      98                 :            :     SdXMLEventContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList, const Reference< XShape >& rxShape );
      99                 :            :     virtual ~SdXMLEventContext();
     100                 :            : 
     101                 :            :     virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName,    const Reference< XAttributeList>& xAttrList );
     102                 :            :     virtual void EndElement();
     103                 :            : 
     104                 :            :     sal_Bool mbValid;
     105                 :            :     sal_Bool mbScript;
     106                 :            :     ClickAction meClickAction;
     107                 :            :     XMLEffect meEffect;
     108                 :            :     XMLEffectDirection meDirection;
     109                 :            :     sal_Int16 mnStartScale;
     110                 :            :     AnimationSpeed meSpeed;
     111                 :            :     sal_Int32 mnVerb;
     112                 :            :     OUString msSoundURL;
     113                 :            :     sal_Bool mbPlayFull;
     114                 :            :     OUString msMacroName;
     115                 :            :     OUString msBookmark;
     116                 :            :     OUString msLanguage;
     117                 :            : };
     118                 :            : 
     119                 :            : ///////////////////////////////////////////////////////////////////////
     120                 :            : 
     121                 :            : class XMLEventSoundContext : public SvXMLImportContext
     122                 :            : {
     123                 :            :     SdXMLEventContext*  mpParent;
     124                 :            : 
     125                 :            : public:
     126                 :            :     TYPEINFO();
     127                 :            : 
     128                 :            :     XMLEventSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent );
     129                 :            :     virtual ~XMLEventSoundContext();
     130                 :            : };
     131                 :            : 
     132 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLEventSoundContext, SvXMLImportContext );
     133                 :            : 
     134                 :          0 : XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent )
     135                 :          0 : : SvXMLImportContext( rImp, nPrfx, rLocalName ), mpParent( pParent )
     136                 :            : {
     137 [ #  # ][ #  # ]:          0 :     if( mpParent && nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SOUND ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     138                 :            :     {
     139 [ #  # ][ #  # ]:          0 :         const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ #  # ]
     140         [ #  # ]:          0 :         for(sal_Int16 i=0; i < nAttrCount; i++)
     141                 :            :         {
     142 [ #  # ][ #  # ]:          0 :             OUString sAttrName = xAttrList->getNameByIndex( i );
     143                 :          0 :             OUString aAttrLocalName;
     144         [ #  # ]:          0 :             sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aAttrLocalName );
     145 [ #  # ][ #  # ]:          0 :             OUString sValue = xAttrList->getValueByIndex( i );
     146                 :            : 
     147      [ #  #  # ]:          0 :             switch( nAttrPrefix )
     148                 :            :             {
     149                 :            :             case XML_NAMESPACE_XLINK:
     150 [ #  # ][ #  # ]:          0 :                 if( IsXMLToken( aAttrLocalName, XML_HREF ) )
     151                 :            :                 {
     152         [ #  # ]:          0 :                     mpParent->msSoundURL = rImp.GetAbsoluteReference(sValue);
     153                 :            :                 }
     154                 :          0 :                 break;
     155                 :            :             case XML_NAMESPACE_PRESENTATION:
     156 [ #  # ][ #  # ]:          0 :                 if( IsXMLToken( aAttrLocalName, XML_PLAY_FULL ) )
     157                 :            :                 {
     158         [ #  # ]:          0 :                     mpParent->mbPlayFull = IsXMLToken( sValue, XML_TRUE );
     159                 :            :                 }
     160                 :            :             }
     161                 :          0 :         }
     162                 :            :     }
     163                 :          0 : }
     164                 :            : 
     165                 :          0 : XMLEventSoundContext::~XMLEventSoundContext()
     166                 :            : {
     167         [ #  # ]:          0 : }
     168                 :            : 
     169                 :            : ///////////////////////////////////////////////////////////////////////
     170                 :            : 
     171 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLEventContext, SvXMLImportContext );
     172                 :            : 
     173                 :          0 : SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp,  sal_uInt16 nPrfx, const OUString& rLocalName,  const Reference< XAttributeList >& xAttrList, const Reference< XShape >& rxShape )
     174                 :            : :   SvXMLImportContext(rImp, nPrfx, rLocalName),
     175                 :            :     mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ),
     176                 :            :     meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
     177                 :          0 :     meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False )
     178                 :            : {
     179 [ #  # ][ #  # ]:          0 :     static const OUString sXMLClickName( RTL_CONSTASCII_USTRINGPARAM( "click" ) );
         [ #  # ][ #  # ]
     180                 :            : 
     181 [ #  # ][ #  # ]:          0 :     if( nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
         [ #  # ][ #  # ]
     182                 :            :     {
     183                 :          0 :         mbValid = sal_True;
     184                 :            :     }
     185 [ #  # ][ #  # ]:          0 :     else if( nPrfx == XML_NAMESPACE_SCRIPT && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
         [ #  # ][ #  # ]
     186                 :            :     {
     187                 :          0 :         mbScript = sal_True;
     188                 :          0 :         mbValid = sal_True;
     189                 :            :     }
     190                 :            :     else
     191                 :            :     {
     192                 :          0 :         return;
     193                 :            :     }
     194                 :            : 
     195                 :            :     // read attributes
     196                 :          0 :     OUString sEventName;
     197 [ #  # ][ #  # ]:          0 :     const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ #  # ]
     198 [ #  # ][ #  # ]:          0 :     for(sal_Int16 i=0; (i < nAttrCount) && mbValid; i++)
                 [ #  # ]
     199                 :            :     {
     200 [ #  # ][ #  # ]:          0 :         OUString sAttrName = xAttrList->getNameByIndex( i );
     201                 :          0 :         OUString aAttrLocalName;
     202         [ #  # ]:          0 :         sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aAttrLocalName );
     203 [ #  # ][ #  # ]:          0 :         OUString sValue = xAttrList->getValueByIndex( i );
     204                 :            : 
     205   [ #  #  #  # ]:          0 :         switch( nAttrPrefix )
     206                 :            :         {
     207                 :            :         case XML_NAMESPACE_PRESENTATION:
     208 [ #  # ][ #  # ]:          0 :             if( IsXMLToken( aAttrLocalName, XML_ACTION ) )
     209                 :            :             {
     210                 :            :                 sal_uInt16 eEnum;
     211 [ #  # ][ #  # ]:          0 :                 if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_EventActions_EnumMap ) )
     212                 :          0 :                     meClickAction = (ClickAction)eEnum;
     213                 :            :             }
     214 [ #  # ][ #  # ]:          0 :             if( IsXMLToken( aAttrLocalName, XML_EFFECT ) )
     215                 :            :             {
     216                 :            :                 sal_uInt16 eEnum;
     217 [ #  # ][ #  # ]:          0 :                 if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationEffect_EnumMap ) )
     218                 :          0 :                     meEffect = (XMLEffect)eEnum;
     219                 :            :             }
     220 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( aAttrLocalName, XML_DIRECTION ) )
     221                 :            :             {
     222                 :            :                 sal_uInt16 eEnum;
     223 [ #  # ][ #  # ]:          0 :                 if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationDirection_EnumMap ) )
     224                 :          0 :                     meDirection = (XMLEffectDirection)eEnum;
     225                 :            :             }
     226 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( aAttrLocalName, XML_START_SCALE ) )
     227                 :            :             {
     228                 :            :                 sal_Int32 nScale;
     229 [ #  # ][ #  # ]:          0 :                 if (::sax::Converter::convertPercent( nScale, sValue ))
     230                 :          0 :                     mnStartScale = (sal_Int16)nScale;
     231                 :            :             }
     232 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( aAttrLocalName, XML_SPEED ) )
     233                 :            :             {
     234                 :            :                 sal_uInt16 eEnum;
     235 [ #  # ][ #  # ]:          0 :                 if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationSpeed_EnumMap ) )
     236                 :          0 :                     meSpeed = (AnimationSpeed)eEnum;
     237                 :            :             }
     238 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( aAttrLocalName, XML_VERB ) )
     239                 :            :             {
     240         [ #  # ]:          0 :                 ::sax::Converter::convertNumber( mnVerb, sValue );
     241                 :            :             }
     242                 :          0 :             break;
     243                 :            : 
     244                 :            :         case XML_NAMESPACE_SCRIPT:
     245 [ #  # ][ #  # ]:          0 :             if( IsXMLToken( aAttrLocalName, XML_EVENT_NAME ) )
     246                 :            :             {
     247                 :          0 :                 sEventName = sValue;
     248                 :            :                 sal_uInt16 nScriptPrefix =
     249         [ #  # ]:          0 :                     GetImport().GetNamespaceMap().GetKeyByAttrName( sValue, &sEventName );
     250 [ #  # ][ #  # ]:          0 :                 mbValid = XML_NAMESPACE_DOM == nScriptPrefix && sEventName == sXMLClickName;
     251                 :            :             }
     252 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( aAttrLocalName, XML_LANGUAGE ) )
     253                 :            :             {
     254                 :            :                 // language is not evaluated!
     255                 :          0 :                 OUString aScriptLanguage;
     256                 :          0 :                 msLanguage = sValue;
     257                 :          0 :                 sal_uInt16 nScriptPrefix = rImp.GetNamespaceMap().
     258         [ #  # ]:          0 :                     GetKeyByAttrName( msLanguage, &aScriptLanguage );
     259         [ #  # ]:          0 :                 if( XML_NAMESPACE_OOO == nScriptPrefix )
     260                 :          0 :                     msLanguage = aScriptLanguage;
     261                 :            :             }
     262 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( aAttrLocalName, XML_MACRO_NAME ) )
     263                 :            :             {
     264                 :          0 :                 msMacroName = sValue;
     265                 :            :             }
     266                 :          0 :             break;
     267                 :            : 
     268                 :            :         case XML_NAMESPACE_XLINK:
     269 [ #  # ][ #  # ]:          0 :             if( IsXMLToken( aAttrLocalName, XML_HREF ) )
     270                 :            :             {
     271         [ #  # ]:          0 :                 if ( mbScript )
     272                 :            :                 {
     273                 :          0 :                     msMacroName = sValue;
     274                 :            :                 }
     275                 :            :                 else
     276                 :            :                 {
     277                 :            :                     const rtl::OUString &rTmp =
     278         [ #  # ]:          0 :                         rImp.GetAbsoluteReference(sValue);
     279                 :            :                     INetURLObject::translateToInternal( rTmp, msBookmark,
     280                 :            :                         INetURLObject::DECODE_UNAMBIGUOUS,
     281         [ #  # ]:          0 :                         RTL_TEXTENCODING_UTF8 );
     282                 :            :                 }
     283                 :            :             }
     284                 :          0 :             break;
     285                 :            :         }
     286                 :          0 :     }
     287                 :            : 
     288         [ #  # ]:          0 :     if( mbValid )
     289                 :          0 :         mbValid = !sEventName.isEmpty();
     290                 :            : }
     291                 :            : 
     292                 :          0 : SdXMLEventContext::~SdXMLEventContext()
     293                 :            : {
     294         [ #  # ]:          0 : }
     295                 :            : 
     296                 :          0 : SvXMLImportContext * SdXMLEventContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
     297                 :            : {
     298         [ #  # ]:          0 :     return new XMLEventSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
     299                 :            : }
     300                 :            : 
     301                 :          0 : void SdXMLEventContext::EndElement()
     302                 :            : {
     303         [ #  # ]:          0 :     if( !mbValid )
     304                 :          0 :         return;
     305                 :            : 
     306                 :            :     do
     307                 :            :     {
     308         [ #  # ]:          0 :         Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
     309         [ #  # ]:          0 :         if( !xEventsSupplier.is() )
     310                 :            :             break;
     311                 :            : 
     312 [ #  # ][ #  # ]:          0 :         Reference< XNameReplace > xEvents( xEventsSupplier->getEvents() );
     313                 :            :         DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
     314         [ #  # ]:          0 :         if( !xEvents.is() )
     315                 :            :             break;
     316                 :            : 
     317                 :          0 :         OUString sAPIEventName;
     318         [ #  # ]:          0 :         uno::Sequence< beans::PropertyValue > aProperties;
     319                 :            : 
     320         [ #  # ]:          0 :             sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
     321                 :            : 
     322         [ #  # ]:          0 :             if( mbScript )
     323                 :          0 :                 meClickAction = ClickAction_MACRO;
     324                 :            : 
     325                 :          0 :             sal_Int32 nPropertyCount = 2;
     326   [ #  #  #  #  :          0 :             switch( meClickAction )
                   #  # ]
     327                 :            :             {
     328                 :            :                 case ClickAction_NONE:
     329                 :            :                 case ClickAction_PREVPAGE:
     330                 :            :                 case ClickAction_NEXTPAGE:
     331                 :            :                 case ClickAction_FIRSTPAGE:
     332                 :            :                 case ClickAction_LASTPAGE:
     333                 :            :                 case ClickAction_INVISIBLE:
     334                 :            :                 case ClickAction_STOPPRESENTATION:
     335                 :          0 :                     break;
     336                 :            :                 case ClickAction_PROGRAM:
     337                 :            :                 case ClickAction_VERB:
     338                 :            :                 case ClickAction_BOOKMARK:
     339                 :            :                 case ClickAction_DOCUMENT:
     340                 :          0 :                     nPropertyCount += 1;
     341                 :          0 :                     break;
     342                 :            :                 case ClickAction_MACRO:
     343         [ #  # ]:          0 :                     if ( msLanguage.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("starbasic")) )
     344                 :          0 :                         nPropertyCount += 1;
     345                 :          0 :                     break;
     346                 :            : 
     347                 :            :                 case ClickAction_SOUND:
     348                 :          0 :                     nPropertyCount += 2;
     349                 :          0 :                     break;
     350                 :            : 
     351                 :            :                 case ClickAction_VANISH:
     352                 :          0 :                     nPropertyCount += 4;
     353                 :          0 :                     break;
     354                 :            :                 default:
     355                 :          0 :                     break;
     356                 :            :             }
     357                 :            : 
     358         [ #  # ]:          0 :             aProperties.realloc( nPropertyCount );
     359         [ #  # ]:          0 :             beans::PropertyValue* pProperties = aProperties.getArray();
     360                 :            : 
     361         [ #  # ]:          0 :             if( ClickAction_MACRO == meClickAction )
     362                 :            :             {
     363         [ #  # ]:          0 :                 if ( msLanguage.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("starbasic")) )
     364                 :            :                 {
     365                 :          0 :                     OUString sLibrary;
     366         [ #  # ]:          0 :                     const OUString& rApp = GetXMLToken( XML_APPLICATION );
     367         [ #  # ]:          0 :                     const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
     368   [ #  #  #  #  :          0 :                     if( msMacroName.getLength() > rApp.getLength()+1 &&
           #  # ][ #  # ]
     369         [ #  # ]:          0 :                         msMacroName.copy(0,rApp.getLength()).equalsIgnoreAsciiCase( rApp ) &&
     370                 :          0 :                         ':' == msMacroName[rApp.getLength()] )
     371                 :            :                     {
     372         [ #  # ]:          0 :                         sLibrary = OUString(RTL_CONSTASCII_USTRINGPARAM("StarOffice"));
     373                 :          0 :                         msMacroName = msMacroName.copy( rApp.getLength()+1 );
     374                 :            :                     }
     375   [ #  #  #  #  :          0 :                     else if( msMacroName.getLength() > rDoc.getLength()+1 &&
           #  # ][ #  # ]
     376         [ #  # ]:          0 :                         msMacroName.copy(0,rDoc.getLength()).equalsIgnoreAsciiCase( rDoc ) &&
     377                 :          0 :                         ':' == msMacroName[rDoc.getLength()] )
     378                 :            :                     {
     379                 :          0 :                         sLibrary = rDoc;
     380                 :          0 :                         msMacroName = msMacroName.copy( rDoc.getLength()+1 );
     381                 :            :                     }
     382                 :            : 
     383         [ #  # ]:          0 :                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
     384                 :          0 :                     pProperties->Handle = -1;
     385 [ #  # ][ #  # ]:          0 :                     pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("StarBasic") );
     386                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     387                 :          0 :                     pProperties++;
     388                 :            : 
     389         [ #  # ]:          0 :                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ) );
     390                 :          0 :                     pProperties->Handle = -1;
     391         [ #  # ]:          0 :                     pProperties->Value <<= msMacroName;
     392                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     393                 :          0 :                     pProperties++;
     394                 :            : 
     395         [ #  # ]:          0 :                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Library" ) );
     396                 :          0 :                     pProperties->Handle = -1;
     397         [ #  # ]:          0 :                     pProperties->Value <<= sLibrary;
     398                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     399                 :            :                 }
     400                 :            :                 else
     401                 :            :                 {
     402                 :            :                     pProperties->Name =
     403         [ #  # ]:          0 :                         OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
     404                 :          0 :                     pProperties->Handle = -1;
     405                 :            :                     pProperties->Value <<= OUString(
     406 [ #  # ][ #  # ]:          0 :                         RTL_CONSTASCII_USTRINGPARAM("Script") );
     407                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     408                 :          0 :                     pProperties++;
     409                 :            : 
     410                 :            :                     pProperties->Name = OUString(
     411         [ #  # ]:          0 :                         RTL_CONSTASCII_USTRINGPARAM( "Script" ) );
     412                 :          0 :                     pProperties->Handle = -1;
     413         [ #  # ]:          0 :                     pProperties->Value <<= msMacroName;
     414                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     415                 :            :                 }
     416                 :            :             }
     417                 :            :             else
     418                 :            :             {
     419         [ #  # ]:          0 :                 pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
     420                 :          0 :                 pProperties->Handle = -1;
     421 [ #  # ][ #  # ]:          0 :                 pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") );
     422                 :          0 :                 pProperties->State = beans::PropertyState_DIRECT_VALUE;
     423                 :          0 :                 pProperties++;
     424                 :            : 
     425                 :            :                 // ClickAction_BOOKMARK and ClickAction_DOCUMENT share the same xml event
     426                 :            :                 // so check here if its realy a bookmark or maybe a document
     427         [ #  # ]:          0 :                 if( meClickAction == ClickAction_BOOKMARK )
     428                 :            :                 {
     429         [ #  # ]:          0 :                     if( msBookmark.compareToAscii( "#", 1 ) != 0 )
     430                 :          0 :                         meClickAction = ClickAction_DOCUMENT;
     431                 :            :                 }
     432                 :            : 
     433         [ #  # ]:          0 :                 pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ClickAction") );
     434                 :          0 :                 pProperties->Handle = -1;
     435         [ #  # ]:          0 :                 pProperties->Value <<= meClickAction;
     436                 :          0 :                 pProperties->State = beans::PropertyState_DIRECT_VALUE;
     437                 :          0 :                 pProperties++;
     438                 :            : 
     439   [ #  #  #  #  :          0 :                 switch( meClickAction )
             #  #  #  # ]
     440                 :            :                 {
     441                 :            :                 case ClickAction_NONE:
     442                 :            :                 case ClickAction_PREVPAGE:
     443                 :            :                 case ClickAction_NEXTPAGE:
     444                 :            :                 case ClickAction_FIRSTPAGE:
     445                 :            :                 case ClickAction_LASTPAGE:
     446                 :            :                 case ClickAction_INVISIBLE:
     447                 :            :                 case ClickAction_STOPPRESENTATION:
     448                 :          0 :                     break;
     449                 :            : 
     450                 :            :                 case ClickAction_BOOKMARK:
     451                 :          0 :                     msBookmark = msBookmark.copy(1);
     452                 :            : 
     453                 :            :                     // Note: no break here!!!
     454                 :            : 
     455                 :            :                 case ClickAction_DOCUMENT:
     456                 :            :                 case ClickAction_PROGRAM:
     457         [ #  # ]:          0 :                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Bookmark") );
     458                 :          0 :                     pProperties->Handle = -1;
     459         [ #  # ]:          0 :                     pProperties->Value <<= msBookmark;
     460                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     461                 :          0 :                     break;
     462                 :            : 
     463                 :            :                 case ClickAction_VANISH:
     464         [ #  # ]:          0 :                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Effect") );
     465                 :          0 :                     pProperties->Handle = -1;
     466 [ #  # ][ #  # ]:          0 :                     pProperties->Value <<= ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, sal_True );
     467                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     468                 :          0 :                     pProperties++;
     469                 :            : 
     470         [ #  # ]:          0 :                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Speed") );
     471                 :          0 :                     pProperties->Handle = -1;
     472         [ #  # ]:          0 :                     pProperties->Value <<= meSpeed;
     473                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     474                 :          0 :                     pProperties++;
     475                 :            : 
     476                 :            :                     // NOTE: no break here!!!
     477                 :            : 
     478                 :            :                 case ClickAction_SOUND:
     479         [ #  # ]:          0 :                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("SoundURL") );
     480                 :          0 :                     pProperties->Handle = -1;
     481         [ #  # ]:          0 :                     pProperties->Value <<= msSoundURL;
     482                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     483                 :          0 :                     pProperties++;
     484                 :            : 
     485         [ #  # ]:          0 :                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PlayFull") );
     486                 :          0 :                     pProperties->Handle = -1;
     487         [ #  # ]:          0 :                     pProperties->Value = ::cppu::bool2any(mbPlayFull);
     488                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     489                 :          0 :                     break;
     490                 :            : 
     491                 :            :                 case ClickAction_VERB:
     492         [ #  # ]:          0 :                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Verb") );
     493                 :          0 :                     pProperties->Handle = -1;
     494         [ #  # ]:          0 :                     pProperties->Value <<= mnVerb;
     495                 :          0 :                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
     496                 :          0 :                     break;
     497                 :            :                 case ClickAction_MACRO:
     498                 :            :                     OSL_FAIL("xmloff::SdXMLEventContext::EndElement(), ClickAction_MACRO must be handled in different if case");
     499                 :          0 :                     break;
     500                 :            :                 default:
     501                 :          0 :                     break;
     502                 :            :                 }
     503                 :            :             }
     504 [ #  # ][ #  # ]:          0 :         xEvents->replaceByName( sAPIEventName, uno::Any( aProperties ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     505                 :            : 
     506                 :            :     } while(0);
     507                 :            : }
     508                 :            : 
     509                 :            : ///////////////////////////////////////////////////////////////////////
     510                 :            : 
     511 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLEventsContext, SvXMLImportContext );
     512                 :            : 
     513                 :          0 : SdXMLEventsContext::SdXMLEventsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
     514                 :            :         const Reference< XAttributeList>&, const Reference< XShape >& rxShape)
     515                 :          0 : : SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape )
     516                 :            : {
     517                 :          0 : }
     518                 :            : 
     519                 :          0 : SdXMLEventsContext::~SdXMLEventsContext()
     520                 :            : {
     521         [ #  # ]:          0 : }
     522                 :            : 
     523                 :          0 : SvXMLImportContext * SdXMLEventsContext::CreateChildContext( sal_uInt16 nPrfx, const ::rtl::OUString& rLocalName,
     524                 :            :         const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
     525                 :            : {
     526         [ #  # ]:          0 :     return new SdXMLEventContext( GetImport(), nPrfx, rLocalName,  xAttrList, mxShape );
     527                 :            : }
     528                 :            : 
     529                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10