From 9b4173c799c1e107404cd8c1265c87941d9998bf Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 7 Feb 2001 15:26:36 +0000 Subject: added interactions for presentation --- xmloff/source/draw/animexp.cxx | 13 +- xmloff/source/draw/animimp.cxx | 363 ++++++++++++------------- xmloff/source/draw/eventimp.cxx | 529 ++++++++++++++++++++++++++++++++++++ xmloff/source/draw/eventimp.hxx | 96 +++++++ xmloff/source/draw/makefile.mk | 5 +- xmloff/source/draw/shapeexport.cxx | 19 +- xmloff/source/draw/shapeexport2.cxx | 297 ++++++++++++++++++-- xmloff/source/draw/shapeexport3.cxx | 6 +- xmloff/source/draw/ximpshap.cxx | 47 ++-- 9 files changed, 1128 insertions(+), 247 deletions(-) create mode 100644 xmloff/source/draw/eventimp.cxx create mode 100644 xmloff/source/draw/eventimp.hxx (limited to 'xmloff/source/draw') diff --git a/xmloff/source/draw/animexp.cxx b/xmloff/source/draw/animexp.cxx index f6a1bf2179f6..9b6c6f5453ca 100644 --- a/xmloff/source/draw/animexp.cxx +++ b/xmloff/source/draw/animexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: animexp.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mh $ $Date: 2001-02-01 16:29:47 $ + * last change: $Author: cl $ $Date: 2001-02-07 16:26:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,9 +64,6 @@ #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include #endif -#ifndef _COM_SUN_STAR_PRESENTATION_ANIMATIONEFFECT_HPP_ -#include -#endif #ifndef _COM_SUN_STAR_PRESENTATION_ANIMATIONSPEED_HPP_ #include #endif @@ -300,7 +297,7 @@ const struct Effect { EK_move, ED_from_center, 400, sal_True } // AnimationEffect_ZOOM_OUT_FROM_CENTER }; -void setEffect( AnimationEffect eEffect, XMLEffect& eKind, XMLEffectDirection& eDirection, sal_Int16& nStartScale, sal_Bool& bIn ) +void SdXMLImplSetEffect( AnimationEffect eEffect, XMLEffect& eKind, XMLEffectDirection& eDirection, sal_Int16& nStartScale, sal_Bool& bIn ) { if( eEffect < AnimationEffect_NONE || eEffect > AnimationEffect_ZOOM_OUT_FROM_CENTER ) { @@ -434,7 +431,7 @@ void XMLAnimationsExporter::collect( Reference< XShape > xShape ) if( eEffect != AnimationEffect_NONE ) { sal_Bool bIn = sal_True; - setEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn ); + SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn ); aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE; @@ -461,7 +458,7 @@ void XMLAnimationsExporter::collect( Reference< XShape > xShape ) if( eEffect != AnimationEffect_NONE ) { sal_Bool bIn = sal_True; - setEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn ); + SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn ); aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE; aEffect.mbTextEffect = sal_True; diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx index 7171df5216db..8e6f9cf2ac19 100644 --- a/xmloff/source/draw/animimp.cxx +++ b/xmloff/source/draw/animimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: animimp.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mh $ $Date: 2001-02-01 16:29:47 $ + * last change: $Author: cl $ $Date: 2001-02-07 16:26:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -130,189 +130,54 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::presentation; -AnimationEffect getEffect( XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, sal_Bool bIn ) +AnimationEffect ImplSdXMLgetEffect( XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, sal_Bool bIn ) { - if( bIn ) + switch( eKind ) { - switch( eKind ) + case EK_fade: + switch( eDirection ) { - case EK_fade: - switch( eDirection ) - { - case ED_from_left: return AnimationEffect_FADE_FROM_LEFT; - case ED_from_top: return AnimationEffect_FADE_FROM_TOP; - case ED_from_right: return AnimationEffect_FADE_FROM_RIGHT; - case ED_from_bottom: return AnimationEffect_FADE_FROM_BOTTOM; - case ED_from_center: return AnimationEffect_FADE_FROM_CENTER; - case ED_from_upperleft: return AnimationEffect_FADE_FROM_UPPERLEFT; - case ED_from_upperright: return AnimationEffect_FADE_FROM_UPPERRIGHT; - case ED_from_lowerleft: return AnimationEffect_FADE_FROM_LOWERLEFT; - case ED_from_lowerright: return AnimationEffect_FADE_FROM_LOWERRIGHT; - case ED_to_center: return AnimationEffect_FADE_TO_CENTER; - case ED_clockwise: return AnimationEffect_CLOCKWISE; - case ED_cclockwise: return AnimationEffect_COUNTERCLOCKWISE; - case ED_spiral_inward_left: return AnimationEffect_SPIRALIN_LEFT; - case ED_spiral_inward_right:return AnimationEffect_SPIRALIN_RIGHT; - case ED_spiral_outward_left:return AnimationEffect_SPIRALOUT_LEFT; - case ED_spiral_outward_right:return AnimationEffect_SPIRALOUT_RIGHT; - } - return AnimationEffect_FADE_FROM_LEFT; - case EK_move: - if( nStartScale == 200 ) - { - return AnimationEffect_ZOOM_OUT_SMALL; - } - else if( nStartScale == 50 ) - { - return AnimationEffect_ZOOM_IN_SMALL; - } - else if( nStartScale < 100 ) - { - switch( eDirection ) - { - case ED_from_left: return AnimationEffect_ZOOM_IN_FROM_LEFT; - case ED_from_top: return AnimationEffect_ZOOM_IN_FROM_TOP; - case ED_from_right: return AnimationEffect_ZOOM_IN_FROM_RIGHT; - case ED_from_bottom: return AnimationEffect_ZOOM_IN_FROM_BOTTOM; - case ED_from_upperleft: return AnimationEffect_ZOOM_IN_FROM_UPPERLEFT; - case ED_from_upperright: return AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT; - case ED_from_lowerleft: return AnimationEffect_ZOOM_IN_FROM_LOWERLEFT; - case ED_from_lowerright: return AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT; - case ED_from_center: return AnimationEffect_ZOOM_IN_FROM_CENTER; - case ED_spiral_inward_left: return AnimationEffect_ZOOM_IN_SPIRAL; - } - return AnimationEffect_ZOOM_IN; - } - else if( nStartScale > 100 ) - { - switch( eDirection ) - { - case ED_from_left: return AnimationEffect_ZOOM_OUT_FROM_LEFT; - case ED_from_top: return AnimationEffect_ZOOM_OUT_FROM_TOP; - case ED_from_right: return AnimationEffect_ZOOM_OUT_FROM_RIGHT; - case ED_from_bottom: return AnimationEffect_ZOOM_OUT_FROM_BOTTOM; - case ED_from_upperleft: return AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT; - case ED_from_upperright: return AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT; - case ED_from_lowerleft: return AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT; - case ED_from_lowerright: return AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT; - case ED_from_center: return AnimationEffect_ZOOM_OUT_FROM_CENTER; - case ED_spiral_inward_left: return AnimationEffect_ZOOM_OUT_SPIRAL; - } - return AnimationEffect_ZOOM_OUT; - } - else - { - switch( eDirection ) - { - case ED_from_left: return AnimationEffect_MOVE_FROM_LEFT; - case ED_from_top: return AnimationEffect_MOVE_FROM_TOP; - case ED_from_right: return AnimationEffect_MOVE_FROM_RIGHT; - case ED_from_bottom: return AnimationEffect_MOVE_FROM_BOTTOM; - case ED_from_upperleft: return AnimationEffect_MOVE_FROM_UPPERLEFT; - case ED_from_upperright: return AnimationEffect_MOVE_FROM_UPPERRIGHT; - case ED_from_lowerleft: return AnimationEffect_MOVE_FROM_LOWERLEFT; - case ED_from_lowerright: return AnimationEffect_MOVE_FROM_LOWERRIGHT; - case ED_path: return AnimationEffect_PATH; - } - } - return AnimationEffect_MOVE_FROM_LEFT; - case EK_stripes: - if( eDirection == ED_vertical ) - return AnimationEffect_VERTICAL_STRIPES; - else - return AnimationEffect_HORIZONTAL_STRIPES; - case EK_open: - if( eDirection == ED_vertical ) - return AnimationEffect_OPEN_VERTICAL; - else - return AnimationEffect_OPEN_HORIZONTAL; - case EK_close: - if( eDirection == ED_vertical ) - return AnimationEffect_CLOSE_VERTICAL; - else - return AnimationEffect_CLOSE_HORIZONTAL; - case EK_dissolve: - return AnimationEffect_DISSOLVE; - case EK_wavyline: - switch( eDirection ) - { - case ED_from_left: return AnimationEffect_WAVYLINE_FROM_LEFT; - case ED_from_top: return AnimationEffect_WAVYLINE_FROM_TOP; - case ED_from_right: return AnimationEffect_WAVYLINE_FROM_RIGHT; - case ED_from_bottom: return AnimationEffect_WAVYLINE_FROM_BOTTOM; - } - return AnimationEffect_WAVYLINE_FROM_LEFT; - case EK_random: - return AnimationEffect_RANDOM; - case EK_lines: - if( eDirection == ED_vertical ) - return AnimationEffect_VERTICAL_LINES; - else - return AnimationEffect_HORIZONTAL_LINES; - case EK_laser: - switch( eDirection ) - { - case ED_from_left: return AnimationEffect_LASER_FROM_LEFT; - case ED_from_top: return AnimationEffect_LASER_FROM_TOP; - case ED_from_right: return AnimationEffect_LASER_FROM_RIGHT; - case ED_from_bottom: return AnimationEffect_LASER_FROM_BOTTOM; - case ED_from_upperleft: return AnimationEffect_LASER_FROM_UPPERLEFT; - case ED_from_upperright: return AnimationEffect_LASER_FROM_UPPERRIGHT; - case ED_from_lowerleft: return AnimationEffect_LASER_FROM_LOWERLEFT; - case ED_from_lowerright: return AnimationEffect_LASER_FROM_LOWERRIGHT; - } - return AnimationEffect_LASER_FROM_LEFT; - case EK_appear: - return AnimationEffect_APPEAR; - case EK_hide: - return AnimationEffect_HIDE; - case EK_move_short: - switch( eDirection ) - { - case ED_from_left: return AnimationEffect_MOVE_SHORT_FROM_LEFT; - case ED_from_top: return AnimationEffect_MOVE_SHORT_FROM_TOP; - case ED_from_right: return AnimationEffect_MOVE_SHORT_FROM_RIGHT; - case ED_from_bottom: return AnimationEffect_MOVE_SHORT_FROM_BOTTOM; - case ED_from_upperleft: return AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT; - case ED_from_upperright: return AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT; - case ED_from_lowerleft: return AnimationEffect_FADE_FROM_LOWERLEFT; - case ED_from_lowerright: return AnimationEffect_FADE_FROM_LOWERRIGHT; - } - return AnimationEffect_MOVE_SHORT_FROM_LEFT; - case EK_checkerboard: - if( eDirection == ED_vertical ) - return AnimationEffect_VERTICAL_CHECKERBOARD; - else - return AnimationEffect_HORIZONTAL_CHECKERBOARD; - case EK_rotate: - if( eDirection == ED_vertical ) - return AnimationEffect_VERTICAL_ROTATE; - else - return AnimationEffect_HORIZONTAL_ROTATE; - case EK_stretch: - switch( eDirection ) - { - case ED_from_left: return AnimationEffect_STRETCH_FROM_LEFT; - case ED_from_top: return AnimationEffect_STRETCH_FROM_TOP; - case ED_from_right: return AnimationEffect_STRETCH_FROM_RIGHT; - case ED_from_bottom: return AnimationEffect_STRETCH_FROM_BOTTOM; - case ED_from_upperleft: return AnimationEffect_STRETCH_FROM_UPPERLEFT; - case ED_from_upperright: return AnimationEffect_STRETCH_FROM_UPPERRIGHT; - case ED_from_lowerleft: return AnimationEffect_STRETCH_FROM_LOWERLEFT; - case ED_from_lowerright: return AnimationEffect_STRETCH_FROM_LOWERRIGHT; - case ED_vertical: return AnimationEffect_VERTICAL_STRETCH; - case ED_horizontal: return AnimationEffect_HORIZONTAL_STRETCH; - } - return AnimationEffect_STRETCH_FROM_LEFT; + case ED_from_left: return AnimationEffect_FADE_FROM_LEFT; + case ED_from_top: return AnimationEffect_FADE_FROM_TOP; + case ED_from_right: return AnimationEffect_FADE_FROM_RIGHT; + case ED_from_bottom: return AnimationEffect_FADE_FROM_BOTTOM; + case ED_from_center: return AnimationEffect_FADE_FROM_CENTER; + case ED_from_upperleft: return AnimationEffect_FADE_FROM_UPPERLEFT; + case ED_from_upperright: return AnimationEffect_FADE_FROM_UPPERRIGHT; + case ED_from_lowerleft: return AnimationEffect_FADE_FROM_LOWERLEFT; + case ED_from_lowerright: return AnimationEffect_FADE_FROM_LOWERRIGHT; + case ED_to_center: return AnimationEffect_FADE_TO_CENTER; + case ED_clockwise: return AnimationEffect_CLOCKWISE; + case ED_cclockwise: return AnimationEffect_COUNTERCLOCKWISE; + case ED_spiral_inward_left: return AnimationEffect_SPIRALIN_LEFT; + case ED_spiral_inward_right:return AnimationEffect_SPIRALIN_RIGHT; + case ED_spiral_outward_left:return AnimationEffect_SPIRALOUT_LEFT; + case ED_spiral_outward_right:return AnimationEffect_SPIRALOUT_RIGHT; } - } - else - { - switch( eKind ) + return AnimationEffect_FADE_FROM_LEFT; + case EK_move: + if( nStartScale == 200 ) + { + return AnimationEffect_ZOOM_OUT_SMALL; + } + else if( nStartScale == 50 ) + { + return AnimationEffect_ZOOM_IN_SMALL; + } + else if( nStartScale < 100 ) { - case EK_move: switch( eDirection ) { + case ED_from_left: return AnimationEffect_ZOOM_IN_FROM_LEFT; + case ED_from_top: return AnimationEffect_ZOOM_IN_FROM_TOP; + case ED_from_right: return AnimationEffect_ZOOM_IN_FROM_RIGHT; + case ED_from_bottom: return AnimationEffect_ZOOM_IN_FROM_BOTTOM; + case ED_from_upperleft: return AnimationEffect_ZOOM_IN_FROM_UPPERLEFT; + case ED_from_upperright: return AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT; + case ED_from_lowerleft: return AnimationEffect_ZOOM_IN_FROM_LOWERLEFT; + case ED_from_lowerright: return AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT; + case ED_from_center: return AnimationEffect_ZOOM_IN_FROM_CENTER; + case ED_spiral_inward_left: return AnimationEffect_ZOOM_IN_SPIRAL; case ED_to_left: return AnimationEffect_MOVE_TO_LEFT; case ED_to_top: return AnimationEffect_MOVE_TO_TOP; case ED_to_right: return AnimationEffect_MOVE_TO_RIGHT; @@ -322,23 +187,137 @@ AnimationEffect getEffect( XMLEffect eKind, XMLEffectDirection eDirection, sal_I case ED_to_lowerright: return AnimationEffect_MOVE_TO_LOWERRIGHT; case ED_to_lowerleft: return AnimationEffect_MOVE_TO_LOWERLEFT; } - return AnimationEffect_MOVE_TO_LEFT; - case EK_hide: - return AnimationEffect_HIDE; - case EK_move_short: + return AnimationEffect_ZOOM_IN; + } + else if( nStartScale > 100 ) + { + switch( eDirection ) + { + case ED_from_left: return AnimationEffect_ZOOM_OUT_FROM_LEFT; + case ED_from_top: return AnimationEffect_ZOOM_OUT_FROM_TOP; + case ED_from_right: return AnimationEffect_ZOOM_OUT_FROM_RIGHT; + case ED_from_bottom: return AnimationEffect_ZOOM_OUT_FROM_BOTTOM; + case ED_from_upperleft: return AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT; + case ED_from_upperright: return AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT; + case ED_from_lowerleft: return AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT; + case ED_from_lowerright: return AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT; + case ED_from_center: return AnimationEffect_ZOOM_OUT_FROM_CENTER; + case ED_spiral_inward_left: return AnimationEffect_ZOOM_OUT_SPIRAL; + } + return AnimationEffect_ZOOM_OUT; + } + else + { switch( eDirection ) { - case ED_to_left: return AnimationEffect_MOVE_SHORT_TO_LEFT; - case ED_to_upperleft: return AnimationEffect_MOVE_SHORT_TO_UPPERLEFT; - case ED_to_top: return AnimationEffect_MOVE_SHORT_TO_TOP; - case ED_to_upperright: return AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT; - case ED_to_right: return AnimationEffect_MOVE_SHORT_TO_RIGHT; - case ED_to_lowerright: return AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT; - case ED_to_bottom: return AnimationEffect_MOVE_SHORT_TO_BOTTOM; - case ED_to_lowerleft: return AnimationEffect_MOVE_SHORT_TO_LOWERLEFT; + case ED_from_left: return AnimationEffect_MOVE_FROM_LEFT; + case ED_from_top: return AnimationEffect_MOVE_FROM_TOP; + case ED_from_right: return AnimationEffect_MOVE_FROM_RIGHT; + case ED_from_bottom: return AnimationEffect_MOVE_FROM_BOTTOM; + case ED_from_upperleft: return AnimationEffect_MOVE_FROM_UPPERLEFT; + case ED_from_upperright: return AnimationEffect_MOVE_FROM_UPPERRIGHT; + case ED_from_lowerleft: return AnimationEffect_MOVE_FROM_LOWERLEFT; + case ED_from_lowerright: return AnimationEffect_MOVE_FROM_LOWERRIGHT; + case ED_path: return AnimationEffect_PATH; } - return AnimationEffect_MOVE_SHORT_TO_LEFT; } + return AnimationEffect_MOVE_FROM_LEFT; + case EK_stripes: + if( eDirection == ED_vertical ) + return AnimationEffect_VERTICAL_STRIPES; + else + return AnimationEffect_HORIZONTAL_STRIPES; + case EK_open: + if( eDirection == ED_vertical ) + return AnimationEffect_OPEN_VERTICAL; + else + return AnimationEffect_OPEN_HORIZONTAL; + case EK_close: + if( eDirection == ED_vertical ) + return AnimationEffect_CLOSE_VERTICAL; + else + return AnimationEffect_CLOSE_HORIZONTAL; + case EK_dissolve: + return AnimationEffect_DISSOLVE; + case EK_wavyline: + switch( eDirection ) + { + case ED_from_left: return AnimationEffect_WAVYLINE_FROM_LEFT; + case ED_from_top: return AnimationEffect_WAVYLINE_FROM_TOP; + case ED_from_right: return AnimationEffect_WAVYLINE_FROM_RIGHT; + case ED_from_bottom: return AnimationEffect_WAVYLINE_FROM_BOTTOM; + } + return AnimationEffect_WAVYLINE_FROM_LEFT; + case EK_random: + return AnimationEffect_RANDOM; + case EK_lines: + if( eDirection == ED_vertical ) + return AnimationEffect_VERTICAL_LINES; + else + return AnimationEffect_HORIZONTAL_LINES; + case EK_laser: + switch( eDirection ) + { + case ED_from_left: return AnimationEffect_LASER_FROM_LEFT; + case ED_from_top: return AnimationEffect_LASER_FROM_TOP; + case ED_from_right: return AnimationEffect_LASER_FROM_RIGHT; + case ED_from_bottom: return AnimationEffect_LASER_FROM_BOTTOM; + case ED_from_upperleft: return AnimationEffect_LASER_FROM_UPPERLEFT; + case ED_from_upperright: return AnimationEffect_LASER_FROM_UPPERRIGHT; + case ED_from_lowerleft: return AnimationEffect_LASER_FROM_LOWERLEFT; + case ED_from_lowerright: return AnimationEffect_LASER_FROM_LOWERRIGHT; + } + return AnimationEffect_LASER_FROM_LEFT; + case EK_appear: + return AnimationEffect_APPEAR; + case EK_hide: + return AnimationEffect_HIDE; + case EK_move_short: + switch( eDirection ) + { + case ED_from_left: return AnimationEffect_MOVE_SHORT_FROM_LEFT; + case ED_from_top: return AnimationEffect_MOVE_SHORT_FROM_TOP; + case ED_from_right: return AnimationEffect_MOVE_SHORT_FROM_RIGHT; + case ED_from_bottom: return AnimationEffect_MOVE_SHORT_FROM_BOTTOM; + case ED_from_upperleft: return AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT; + case ED_from_upperright: return AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT; + case ED_from_lowerleft: return AnimationEffect_FADE_FROM_LOWERLEFT; + case ED_from_lowerright: return AnimationEffect_FADE_FROM_LOWERRIGHT; + case ED_to_left: return AnimationEffect_MOVE_SHORT_TO_LEFT; + case ED_to_upperleft: return AnimationEffect_MOVE_SHORT_TO_UPPERLEFT; + case ED_to_top: return AnimationEffect_MOVE_SHORT_TO_TOP; + case ED_to_upperright: return AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT; + case ED_to_right: return AnimationEffect_MOVE_SHORT_TO_RIGHT; + case ED_to_lowerright: return AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT; + case ED_to_bottom: return AnimationEffect_MOVE_SHORT_TO_BOTTOM; + case ED_to_lowerleft: return AnimationEffect_MOVE_SHORT_TO_LOWERLEFT; + } + return AnimationEffect_MOVE_SHORT_FROM_LEFT; + case EK_checkerboard: + if( eDirection == ED_vertical ) + return AnimationEffect_VERTICAL_CHECKERBOARD; + else + return AnimationEffect_HORIZONTAL_CHECKERBOARD; + case EK_rotate: + if( eDirection == ED_vertical ) + return AnimationEffect_VERTICAL_ROTATE; + else + return AnimationEffect_HORIZONTAL_ROTATE; + case EK_stretch: + switch( eDirection ) + { + case ED_from_left: return AnimationEffect_STRETCH_FROM_LEFT; + case ED_from_top: return AnimationEffect_STRETCH_FROM_TOP; + case ED_from_right: return AnimationEffect_STRETCH_FROM_RIGHT; + case ED_from_bottom: return AnimationEffect_STRETCH_FROM_BOTTOM; + case ED_from_upperleft: return AnimationEffect_STRETCH_FROM_UPPERLEFT; + case ED_from_upperright: return AnimationEffect_STRETCH_FROM_UPPERRIGHT; + case ED_from_lowerleft: return AnimationEffect_STRETCH_FROM_LOWERLEFT; + case ED_from_lowerright: return AnimationEffect_STRETCH_FROM_LOWERRIGHT; + case ED_vertical: return AnimationEffect_VERTICAL_STRETCH; + case ED_horizontal: return AnimationEffect_HORIZONTAL_STRETCH; + } + return AnimationEffect_STRETCH_FROM_LEFT; } return AnimationEffect_NONE; @@ -634,7 +613,7 @@ void XMLAnimationsEffectContext::EndElement() } else { - const AnimationEffect eEffect = getEffect( meEffect, meDirection, mnStartScale, meKind == XMLE_SHOW ); + const AnimationEffect eEffect = ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, meKind == XMLE_SHOW ); aAny <<= eEffect; xSet->setPropertyValue( mbTextEffect ? mpImpl->msTextEffect : mpImpl->msEffect, aAny ); diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx new file mode 100644 index 000000000000..5c5ddb95fd4c --- /dev/null +++ b/xmloff/source/draw/eventimp.cxx @@ -0,0 +1,529 @@ +/************************************************************************* + * + * $RCSfile: eventimp.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cl $ $Date: 2001-02-07 16:26:36 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include + +#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEREPLACE_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_PRESENTATION_ANIMATIONSPEED_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_PRESENTATION_CLICKACTION_HPP_ +#include +#endif + +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include +#endif + +#include "xmlkywd.hxx" + +#ifndef _XMLOFF_XMLIMP_HXX +#include "xmlimp.hxx" +#endif + +#ifndef _XMLOFF_XMLNMSPE_HXX +#include "xmlnmspe.hxx" +#endif + +#ifndef _XMLOFF_XMLUCONV_HXX +#include "xmluconv.hxx" +#endif + +#ifndef _XMLOFF_NMSPMAP_HXX +#include "nmspmap.hxx" +#endif + +#ifndef _XMLOFF_EVENTIMP_HXX +#include "eventimp.hxx" +#endif + +#ifndef _XMLOFF_ANIM_HXX +#include "anim.hxx" +#endif + +using namespace ::rtl; +using namespace ::std; +using namespace ::cppu; +using namespace ::com::sun::star; +using namespace ::com::sun::star::xml; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::document; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::presentation; + +/////////////////////////////////////////////////////////////////////// + +SvXMLEnumMapEntry __READONLY_DATA aXML_EventActions_EnumMap[] = +{ + { sXML_none, ClickAction_NONE }, + { sXML_previous_page, ClickAction_PREVPAGE }, + { sXML_next_page, ClickAction_NEXTPAGE }, + { sXML_first_page, ClickAction_FIRSTPAGE }, + { sXML_last_page, ClickAction_LASTPAGE }, + { sXML_hide, ClickAction_INVISIBLE }, + { sXML_stop, ClickAction_STOPPRESENTATION }, + { sXML_execute, ClickAction_PROGRAM }, + { sXML_show, ClickAction_BOOKMARK }, + { sXML_show, ClickAction_DOCUMENT }, + { sXML_execute_macro, ClickAction_MACRO }, + { sXML_verb, ClickAction_VERB }, + { sXML_fade_out, ClickAction_VANISH }, + { sXML_sound, ClickAction_SOUND }, + { 0, 0 } +}; + +/////////////////////////////////////////////////////////////////////// + +class SdXMLEventContext : public SvXMLImportContext +{ +private: + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape; + +public: + TYPEINFO(); + + SdXMLEventContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList, const Reference< XShape >& rxShape ); + virtual ~SdXMLEventContext(); + + virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList ); + virtual void EndElement(); + + sal_Bool mbValid; + sal_Bool mbScript; + ClickAction meClickAction; + XMLEffect meEffect; + XMLEffectDirection meDirection; + sal_Int16 mnStartScale; + AnimationSpeed meSpeed; + sal_Int32 mnVerb; + OUString msSoundURL; + sal_Bool mbPlayFull; + OUString msEventName; + OUString msLanguage; + OUString msMacroName; + OUString msLibrary; + OUString msBookmark; +}; + +/////////////////////////////////////////////////////////////////////// + +class XMLEventSoundContext : public SvXMLImportContext +{ + SdXMLEventContext* mpParent; + +public: + TYPEINFO(); + + XMLEventSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent ); + virtual ~XMLEventSoundContext(); +}; + +TYPEINIT1( XMLEventSoundContext, SvXMLImportContext ); + +XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent ) +: SvXMLImportContext( rImport, nPrfx, rLocalName ), mpParent( pParent ) +{ + if( mpParent && nPrfx == XML_NAMESPACE_PRESENTATION && rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_sound ) ) ) + { + const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for(sal_Int16 i=0; i < nAttrCount; i++) + { + OUString sAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); + OUString sValue = xAttrList->getValueByIndex( i ); + + switch( nPrefix ) + { + case XML_NAMESPACE_XLINK: + if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_href ) ) ) + { + mpParent->msSoundURL = sValue; + } + break; + case XML_NAMESPACE_PRESENTATION: + if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_play_full ) ) ) + { + mpParent->mbPlayFull = sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_true ) ); + } + } + } + } +} + +XMLEventSoundContext::~XMLEventSoundContext() +{ +} + +/////////////////////////////////////////////////////////////////////// + +TYPEINIT1( SdXMLEventContext, SvXMLImportContext ); + +SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XShape >& rxShape ) +: SvXMLImportContext(rImport, nPrfx, rLocalName), + mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ), + meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ), + meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False ) +{ + const OUString msXMLEventName( RTL_CONSTASCII_USTRINGPARAM( "on-click" ) ); + + if( nPrfx == XML_NAMESPACE_PRESENTATION && rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_event ) ) ) + { + mbValid = sal_True; + } + else if( nPrfx == XML_NAMESPACE_SCRIPT && rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_event ) ) ) + { + mbScript = sal_True; + mbValid = sal_True; + } + else + { + return; + } + + // read attributes + const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for(sal_Int16 i=0; (i < nAttrCount) && mbValid; i++) + { + OUString sAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); + OUString sValue = xAttrList->getValueByIndex( i ); + + switch( nPrefix ) + { + case XML_NAMESPACE_PRESENTATION: + if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_action ) ) ) + { + USHORT eEnum; + if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_EventActions_EnumMap ) ) + meClickAction = (ClickAction)eEnum; + } + if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_effect ) ) ) + { + USHORT eEnum; + if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationEffect_EnumMap ) ) + meEffect = (XMLEffect)eEnum; + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_direction ) ) ) + { + USHORT eEnum; + if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationDirection_EnumMap ) ) + meDirection = (XMLEffectDirection)eEnum; + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_start_scale ) ) ) + { + sal_Int32 nScale; + if( SvXMLUnitConverter::convertPercent( nScale, sValue ) ) + mnStartScale = (sal_Int16)nScale; + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_speed ) ) ) + { + USHORT eEnum; + if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationSpeed_EnumMap ) ) + meSpeed = (AnimationSpeed)eEnum; + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_verb ) ) ) + { + SvXMLUnitConverter::convertNumber( mnVerb, sValue ); + } + break; + + case XML_NAMESPACE_SCRIPT: + if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_event_name ) ) ) + { + msEventName = sValue; + mbValid = msEventName == msXMLEventName; + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_language ) ) ) + { + msLanguage = sValue; + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_macro_name ) ) ) + { + msMacroName = sValue; + } + else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_library ) ) ) + { + msLibrary = sValue; + } + break; + + case XML_NAMESPACE_XLINK: + if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_href ) ) ) + { + msBookmark = sValue; + } + break; + } + } + + if( mbValid ) + mbValid = msEventName.getLength() != 0; +} + +SdXMLEventContext::~SdXMLEventContext() +{ +} + +SvXMLImportContext * SdXMLEventContext::CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList ) +{ + return new XMLEventSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this ); +} + +void SdXMLEventContext::EndElement() +{ + const OUString msAPIEventName( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) ); + + if( !mbValid ) + return; + + do + { + Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY ); + if( !xEventsSupplier.is() ) + break; + + Reference< XNameReplace > xEvents( xEventsSupplier->getEvents() ); + DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" ); + if( !xEvents.is() ) + break; + + if( !xEvents->hasByName( msAPIEventName ) ) + break; + + if( mbScript ) + meClickAction = ClickAction_MACRO; + + sal_Int32 nPropertyCount = 2; + switch( meClickAction ) + { + case ClickAction_NONE: + case ClickAction_PREVPAGE: + case ClickAction_NEXTPAGE: + case ClickAction_FIRSTPAGE: + case ClickAction_LASTPAGE: + case ClickAction_INVISIBLE: + case ClickAction_STOPPRESENTATION: + break; + case ClickAction_PROGRAM: + case ClickAction_VERB: + case ClickAction_BOOKMARK: + case ClickAction_DOCUMENT: + case ClickAction_MACRO: + nPropertyCount += 1; + break; + + case ClickAction_SOUND: + nPropertyCount += 2; + break; + + case ClickAction_VANISH: + nPropertyCount += 4; + break; + } + + uno::Sequence< beans::PropertyValue > aProperties( nPropertyCount ); + beans::PropertyValue* pProperties = aProperties.getArray(); + + if( ClickAction_MACRO == meClickAction ) + { + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) ); + pProperties->Handle = -1; + pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("StarBasic") ); + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ) ); + pProperties->Handle = -1; + pProperties->Value <<= msMacroName; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Library" ) ); + pProperties->Handle = -1; + pProperties->Value <<= msLibrary; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + } + else + { + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) ); + pProperties->Handle = -1; + pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") ); + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + // ClickAction_BOOKMARK and ClickAction_DOCUMENT share the same xml event + // so check here if its realy a bookmark or maybe a document + if( meClickAction == ClickAction_BOOKMARK ) + { + if( msBookmark.compareToAscii( "#", 1 ) != 0 ) + meClickAction = ClickAction_DOCUMENT; + } + + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ); + pProperties->Handle = -1; + pProperties->Value <<= meClickAction; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + switch( meClickAction ) + { + case ClickAction_NONE: + case ClickAction_PREVPAGE: + case ClickAction_NEXTPAGE: + case ClickAction_FIRSTPAGE: + case ClickAction_LASTPAGE: + case ClickAction_INVISIBLE: + case ClickAction_STOPPRESENTATION: + break; + + case ClickAction_BOOKMARK: + msBookmark = msBookmark.copy(1); + + // Note: no break here!!! + + case ClickAction_DOCUMENT: + case ClickAction_PROGRAM: + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ); + pProperties->Handle = -1; + pProperties->Value <<= msBookmark; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + break; + + case ClickAction_VANISH: + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Effect") ); + pProperties->Handle = -1; + pProperties->Value <<= ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, sal_True ); + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Speed") ); + pProperties->Handle = -1; + pProperties->Value <<= meSpeed; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + // NOTE: no break here!!! + + case ClickAction_SOUND: + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ); + pProperties->Handle = -1; + pProperties->Value <<= msSoundURL; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + pProperties++; + + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ); + pProperties->Handle = -1; + pProperties->Value = ::cppu::bool2any(mbPlayFull); + pProperties->State = beans::PropertyState_DIRECT_VALUE; + break; + + case ClickAction_VERB: + pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Verb") ); + pProperties->Handle = -1; + pProperties->Value <<= mnVerb; + pProperties->State = beans::PropertyState_DIRECT_VALUE; + break; + } + } + + uno::Any aAny; + aAny <<= aProperties; + xEvents->replaceByName( msAPIEventName, aAny ); + + } while(0); +} + +/////////////////////////////////////////////////////////////////////// + +TYPEINIT1( SdXMLEventsContext, SvXMLImportContext ); + +SdXMLEventsContext::SdXMLEventsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, + const Reference< XAttributeList>& xAttrList, const Reference< XShape >& rxShape) +: SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape ) +{ +} + +SdXMLEventsContext::~SdXMLEventsContext() +{ +} + +SvXMLImportContext * SdXMLEventsContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ) +{ + return new SdXMLEventContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape ); +} diff --git a/xmloff/source/draw/eventimp.hxx b/xmloff/source/draw/eventimp.hxx new file mode 100644 index 000000000000..f6c3333e2f29 --- /dev/null +++ b/xmloff/source/draw/eventimp.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: eventimp.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cl $ $Date: 2001-02-07 16:26:36 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _XMLOFF_EVENTIMP_HXX +#define _XMLOFF_EVENTIMP_HXX + +#ifndef _XMLOFF_XMLICTXT_HXX +#include "xmlictxt.hxx" +#endif + +#ifndef _COM_SUN_STAR_DRAWING_XSHAPE_HPP_ +#include +#endif + +////////////////////////////////////////////////////////////////////////////// +// office:events inside a shape + +class SdXMLEventsContext : public SvXMLImportContext +{ +private: + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape; + +public: + TYPEINFO(); + + SdXMLEventsContext( SvXMLImport& rImport, + sal_uInt16 nPrfx, + const rtl::OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, + const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rxShape ); + virtual ~SdXMLEventsContext(); + + virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); +}; + +#endif // _XMLOFF_EVENTIMP_HXX + diff --git a/xmloff/source/draw/makefile.mk b/xmloff/source/draw/makefile.mk index 41737344c574..84d82edb93d8 100644 --- a/xmloff/source/draw/makefile.mk +++ b/xmloff/source/draw/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.9 $ # -# last change: $Author: cl $ $Date: 2001-02-02 11:14:37 $ +# last change: $Author: cl $ $Date: 2001-02-07 16:26:36 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -75,6 +75,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES = \ + $(SLO)$/eventimp.obj\ $(SLO)$/layerexp.obj\ $(SLO)$/layerimp.obj\ $(SLO)$/ximpshow.obj\ diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 49fa5ecffb34..85bdb047a7e6 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeexport.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: cl $ $Date: 2001-02-02 12:21:59 $ + * last change: $Author: cl $ $Date: 2001-02-07 16:26:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -108,7 +108,20 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp, msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ), msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ), - msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ) + msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ), + msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ), + msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ), + msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ), + msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ), + msLibrary( RTL_CONSTASCII_USTRINGPARAM("Library") ), + msClickAction( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ), + msBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ), + msEffect( RTL_CONSTASCII_USTRINGPARAM("Effect") ), + msPlayFull( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ), + msVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ), + msSoundURL( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ), + msSpeed( RTL_CONSTASCII_USTRINGPARAM("Speed") ), + msStarBasic( RTL_CONSTASCII_USTRINGPARAM("StarBasic") ) { // construct PropertyHandlerFactory xSdPropHdlFactory = new XMLSdPropHdlFactory( rExport.GetModel() ); diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index c25114d82d25..2871f570ffbf 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeexport2.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: cl $ $Date: 2001-02-02 11:14:37 $ + * last change: $Author: cl $ $Date: 2001-02-07 16:26:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,14 @@ #include #endif +#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP_ +#include +#endif + +#ifndef _XMLOFF_ANIM_HXX +#include "anim.hxx" +#endif + #ifndef _XMLOFF_SHAPEEXPORT_HXX #include "shapeexport.hxx" #endif @@ -237,6 +245,251 @@ void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xSh ////////////////////////////////////////////////////////////////////////////// +#ifndef _COM_SUN_STAR_PRESENTATION_CLICKACTION_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_PRESENTATION_ANIMATIONSPEED_HPP_ +#include +#endif + +#define FOUND_CLICKACTION 0x0001 +#define FOUND_BOOKMARK 0x0002 +#define FOUND_EFFECT 0x0004 +#define FOUND_PLAYFULL 0x0008 +#define FOUND_VERB 0x0010 +#define FOUND_SOUNDURL 0x0020 +#define FOUND_SPEED 0x0040 +#define FOUND_EVENTTYPE 0x0080 +#define FOUND_MACRO 0x0100 +#define FOUND_LIBRARY 0x0200 + +void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& xShape ) +{ + do + { + uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY ); + if( !xEventsSupplier.is() ) + break; + + uno::Reference< container::XNameReplace > xEvents( xEventsSupplier->getEvents() ); + DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" ); + if( !xEvents.is() ) + break; + + uno::Sequence< beans::PropertyValue > aProperties; + if( !xEvents->hasByName( msOnClick ) ) + break; + + if( !(xEvents->getByName( msOnClick ) >>= aProperties) ) + break; + + sal_Int32 nFound = 0; + const beans::PropertyValue* pProperties = aProperties.getConstArray(); + + OUString aStrEventType; + presentation::ClickAction eClickAction; + presentation::AnimationEffect eEffect; + presentation::AnimationSpeed eSpeed; + OUString aStrSoundURL; + sal_Bool bPlayFull; + sal_Int32 nVerb; + OUString aStrMacro; + OUString aStrLibrary; + OUString aStrBookmark; + + const sal_Int32 nCount = aProperties.getLength(); + sal_Int32 nIndex; + for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ ) + { + if( ( ( nFound & FOUND_EVENTTYPE ) == 0 ) && pProperties->Name == msEventType ) + { + if( pProperties->Value >>= aStrEventType ) + nFound |= FOUND_EVENTTYPE; + } + else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperties->Name == msClickAction ) + { + if( pProperties->Value >>= eClickAction ) + nFound |= FOUND_CLICKACTION; + } + else if( ( ( nFound & FOUND_MACRO ) == 0 ) && pProperties->Name == msMacroName ) + { + if( pProperties->Value >>= aStrMacro ) + nFound |= FOUND_MACRO; + } + else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperties->Name == msLibrary ) + { + if( pProperties->Value >>= aStrLibrary ) + nFound |= FOUND_LIBRARY; + } + else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperties->Name == msEffect ) + { + if( pProperties->Value >>= eEffect ) + nFound |= FOUND_EFFECT; + } + else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperties->Name == msBookmark ) + { + if( pProperties->Value >>= aStrBookmark ) + nFound |= FOUND_BOOKMARK; + } + else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperties->Name == msSpeed ) + { + if( pProperties->Value >>= eSpeed ) + nFound |= FOUND_SPEED; + } + else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperties->Name == msSoundURL ) + { + if( pProperties->Value >>= aStrSoundURL ) + nFound |= FOUND_SOUNDURL; + } + else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperties->Name == msPlayFull ) + { + if( pProperties->Value >>= bPlayFull ) + nFound |= FOUND_PLAYFULL; + } + else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperties->Name == msVerb ) + { + if( pProperties->Value >>= nVerb ) + nFound |= FOUND_VERB; + } + } + + if( ( nFound & FOUND_EVENTTYPE ) == 0 ) + break; + + if( aStrEventType == msPresentation ) + { + if( ( nFound & FOUND_CLICKACTION ) == 0 ) + break; + + if( eClickAction == presentation::ClickAction_NONE ) + break; + + SvXMLElementExport aEventsElemt(rExport, XML_NAMESPACE_OFFICE, sXML_events, sal_True, sal_True); + + OUString aStrAction; + + switch( eClickAction ) + { + case presentation::ClickAction_PREVPAGE: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_previous_page ) ); break; + case presentation::ClickAction_NEXTPAGE: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_next_page ) ); break; + case presentation::ClickAction_FIRSTPAGE: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_first_page ) ); break; + case presentation::ClickAction_LASTPAGE: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_last_page ) ); break; + case presentation::ClickAction_INVISIBLE: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_hide ) ); break; + case presentation::ClickAction_STOPPRESENTATION:aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_stop ) ); break; + case presentation::ClickAction_PROGRAM: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_execute ) ); break; + case presentation::ClickAction_BOOKMARK: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_show ) ); break; + case presentation::ClickAction_DOCUMENT: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_show ) ); break; + case presentation::ClickAction_MACRO: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_execute_macro ) ); break; + case presentation::ClickAction_VERB: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_verb ) ); break; + case presentation::ClickAction_VANISH: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_fade_out ) ); break; + case presentation::ClickAction_SOUND: aStrAction = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_sound ) ); break; + default: + DBG_ERROR( "unknown presentation::ClickAction found!" ); + } + + rExport.AddAttribute( XML_NAMESPACE_SCRIPT, sXML_event_name, OUString( RTL_CONSTASCII_USTRINGPARAM( "on-click" ) ) ); + rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, sXML_action, aStrAction ); + + if( eClickAction == presentation::ClickAction_VANISH ) + { + if( nFound & FOUND_EFFECT ) + { + XMLEffect eKind; + XMLEffectDirection eDirection; + sal_Int16 nStartScale; + sal_Bool bIn; + + SdXMLImplSetEffect( eEffect, eKind, eDirection, nStartScale, bIn ); + + if( eEffect != EK_none ) + { + SvXMLUnitConverter::convertEnum( msBuffer, eKind, aXML_AnimationEffect_EnumMap ); + rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, sXML_effect, msBuffer.makeStringAndClear() ); + } + + if( eDirection != ED_none ) + { + SvXMLUnitConverter::convertEnum( msBuffer, eDirection, aXML_AnimationDirection_EnumMap ); + rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, sXML_direction, msBuffer.makeStringAndClear() ); + } + + if( nStartScale != -1 ) + { + SvXMLUnitConverter::convertPercent( msBuffer, nStartScale ); + rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, sXML_start_scale, msBuffer.makeStringAndClear() ); + } + } + + if( nFound & FOUND_SPEED && eEffect != presentation::AnimationEffect_NONE ) + { + if( eSpeed != presentation::AnimationSpeed_MEDIUM ) + { + SvXMLUnitConverter::convertEnum( msBuffer, eSpeed, aXML_AnimationSpeed_EnumMap ); + rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, sXML_speed, msBuffer.makeStringAndClear() ); + } + } + } + + if( eClickAction == presentation::ClickAction_PROGRAM || + eClickAction == presentation::ClickAction_BOOKMARK || + eClickAction == presentation::ClickAction_DOCUMENT ) + { + if( eClickAction == presentation::ClickAction_BOOKMARK ) + msBuffer.append( sal_Unicode('#') ); + + msBuffer.append( aStrBookmark ); + rExport.AddAttribute(XML_NAMESPACE_XLINK, sXML_href, msBuffer.makeStringAndClear() ); + rExport.AddAttributeASCII( XML_NAMESPACE_XLINK, sXML_type, sXML_simple ); + rExport.AddAttributeASCII( XML_NAMESPACE_XLINK, sXML_show, sXML_new ); + rExport.AddAttributeASCII( XML_NAMESPACE_XLINK, sXML_actuate, sXML_onRequest ); + } + + if( ( nFound & FOUND_VERB ) && eClickAction == presentation::ClickAction_VERB ) + { + msBuffer.append( nVerb ); + rExport.AddAttribute(XML_NAMESPACE_PRESENTATION, sXML_verb, msBuffer.makeStringAndClear()); + } + + SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_PRESENTATION, sXML_event, sal_True, sal_True); + + if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND ) + { + if( ( nFound & FOUND_SOUNDURL ) && aStrSoundURL.getLength() != 0 ) + { + rExport.AddAttribute(XML_NAMESPACE_XLINK, sXML_href, aStrSoundURL ); + rExport.AddAttributeASCII( XML_NAMESPACE_XLINK, sXML_type, sXML_simple ); + rExport.AddAttributeASCII( XML_NAMESPACE_XLINK, sXML_show, sXML_new ); + rExport.AddAttributeASCII( XML_NAMESPACE_XLINK, sXML_actuate, sXML_onRequest ); + if( nFound & FOUND_PLAYFULL && bPlayFull ) + rExport.AddAttributeASCII( XML_NAMESPACE_PRESENTATION, sXML_play_full, sXML_true ); + + SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, sXML_sound, sal_True, sal_True ); + } + } + break; + } + else if( aStrEventType == msStarBasic ) + { + if( nFound & FOUND_MACRO ) + { + SvXMLElementExport aEventsElemt(rExport, XML_NAMESPACE_OFFICE, sXML_events, sal_True, sal_True); + + rExport.AddAttribute( XML_NAMESPACE_SCRIPT, sXML_language, OUString( RTL_CONSTASCII_USTRINGPARAM( "starbasic" ) ) ); + rExport.AddAttribute( XML_NAMESPACE_SCRIPT, sXML_event_name, OUString( RTL_CONSTASCII_USTRINGPARAM( "on-click" ) ) ); + rExport.AddAttribute( XML_NAMESPACE_SCRIPT, sXML_macro_name, aStrMacro ); + + if( nFound & FOUND_LIBRARY ) + rExport.AddAttribute( XML_NAMESPACE_SCRIPT, sXML_library, aStrLibrary ); + + SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SCRIPT, sXML_event, sal_True, sal_True); + } + } + } + while(0); +} + +////////////////////////////////////////////////////////////////////////////// + void XMLShapeExport::ImpExportGroupShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) { uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY); @@ -245,6 +498,8 @@ void XMLShapeExport::ImpExportGroupShape( const uno::Reference< drawing::XShape // write group shape SvXMLElementExport aPGR(rExport, XML_NAMESPACE_DRAW, sXML_g, sal_True, sal_True); + ImpExportEvents( xShape ); + // write members exportShapes( xShapes, nFeatures, pRefPoint ); } @@ -306,7 +561,7 @@ void XMLShapeExport::ImpExportTextBoxShape( // write text-box SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_text_box, sal_True, sal_True); - // export text + ImpExportEvents( xShape ); if(!bIsEmptyPresObj) ImpExportText( xShape ); } @@ -339,7 +594,7 @@ void XMLShapeExport::ImpExportRectangleShape( // write rectangle SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_rect, sal_True, sal_True); - // export text + ImpExportEvents( xShape ); ImpExportText( xShape ); } } @@ -435,7 +690,7 @@ void XMLShapeExport::ImpExportLineShape( // write line SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_line, sal_True, sal_True); - // export text + ImpExportEvents( xShape ); ImpExportText( xShape ); } } @@ -515,7 +770,7 @@ void XMLShapeExport::ImpExportEllipseShape( // write circle SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_circle, sal_True, sal_True); - // export text + ImpExportEvents( xShape ); ImpExportText( xShape ); } else @@ -533,7 +788,7 @@ void XMLShapeExport::ImpExportEllipseShape( // write ellipse SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_ellipse, sal_True, sal_True); - // export text + ImpExportEvents( xShape ); ImpExportText( xShape ); } } @@ -602,10 +857,8 @@ void XMLShapeExport::ImpExportPolygonShape( // write object now SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_path, sal_True, sal_True); - // export text - uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY ); - if( xText.is() && xText->getString().getLength() ) - rExport.GetTextParagraphExport()->exportText( xText ); + ImpExportEvents( xShape ); + ImpExportText( xShape ); } } else @@ -634,7 +887,7 @@ void XMLShapeExport::ImpExportPolygonShape( SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, bClosed ? sXML_polygon : sXML_polyline , sal_True, sal_True); - // export text + ImpExportEvents( xShape ); ImpExportText( xShape ); } else @@ -663,7 +916,7 @@ void XMLShapeExport::ImpExportPolygonShape( // write object now SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_path, sal_True, sal_True); - // export text + ImpExportEvents( xShape ); ImpExportText( xShape ); } } @@ -722,6 +975,7 @@ void XMLShapeExport::ImpExportGraphicObjectShape( } // write graphic object SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_image, sal_True, sal_True); + ImpExportEvents( xShape ); } } @@ -752,7 +1006,7 @@ void XMLShapeExport::ImpExportChartShape( if( xChartDoc.is() ) { // export chart data if the flag is not set (default) - sal_Bool bExportOwnData = (( nFeatures & SEF_EXPORT_NO_CHART_DATA ) == 0 ); + sal_Bool bExportOwnData = ( nFeatures & SEF_EXPORT_NO_CHART_DATA ) == 0; rExport.GetChartExport()->exportChart( xChartDoc, bExportOwnData ); } else @@ -806,8 +1060,6 @@ void XMLShapeExport::ImpExportControlShape( } } - // this is a control shape, in this place the database team - // would have to export the control abilities. Add Export later SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_control, sal_True, sal_True); } @@ -953,7 +1205,7 @@ void XMLShapeExport::ImpExportConnectorShape( // write connector shape. Add Export later. SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_connector, sal_True, sal_True); - // export text + ImpExportEvents( xShape ); ImpExportText( xShape ); } @@ -1023,7 +1275,8 @@ void XMLShapeExport::ImpExportMeasureShape( // write measure shape SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_measure, sal_True, sal_True); - // export text + ImpExportEvents( xShape ); + uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY ); if( xText.is() ) rExport.GetTextParagraphExport()->exportText( xText ); @@ -1047,6 +1300,8 @@ void XMLShapeExport::ImpExportOLE2Shape( // write object SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML__unknown_, sal_True, sal_True); + + ImpExportEvents( xShape ); } } @@ -1080,9 +1335,7 @@ void XMLShapeExport::ImpExportCaptionShape( // write Caption shape. Add export later. SvXMLElementExport aOBJ(rExport, XML_NAMESPACE_DRAW, sXML_caption, sal_True, sal_True); - // export text - uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY ); - if( xText.is() && xText->getString().getLength() ) - rExport.GetTextParagraphExport()->exportText( xText ); + ImpExportEvents( xShape ); + ImpExportText( xShape ); } diff --git a/xmloff/source/draw/shapeexport3.cxx b/xmloff/source/draw/shapeexport3.cxx index 86ebfcfdda4a..021a569c0b57 100644 --- a/xmloff/source/draw/shapeexport3.cxx +++ b/xmloff/source/draw/shapeexport3.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeexport3.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: cl $ $Date: 2001-02-02 11:14:37 $ + * last change: $Author: cl $ $Date: 2001-02-07 16:26:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -149,6 +149,8 @@ void XMLShapeExport::ImpExport3DSceneShape( const uno::Reference< drawing::XShap // write 3DScene shape SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DR3D, sXML_scene, sal_True, sal_True); + ImpExportEvents( xShape ); + uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY ); if( xPropSet.is() ) { diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 8f8016acccac..6dffb0768cc1 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpshap.cxx,v $ * - * $Revision: 1.22 $ + * $Revision: 1.23 $ * - * last change: $Author: cl $ $Date: 2001-02-01 19:06:28 $ + * last change: $Author: cl $ $Date: 2001-02-07 16:26:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -135,6 +135,10 @@ #include "sdpropls.hxx" #endif +#ifndef _XMLOFF_EVENTIMP_HXX +#include "eventimp.hxx" +#endif + using namespace ::rtl; using namespace ::com::sun::star; @@ -188,28 +192,35 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList>& xAttrList ) { - // create text cursor on demand - if( !mxCursor.is() ) + SvXMLImportContext * pContext = NULL; + + if( nPrefix == XML_NAMESPACE_OFFICE && rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_events ) ) ) { - uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY ); - if( xText.is() ) + pContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape ); + } + else + { + // create text cursor on demand + if( !mxCursor.is() ) { - mxOldCursor = GetImport().GetTextImport()->GetCursor(); - mxCursor = xText->createTextCursor(); - if( mxCursor.is() ) + uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY ); + if( xText.is() ) { - GetImport().GetTextImport()->SetCursor( mxCursor ); + mxOldCursor = GetImport().GetTextImport()->GetCursor(); + mxCursor = xText->createTextCursor(); + if( mxCursor.is() ) + { + GetImport().GetTextImport()->SetCursor( mxCursor ); + } } } - } - - SvXMLImportContext * pContext = NULL; - // if we have a text cursor, lets try to import some text - if( mxCursor.is() ) - { - pContext = GetImport().GetTextImport()->CreateTextChildContext( - GetImport(), nPrefix, rLocalName, xAttrList ); + // if we have a text cursor, lets try to import some text + if( mxCursor.is() ) + { + pContext = GetImport().GetTextImport()->CreateTextChildContext( + GetImport(), nPrefix, rLocalName, xAttrList ); + } } // call parent for content -- cgit