summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmloff/inc/xmlkywd.hxx66
-rw-r--r--xmloff/source/draw/animexp.cxx611
-rw-r--r--xmloff/source/draw/animimp.cxx697
-rw-r--r--xmloff/source/draw/makefile.mk7
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx112
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx25
-rw-r--r--xmloff/source/draw/sdxmlimp_impl.hxx31
-rw-r--r--xmloff/source/draw/shapeimport.cxx16
-rw-r--r--xmloff/source/draw/ximpbody.cxx31
-rw-r--r--xmloff/source/draw/ximppage.cxx30
-rw-r--r--xmloff/source/draw/ximpshow.cxx223
-rw-r--r--xmloff/source/draw/ximpshow.hxx96
12 files changed, 1901 insertions, 44 deletions
diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx
index 4d82f3460f66..86d7ca201403 100644
--- a/xmloff/inc/xmlkywd.hxx
+++ b/xmloff/inc/xmlkywd.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlkywd.hxx,v $
*
- * $Revision: 1.77 $
+ * $Revision: 1.78 $
*
- * last change: $Author: cmc $ $Date: 2000-12-18 17:03:52 $
+ * last change: $Author: cl $ $Date: 2000-12-19 16:21:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -148,12 +148,9 @@ XML_CONSTASCII_ACTION( sXML_1, "1" );
XML_CONSTASCII_ACTION( sXML_10, "10" );
XML_CONSTASCII_ACTION( sXML_2, "2" );
XML_CONSTASCII_ACTION( sXML_3, "3" );
-XML_CONSTASCII_ACTION( sXML_3DCube, "3dcube" );
-XML_CONSTASCII_ACTION( sXML_3DExtrude, "3dextrude" );
-XML_CONSTASCII_ACTION( sXML_3DLathe, "3dlathe" );
-XML_CONSTASCII_ACTION( sXML_3DPolygon, "3dpolygon" );
-XML_CONSTASCII_ACTION( sXML_3DScene, "scene");
-XML_CONSTASCII_ACTION( sXML_3DSphere, "3dsphere" );
+XML_CONSTASCII_ACTION( sXML_cube, "cube" );
+XML_CONSTASCII_ACTION( sXML_extrude, "extrude" );
+XML_CONSTASCII_ACTION( sXML_scene, "scene");
XML_CONSTASCII_ACTION( sXML_4, "4" );
XML_CONSTASCII_ACTION( sXML_5, "5" );
XML_CONSTASCII_ACTION( sXML_6, "6" );
@@ -1279,6 +1276,7 @@ XML_CONSTASCII_ACTION( sXML_sheet_name, "sheet-name" );
XML_CONSTASCII_ACTION( sXML_shininess, "shininess" );
XML_CONSTASCII_ACTION( sXML_short, "short" );
XML_CONSTASCII_ACTION( sXML_show, "show" );
+XML_CONSTASCII_ACTION( sXML_shows, "shows" );
XML_CONSTASCII_ACTION( sXML_side_by_side, "side-by-side" );
XML_CONSTASCII_ACTION( sXML_silver, "silver" );
XML_CONSTASCII_ACTION( sXML_simple, "simple" );
@@ -1614,4 +1612,56 @@ XML_CONSTASCII_ACTION( sXML_bottom_right, "bottom-right" );
XML_CONSTASCII_ACTION( sXML_fill_image_ref_point, "fill-image-ref-point" );
XML_CONSTASCII_ACTION( sXML_fill_image_ref_point_x, "fill-image-ref-point-x" );
XML_CONSTASCII_ACTION( sXML_fill_image_ref_point_y, "fill-image-ref-point-y" );
+
+XML_CONSTASCII_ACTION( sXML_from_right, "from-right" );
+XML_CONSTASCII_ACTION( sXML_from_bottom, "from-bottom" );
+XML_CONSTASCII_ACTION( sXML_from_center, "from-center" );
+XML_CONSTASCII_ACTION( sXML_from_upper_left, "from-upper-left" );
+XML_CONSTASCII_ACTION( sXML_from_upper_right, "from-upper-right" );
+XML_CONSTASCII_ACTION( sXML_from_lower_left, "from-lower-left" );
+XML_CONSTASCII_ACTION( sXML_from_lower_right, "from-lower-right" );
+XML_CONSTASCII_ACTION( sXML_to_left, "to-left" );
+XML_CONSTASCII_ACTION( sXML_to_top, "to-top" );
+XML_CONSTASCII_ACTION( sXML_to_right, "to-right" );
+XML_CONSTASCII_ACTION( sXML_to_bottom, "to-bottom" );
+XML_CONSTASCII_ACTION( sXML_to_upper_left, "to-upper-left" );
+XML_CONSTASCII_ACTION( sXML_to_upper_right, "to-upper-right" );
+XML_CONSTASCII_ACTION( sXML_to_lower_right, "to-lower-right" );
+XML_CONSTASCII_ACTION( sXML_to_lower_left, "to-lower-left" );
+XML_CONSTASCII_ACTION( sXML_to_center, "to-center" );
+XML_CONSTASCII_ACTION( sXML_counter_clockwise, "counter-clockwise" );
+
+XML_CONSTASCII_ACTION( sXML_fade, "fade" );
+XML_CONSTASCII_ACTION( sXML_move, "move" );
+XML_CONSTASCII_ACTION( sXML_stripes, "stripes" );
+XML_CONSTASCII_ACTION( sXML_spiral_inward_left, "spiral-inward-left" );
+XML_CONSTASCII_ACTION( sXML_spiral_inward_right, "spiral-inward-right" );
+XML_CONSTASCII_ACTION( sXML_spiral_outward_left, "spiral-outward-left" );
+XML_CONSTASCII_ACTION( sXML_spiral_outward_right, "spiral-outward-right" );
+XML_CONSTASCII_ACTION( sXML_spiral, "spiral" );
+XML_CONSTASCII_ACTION( sXML_spiral_in, "spiral-in" );
+XML_CONSTASCII_ACTION( sXML_spiral_out, "spiral-out" );
+XML_CONSTASCII_ACTION( sXML_wavyline, "wavyline" );
+XML_CONSTASCII_ACTION( sXML_laser, "laser" );
+XML_CONSTASCII_ACTION( sXML_appear, "appear" );
+XML_CONSTASCII_ACTION( sXML_hide, "hide" );
+XML_CONSTASCII_ACTION( sXML_move_short, "move-short" );
+XML_CONSTASCII_ACTION( sXML_checkerboard, "checkerboard" );
+XML_CONSTASCII_ACTION( sXML_stretch, "stretch" );
+
+XML_CONSTASCII_ACTION( sXML_shape_id, "shape-id" );
+XML_CONSTASCII_ACTION( sXML_effect, "effect" );
+XML_CONSTASCII_ACTION( sXML_speed, "speed" );
+XML_CONSTASCII_ACTION( sXML_start_scale, "start-scale" );
+XML_CONSTASCII_ACTION( sXML_show_shape, "show-shape" );
+XML_CONSTASCII_ACTION( sXML_show_text, "show-text" );
+XML_CONSTASCII_ACTION( sXML_hide_shape, "hide-shape" );
+XML_CONSTASCII_ACTION( sXML_hide_text, "hide-text" );
+XML_CONSTASCII_ACTION( sXML_dim, "dim" );
+XML_CONSTASCII_ACTION( sXML_sound, "sound" );
+XML_CONSTASCII_ACTION( sXML_play_full, "play-full" );
+XML_CONSTASCII_ACTION( sXML_path_id, "path-id" );
+
+XML_CONSTASCII_ACTION( sXML_animations, "animations" );
+
#endif
diff --git a/xmloff/source/draw/animexp.cxx b/xmloff/source/draw/animexp.cxx
new file mode 100644
index 000000000000..a429f11cad7f
--- /dev/null
+++ b/xmloff/source/draw/animexp.cxx
@@ -0,0 +1,611 @@
+/*************************************************************************
+ *
+ * $RCSfile: animexp.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: cl $ $Date: 2000-12-19 16:23:47 $
+ *
+ * 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 <tools/debug.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PRESENTATION_ANIMATIONEFFECT_HPP_
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PRESENTATION_ANIMATIONSPEED_HPP_
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#endif
+
+#include <stl/list>
+
+#ifndef _CPPUHELPER_EXTRACT_HXX_
+#include <cppuhelper/extract.hxx>
+#endif
+
+#ifndef _TOOLS_COLOR_HXX
+#include <tools/color.hxx>
+#endif
+
+#include "xmlkywd.hxx"
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLEXP_HXX
+#include "xmlexp.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlement.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_SHAPEEXPORT_HXX_
+#include "shapeexport.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::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::presentation;
+
+
+SvXMLEnumMapEntry aXML_AnimationEffect_EnumMap[] =
+{
+ { sXML_none, EK_none },
+ { sXML_fade, EK_fade },
+ { sXML_move, EK_move },
+ { sXML_stripes, EK_stripes },
+ { sXML_open, EK_open },
+ { sXML_close, EK_close },
+ { sXML_dissolve, EK_dissolve },
+ { sXML_wavyline, EK_wavyline },
+ { sXML_random, EK_random },
+ { sXML_lines, EK_lines },
+ { sXML_laser, EK_laser },
+ { sXML_appear, EK_appear },
+ { sXML_hide, EK_hide },
+ { sXML_move_short, EK_move_short },
+ { sXML_checkerboard,EK_checkerboard },
+ { sXML_rotate, EK_rotate },
+ { sXML_stretch, EK_stretch },
+ { NULL, 0 }
+};
+
+SvXMLEnumMapEntry aXML_AnimationDirection_EnumMap[] =
+{
+ { sXML_none, ED_none },
+ { sXML_from_left, ED_from_left },
+ { sXML_from_top, ED_from_top },
+ { sXML_from_right, ED_from_right },
+ { sXML_from_bottom, ED_from_bottom },
+ { sXML_from_center, ED_from_center },
+ { sXML_from_upper_left, ED_from_upperleft },
+ { sXML_from_upper_right,ED_from_upperright },
+ { sXML_from_lower_left, ED_from_lowerleft },
+ { sXML_from_lower_right,ED_from_lowerright },
+ { sXML_to_left, ED_to_left },
+ { sXML_to_top, ED_to_top },
+ { sXML_to_right, ED_to_right },
+ { sXML_to_bottom, ED_to_bottom },
+ { sXML_to_upper_left, ED_to_upperleft },
+ { sXML_to_upper_right, ED_to_upperright },
+ { sXML_to_lower_right, ED_to_lowerright },
+ { sXML_to_lower_left, ED_to_lowerleft },
+ { sXML_path, ED_path },
+ { sXML_spiral_inward_left, ED_spiral_inward_left },
+ { sXML_spiral_inward_right,ED_spiral_inward_right },
+ { sXML_spiral_outward_left, ED_spiral_outward_left },
+ { sXML_spiral_outward_right, ED_spiral_outward_right },
+ { sXML_vertical, ED_vertical },
+ { sXML_horizontal, ED_horizontal },
+ { sXML_to_center, ED_to_center },
+ { sXML_clockwise, ED_clockwise },
+ { sXML_counter_clockwise,ED_cclockwise },
+ { NULL, 0 }
+};
+
+const struct Effect
+{
+ XMLEffect meKind;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+ sal_Bool mbIn;
+}
+ AnimationEffectMap[] =
+{
+ { EK_none, ED_none, -1, sal_True }, // AnimationEffect_NONE
+ { EK_fade, ED_from_left, -1, sal_True }, // AnimationEffect_FADE_FROM_LEFT
+ { EK_fade, ED_from_top, -1, sal_True }, // AnimationEffect_FADE_FROM_TOP
+ { EK_fade, ED_from_right, -1, sal_True }, // AnimationEffect_FADE_FROM_RIGHT
+ { EK_fade, ED_from_bottom, -1, sal_True }, // AnimationEffect_FADE_FROM_BOTTOM
+ { EK_fade, ED_to_center, -1, sal_True }, // AnimationEffect_FADE_TO_CENTER
+ { EK_fade, ED_from_center, -1, sal_True }, // AnimationEffect_FADE_FROM_CENTER
+ { EK_move, ED_from_left, -1, sal_True }, // AnimationEffect_MOVE_FROM_LEFT
+ { EK_move, ED_from_top, -1, sal_True }, // AnimationEffect_MOVE_FROM_TOP
+ { EK_move, ED_from_right, -1, sal_True }, // AnimationEffect_MOVE_FROM_RIGHT
+ { EK_move, ED_from_bottom, -1, sal_True }, // AnimationEffect_MOVE_FROM_BOTTOM
+ { EK_stripes, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_STRIPES
+ { EK_stripes, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_STRIPES
+ { EK_fade, ED_clockwise, -1, sal_True }, // AnimationEffect_CLOCKWISE
+ { EK_fade, ED_cclockwise, -1, sal_True }, // AnimationEffect_COUNTERCLOCKWISE
+ { EK_fade, ED_from_upperleft, -1, sal_True }, // AnimationEffect_FADE_FROM_UPPERLEFT
+ { EK_fade, ED_from_upperright, -1, sal_True }, // AnimationEffect_FADE_FROM_UPPERRIGHT
+ { EK_fade, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_FADE_FROM_LOWERLEFT
+ { EK_fade, ED_from_lowerright, -1, sal_True }, // AnimationEffect_FADE_FROM_LOWERRIGHT
+ { EK_close,ED_vertical, -1, sal_True }, // AnimationEffect_CLOSE_VERTICAL
+ { EK_close,ED_horizontal, -1, sal_True }, // AnimationEffect_CLOSE_HORIZONTAL
+ { EK_open, ED_vertical, -1, sal_True }, // AnimationEffect_OPEN_VERTICAL
+ { EK_open, ED_horizontal, -1, sal_True }, // AnimationEffect_OPEN_HORIZONTAL
+ { EK_move, ED_path, -1, sal_True }, // AnimationEffect_PATH
+ { EK_move, ED_to_left, -1, sal_False },// AnimationEffect_MOVE_TO_LEFT
+ { EK_move, ED_to_top, -1, sal_False },// AnimationEffect_MOVE_TO_TOP
+ { EK_move, ED_to_right, -1, sal_False },// AnimationEffect_MOVE_TO_RIGHT
+ { EK_move, ED_to_bottom, -1, sal_False },// AnimationEffect_MOVE_TO_BOTTOM
+ { EK_fade, ED_spiral_inward_left, -1, sal_True }, // AnimationEffect_SPIRALIN_LEFT
+ { EK_fade, ED_spiral_inward_right, -1, sal_True }, // AnimationEffect_SPIRALIN_RIGHT
+ { EK_fade, ED_spiral_outward_left, -1, sal_True }, // AnimationEffect_SPIRALOUT_LEFT
+ { EK_fade, ED_spiral_outward_right, -1, sal_True }, // AnimationEffect_SPIRALOUT_RIGHT
+ { EK_dissolve, ED_none, -1, sal_True }, // AnimationEffect_DISSOLVE
+ { EK_wavyline, ED_from_left, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_LEFT
+ { EK_wavyline, ED_from_top, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_TOP
+ { EK_wavyline, ED_from_right, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_RIGHT
+ { EK_wavyline, ED_from_bottom, -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_BOTTOM
+ { EK_random, ED_none, -1, sal_True }, // AnimationEffect_RANDOM
+ { EK_lines, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_LINES
+ { EK_lines, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_LINES
+ { EK_laser, ED_from_left, -1, sal_True }, // AnimationEffect_LASER_FROM_LEFT
+ { EK_laser, ED_from_top, -1, sal_True }, // AnimationEffect_LASER_FROM_TOP
+ { EK_laser, ED_from_right, -1, sal_True }, // AnimationEffect_LASER_FROM_RIGHT
+ { EK_laser, ED_from_bottom, -1, sal_True }, // AnimationEffect_LASER_FROM_BOTTOM
+ { EK_laser, ED_from_upperleft, -1, sal_True }, // AnimationEffect_LASER_FROM_UPPERLEFT
+ { EK_laser, ED_from_upperright, -1, sal_True }, // AnimationEffect_LASER_FROM_UPPERRIGHT
+ { EK_laser, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_LASER_FROM_LOWERLEFT
+ { EK_laser, ED_from_lowerright, -1, sal_True }, // AnimationEffect_LASER_FROM_LOWERRIGHT
+ { EK_appear,ED_none, -1, sal_True }, // AnimationEffect_APPEAR
+ { EK_hide, ED_none, -1, sal_False },// AnimationEffect_HIDE
+ { EK_move, ED_from_upperleft, -1, sal_True }, // AnimationEffect_MOVE_FROM_UPPERLEFT
+ { EK_move, ED_from_upperright, -1, sal_True }, // AnimationEffect_MOVE_FROM_UPPERRIGHT
+ { EK_move, ED_from_lowerright, -1, sal_True }, // AnimationEffect_MOVE_FROM_LOWERRIGHT
+ { EK_move, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_MOVE_FROM_LOWERLEFT
+ { EK_move, ED_to_upperleft, -1, sal_False },// AnimationEffect_MOVE_TO_UPPERLEFT
+ { EK_move, ED_to_upperright, -1, sal_False },// AnimationEffect_MOVE_TO_UPPERRIGHT
+ { EK_move, ED_to_lowerright, -1, sal_False },// AnimationEffect_MOVE_TO_LOWERRIGHT
+ { EK_move, ED_to_lowerleft, -1, sal_False },// AnimationEffect_MOVE_TO_LOWERLEFT
+ { EK_move_short, ED_from_left, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LEFT
+ { EK_move_short, ED_from_upperleft, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT
+ { EK_move_short, ED_from_top, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_TOP
+ { EK_move_short, ED_from_upperright,-1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT
+ { EK_move_short, ED_from_right, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_RIGHT
+ { EK_move_short, ED_from_lowerright,-1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT
+ { EK_move_short, ED_from_bottom, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_BOTTOM
+ { EK_move_short, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT
+ { EK_move_short, ED_to_left, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LEFT
+ { EK_move_short, ED_to_upperleft, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_UPPERLEFT
+ { EK_move_short, ED_to_top, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_TOP
+ { EK_move_short, ED_to_upperright, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT
+ { EK_move_short, ED_to_right, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_RIGHT
+ { EK_move_short, ED_to_lowerright, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT
+ { EK_move_short, ED_to_bottom, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_BOTTOM
+ { EK_move_short, ED_to_lowerleft, -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LOWERLEFT
+ { EK_checkerboard, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_CHECKERBOARD
+ { EK_checkerboard, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_CHECKERBOARD
+ { EK_rotate, ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_ROTATE
+ { EK_rotate, ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_ROTATE
+ { EK_stretch,ED_horizontal, -1, sal_True }, // AnimationEffect_HORIZONTAL_STRETCH
+ { EK_stretch,ED_vertical, -1, sal_True }, // AnimationEffect_VERTICAL_STRETCH
+ { EK_stretch,ED_from_left, -1, sal_True }, // AnimationEffect_STRETCH_FROM_LEFT
+ { EK_stretch,ED_from_upperleft, -1, sal_True }, // AnimationEffect_STRETCH_FROM_UPPERLEFT
+ { EK_stretch,ED_from_top, -1, sal_True }, // AnimationEffect_STRETCH_FROM_TOP
+ { EK_stretch,ED_from_upperright,-1, sal_True }, // AnimationEffect_STRETCH_FROM_UPPERRIGHT
+ { EK_stretch,ED_from_right, -1, sal_True }, // AnimationEffect_STRETCH_FROM_RIGHT
+ { EK_stretch,ED_from_lowerright,-1, sal_True }, // AnimationEffect_STRETCH_FROM_LOWERRIGHT
+ { EK_stretch,ED_from_bottom, -1, sal_True }, // AnimationEffect_STRETCH_FROM_BOTTOM
+ { EK_stretch,ED_from_lowerleft, -1, sal_True }, // AnimationEffect_STRETCH_FROM_LOWERLEFT
+ { EK_move, ED_none, 0, sal_True }, // AnimationEffect_ZOOM_IN
+ { EK_move, ED_none, 50, sal_True }, // AnimationEffect_ZOOM_IN_SMALL
+ { EK_move, ED_spiral_inward_left, 0, sal_True }, // AnimationEffect_ZOOM_IN_SPIRAL
+ { EK_move, ED_none, 400, sal_True }, // AnimationEffect_ZOOM_OUT
+ { EK_move, ED_none, 200, sal_True }, // AnimationEffect_ZOOM_OUT_SMALL
+ { EK_move, ED_spiral_inward_left, 400, sal_True }, // AnimationEffect_ZOOM_OUT_SPIRAL
+ { EK_move, ED_from_left, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LEFT
+ { EK_move, ED_from_upperleft, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_UPPERLEFT
+ { EK_move, ED_from_top, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_TOP
+ { EK_move, ED_from_upperright, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT
+ { EK_move, ED_from_right, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_RIGHT
+ { EK_move, ED_from_lowerright, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT
+ { EK_move, ED_from_bottom, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_BOTTOM
+ { EK_move, ED_from_lowerleft, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LOWERLEFT
+ { EK_move, ED_from_center, 0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_CENTER
+ { EK_move, ED_from_left, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LEFT
+ { EK_move, ED_from_upperleft, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT
+ { EK_move, ED_from_top, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_TOP
+ { EK_move, ED_from_upperright,400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT
+ { EK_move, ED_from_right, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_RIGHT
+ { EK_move, ED_from_lowerright,400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT
+ { EK_move, ED_from_bottom, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_BOTTOM
+ { EK_move, ED_from_lowerleft, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT
+ { 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 )
+{
+ if( eEffect < AnimationEffect_NONE || eEffect > AnimationEffect_ZOOM_OUT_FROM_CENTER )
+ {
+ DBG_ERROR( "unknown animation effect!" );
+ eEffect = AnimationEffect_NONE;
+ }
+
+ const Effect& rEffect = AnimationEffectMap[eEffect];
+ eKind = rEffect.meKind;
+ eDirection = rEffect.meDirection;
+ nStartScale = rEffect.mnStartScale;
+ bIn = rEffect.mbIn;
+}
+
+SvXMLEnumMapEntry aXML_AnimationSpeed_EnumMap[] =
+{
+ { sXML_slow, AnimationSpeed_SLOW },
+ { sXML_medium, AnimationSpeed_MEDIUM },
+ { sXML_fast, AnimationSpeed_FAST },
+ { NULL, 0 }
+};
+
+enum XMLActionKind
+{
+ XMLE_SHOW,
+ XMLE_HIDE,
+ XMLE_DIM
+};
+
+struct XMLEffectHint
+{
+ XMLActionKind meKind;
+ sal_Bool mbTextEffect;
+ sal_Int32 mnShapeId;
+
+ XMLEffect meEffect;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+
+ AnimationSpeed meSpeed;
+ Color maDimColor;
+ OUString maSoundURL;
+ sal_Bool mbPlayFull;
+ sal_Int32 mnPresId;
+ sal_Int32 mnPathShapeId;
+
+ int operator<(const XMLEffectHint& rComp) const { return mnPresId < rComp.mnPresId; }
+
+ XMLEffectHint()
+ : meKind( XMLE_SHOW ), mbTextEffect( sal_False ), mnShapeId( -1 ),
+ meEffect( EK_none ), meDirection( ED_none ), mnStartScale( -1 ),
+ meSpeed( AnimationSpeed_SLOW ), maDimColor(0), mbPlayFull( sal_False ),
+ mnPresId( 0 ), mnPathShapeId( -1 )
+ {}
+};
+
+class AnimExpImpl
+{
+public:
+ list<XMLEffectHint> maEffects;
+ UniReference< XMLShapeExport > mxShapeExp;
+
+ OUString msDimColor;
+ OUString msDimHide;
+ OUString msDimPrev;
+ OUString msEffect;
+ OUString msPlayFull;
+ OUString msPresOrder;
+ OUString msSound;
+ OUString msSoundOn;
+ OUString msSpeed;
+ OUString msTextEffect;
+ OUString msAnimPath;
+
+ AnimExpImpl()
+ : msDimColor( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) ),
+ msDimHide( RTL_CONSTASCII_USTRINGPARAM( "DimHide" ) ),
+ msDimPrev( RTL_CONSTASCII_USTRINGPARAM( "DimPrevious" ) ),
+ msEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ),
+ msPlayFull( RTL_CONSTASCII_USTRINGPARAM( "PlayFull" ) ),
+ msPresOrder( RTL_CONSTASCII_USTRINGPARAM( "PresentationOrder" ) ),
+ msSound( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ),
+ msSoundOn( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ),
+ msSpeed( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ),
+ msTextEffect( RTL_CONSTASCII_USTRINGPARAM( "TextEffect" ) ),
+ msAnimPath( RTL_CONSTASCII_USTRINGPARAM( "AnimationPath" ) )
+ {}
+};
+
+XMLAnimationsExporter::XMLAnimationsExporter( XMLShapeExport* pShapeExp )
+{
+ mpImpl = new AnimExpImpl;
+ mpImpl->mxShapeExp = pShapeExp;
+}
+
+XMLAnimationsExporter::~XMLAnimationsExporter()
+{
+ delete mpImpl;
+ mpImpl = NULL;
+}
+
+void XMLAnimationsExporter::collect( Reference< XShape > xShape )
+{
+ try
+ {
+ // check for presentation shape service
+ {
+ Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
+ if( !xServiceInfo.is() || !xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.shape" ) ) ) )
+ return;
+ }
+
+ Reference< XPropertySet > xProps( xShape, UNO_QUERY );
+ if( xProps.is() )
+ {
+ const OUString aEmptyStr;
+
+ Reference< XPropertySetInfo > xInfo( xProps->getPropertySetInfo() );
+ AnimationEffect eEffect;
+ XMLEffectHint aEffect;
+
+ if( any2bool( xProps->getPropertyValue( mpImpl->msSoundOn ) ) )
+ {
+ xProps->getPropertyValue( mpImpl->msSound ) >>= aEffect.maSoundURL;
+ xProps->getPropertyValue( mpImpl->msPlayFull ) >>= aEffect.mbPlayFull;
+ }
+
+ xProps->getPropertyValue( mpImpl->msPresOrder ) >>= aEffect.mnPresId;
+ xProps->getPropertyValue( mpImpl->msSpeed ) >>= aEffect.meSpeed;
+ xProps->getPropertyValue( mpImpl->msEffect ) >>= eEffect;
+ if( eEffect != AnimationEffect_NONE )
+ {
+ sal_Bool bIn = sal_True;
+ setEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
+
+ aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
+
+ mpImpl->mxShapeExp->createShapeId( xShape );
+ aEffect.mnShapeId = mpImpl->mxShapeExp->getShapeId( xShape );
+
+ if( eEffect == AnimationEffect_PATH )
+ {
+ Reference< XShape > xPath;
+ xProps->getPropertyValue( mpImpl->msAnimPath ) >>= xPath;
+ if( xPath.is() )
+ {
+ mpImpl->mxShapeExp->createShapeId( xPath );
+ aEffect.mnPathShapeId = mpImpl->mxShapeExp->getShapeId( xPath );
+ }
+ }
+ mpImpl->maEffects.push_back( aEffect );
+
+ aEffect.mnPathShapeId = -1;
+ aEffect.maSoundURL = aEmptyStr;
+ }
+
+ xProps->getPropertyValue( mpImpl->msTextEffect ) >>= eEffect;
+ if( eEffect != AnimationEffect_NONE )
+ {
+ sal_Bool bIn = sal_True;
+ setEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
+ aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
+ aEffect.mbTextEffect = sal_True;
+
+ if( aEffect.mnShapeId == -1 )
+ {
+ mpImpl->mxShapeExp->createShapeId( xShape );
+ aEffect.mnShapeId = mpImpl->mxShapeExp->getShapeId( xShape );
+ }
+
+ mpImpl->maEffects.push_back( aEffect );
+ aEffect.mbTextEffect = sal_False;
+ aEffect.maSoundURL = aEmptyStr;
+ }
+
+ sal_Bool bDimPrev;
+ sal_Bool bDimHide;
+ xProps->getPropertyValue( mpImpl->msDimPrev ) >>= bDimPrev;
+ xProps->getPropertyValue( mpImpl->msDimHide ) >>= bDimHide;
+ if( bDimPrev || bDimHide )
+ {
+ aEffect.meKind = bDimPrev ? XMLE_DIM : XMLE_HIDE;
+ aEffect.meEffect = EK_none;
+ aEffect.meDirection = ED_none;
+ aEffect.meSpeed = AnimationSpeed_MEDIUM;
+ if( bDimPrev )
+ {
+ sal_Int32 nColor;
+ xProps->getPropertyValue( mpImpl->msDimColor ) >>= nColor;
+ aEffect.maDimColor.SetColor( nColor );
+ }
+
+ if( aEffect.mnShapeId == -1 )
+ {
+ mpImpl->mxShapeExp->createShapeId( xShape );
+ aEffect.mnShapeId = mpImpl->mxShapeExp->getShapeId( xShape );
+ }
+
+ mpImpl->maEffects.push_back( aEffect );
+ aEffect.maSoundURL = aEmptyStr;
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ DBG_ERROR("exception catched while collection animation information!");
+ }
+}
+
+void XMLAnimationsExporter::export( SvXMLExport& rExport )
+{
+ mpImpl->maEffects.sort();
+
+ list<XMLEffectHint>::iterator aIter = mpImpl->maEffects.begin();
+ const list<XMLEffectHint>::iterator aEnd = mpImpl->maEffects.end();
+
+ OUStringBuffer sTmp;
+
+ if( aIter != aEnd )
+ {
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, sXML_animations, sal_True, sal_True );
+
+ do
+ {
+ XMLEffectHint& rEffect = *aIter;
+
+ DBG_ASSERT( rEffect.mnShapeId != -1, "shape id creation failed for animation effect?" );
+
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, sXML_shape_id, OUString::valueOf( rEffect.mnShapeId ) );
+
+ if( rEffect.meKind == XMLE_DIM )
+ {
+ // export a dim action;
+
+ SvXMLUnitConverter::convertColor( sTmp, rEffect.maDimColor );
+ rExport.AddAttribute( XML_NAMESPACE_DRAW, sXML_color, sTmp.makeStringAndClear() );
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, sXML_dim, sal_True, sal_True );
+ }
+ else
+ {
+
+ if( rEffect.meEffect != EK_none )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meEffect, aXML_AnimationEffect_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, sXML_effect, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.meDirection != ED_none )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meDirection, aXML_AnimationDirection_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, sXML_direction, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.mnStartScale != -1 )
+ {
+ SvXMLUnitConverter::convertPercent( sTmp, rEffect.mnStartScale );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, sXML_start_scale, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
+ {
+ SvXMLUnitConverter::convertEnum( sTmp, rEffect.meSpeed, aXML_AnimationSpeed_EnumMap );
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, sXML_speed, sTmp.makeStringAndClear() );
+ }
+
+ if( rEffect.mnPathShapeId != -1 )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, sXML_path_id, OUString::valueOf( rEffect.mnPathShapeId ) );
+ }
+
+ char *pLocalName;
+ if( rEffect.meKind == XMLE_SHOW )
+ {
+ if( rEffect.mbTextEffect )
+ pLocalName = sXML_show_text;
+ else
+ pLocalName = sXML_show_shape;
+ }
+ else
+ {
+ if( rEffect.mbTextEffect )
+ pLocalName = sXML_hide_text;
+ else
+ pLocalName = sXML_hide_shape;
+ }
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, pLocalName, sal_True, sal_True );
+ if( rEffect.maSoundURL.getLength() != 0 )
+ {
+ rExport.AddAttribute(XML_NAMESPACE_XLINK, sXML_href, rEffect.maSoundURL );
+ 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( rEffect.mbPlayFull )
+ rExport.AddAttributeASCII( XML_NAMESPACE_PRESENTATION, sXML_play_full, sXML_true );
+
+ SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, sXML_sound, sal_True, sal_True );
+ }
+ }
+
+ aIter++;
+ }
+ while( aIter != aEnd );
+ }
+
+ mpImpl->maEffects.clear();
+} \ No newline at end of file
diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx
new file mode 100644
index 000000000000..1912c4d48d05
--- /dev/null
+++ b/xmloff/source/draw/animimp.cxx
@@ -0,0 +1,697 @@
+/*************************************************************************
+ *
+ * $RCSfile: animimp.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: cl $ $Date: 2000-12-19 16:23:47 $
+ *
+ * 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 <tools/debug.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PRESENTATION_ANIMATIONEFFECT_HPP_
+#include <com/sun/star/presentation/AnimationEffect.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PRESENTATION_ANIMATIONSPEED_HPP_
+#include <com/sun/star/presentation/AnimationSpeed.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#endif
+
+#include <stl/list>
+
+#ifndef _TOOLS_COLOR_HXX
+#include <tools/color.hxx>
+#endif
+
+#ifndef _CPPUHELPER_EXTRACT_HXX_
+#include <cppuhelper/extract.hxx>
+#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_XMLEMENT_HXX
+#include "xmlement.hxx"
+#endif
+*/
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_ANIM_HXX
+#include "anim.hxx"
+#endif
+
+#ifndef _XMLOFF_ANIMIMP_HXX
+#include "animimp.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::presentation;
+
+AnimationEffect getEffect( XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, sal_Bool bIn )
+{
+ if( bIn )
+ {
+ switch( eKind )
+ {
+ 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;
+ }
+ }
+ else
+ {
+ switch( eKind )
+ {
+ case EK_move:
+ switch( eDirection )
+ {
+ 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;
+ case ED_to_bottom: return AnimationEffect_MOVE_TO_BOTTOM;
+ case ED_to_upperleft: return AnimationEffect_MOVE_TO_UPPERLEFT;
+ case ED_to_upperright: return AnimationEffect_MOVE_TO_UPPERRIGHT;
+ 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:
+ 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;
+ }
+ return AnimationEffect_MOVE_SHORT_TO_LEFT;
+ }
+ }
+
+ return AnimationEffect_NONE;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+class AnimImpImpl
+{
+public:
+ Reference< XPropertySet > mxLastShape;
+ sal_Int32 mnPresOrder;
+ sal_Int32 mnLastShapeId;
+
+ OUString msDimColor;
+ OUString msDimHide;
+ OUString msDimPrev;
+ OUString msEffect;
+ OUString msPlayFull;
+ OUString msPresOrder;
+ OUString msSound;
+ OUString msSoundOn;
+ OUString msSpeed;
+ OUString msTextEffect;
+ OUString msPresShapeService;
+ OUString msAnimPath;
+
+ AnimImpImpl()
+ : mnPresOrder( 0 ),
+ mnLastShapeId( -1 ),
+ msDimColor( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) ),
+ msDimHide( RTL_CONSTASCII_USTRINGPARAM( "DimHide" ) ),
+ msDimPrev( RTL_CONSTASCII_USTRINGPARAM( "DimPrevious" ) ),
+ msEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ),
+ msPlayFull( RTL_CONSTASCII_USTRINGPARAM( "PlayFull" ) ),
+ msPresOrder( RTL_CONSTASCII_USTRINGPARAM( "PresentationOrder" ) ),
+ msSound( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ),
+ msSoundOn( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ),
+ msSpeed( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ),
+ msTextEffect( RTL_CONSTASCII_USTRINGPARAM( "TextEffect" ) ),
+ msPresShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.shape" ) ),
+ msAnimPath( RTL_CONSTASCII_USTRINGPARAM( "AnimationPath" ) )
+ {}
+};
+
+///////////////////////////////////////////////////////////////////////
+
+enum XMLActionKind
+{
+ XMLE_SHOW,
+ XMLE_HIDE,
+ XMLE_DIM
+};
+
+class XMLAnimationsEffectContext : public SvXMLImportContext
+{
+public:
+ AnimImpImpl* mpImpl;
+
+ XMLActionKind meKind;
+ sal_Bool mbTextEffect;
+ sal_Int32 mnShapeId;
+
+ XMLEffect meEffect;
+ XMLEffectDirection meDirection;
+ sal_Int16 mnStartScale;
+
+ AnimationSpeed meSpeed;
+ Color maDimColor;
+ OUString maSoundURL;
+ sal_Bool mbPlayFull;
+ sal_Int32 mnPathShapeId;
+
+public:
+ TYPEINFO();
+
+ XMLAnimationsEffectContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLocalName,
+ const Reference< XAttributeList >& xAttrList,
+ AnimImpImpl* pImpl);
+ virtual ~XMLAnimationsEffectContext();
+
+ virtual void EndElement();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const OUString& rLocalName,
+ const Reference< XAttributeList >& xAttrList );
+};
+
+class XMLAnimationsSoundContext : public SvXMLImportContext
+{
+ XMLAnimationsEffectContext* mpParent;
+
+public:
+ TYPEINFO();
+
+ XMLAnimationsSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent );
+ virtual ~XMLAnimationsSoundContext();
+};
+
+TYPEINIT1( XMLAnimationsSoundContext, SvXMLImportContext );
+
+XMLAnimationsSoundContext::XMLAnimationsSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, XMLAnimationsEffectContext* 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->maSoundURL = sValue;
+ }
+ break;
+ case XML_NAMESPACE_PRESENTATION:
+ if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_play_full ) ) )
+ {
+ mpParent->mbPlayFull = sValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_true ) );
+ }
+ }
+ }
+ }
+}
+
+XMLAnimationsSoundContext::~XMLAnimationsSoundContext()
+{
+}
+
+
+TYPEINIT1( XMLAnimationsEffectContext, SvXMLImportContext );
+
+XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, AnimImpImpl* pImpl )
+: SvXMLImportContext(rImport, nPrfx, rLocalName),
+ mpImpl( pImpl ),
+ meKind( XMLE_SHOW ), mbTextEffect( sal_False ), mnShapeId( -1 ), mnPathShapeId( -1 ),
+ meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
+ meSpeed( AnimationSpeed_MEDIUM ), maDimColor(0), mbPlayFull( sal_False )
+{
+ if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_show_shape ) ) )
+ {
+ meKind = XMLE_SHOW;
+ }
+ else if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_show_text ) ) )
+ {
+ meKind = XMLE_SHOW;
+ mbTextEffect = sal_True;
+ }
+ else if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_hide_shape ) ) )
+ {
+ meKind = XMLE_HIDE;
+ }
+ else if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_hide_text ) ) )
+ {
+ meKind = XMLE_HIDE;
+ mbTextEffect = sal_True;
+ }
+ else if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_dim ) ) )
+ {
+ meKind = XMLE_DIM;
+ }
+ else
+ {
+ // unknown action, overread
+ return;
+ }
+
+ // read attributes
+ 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_DRAW:
+ if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_shape_id ) ) )
+ {
+ SvXMLUnitConverter::convertNumber(mnShapeId, sValue);
+ }
+ else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_color ) ) )
+ {
+ SvXMLUnitConverter::convertColor(maDimColor, sValue);
+ }
+ break;
+
+ case XML_NAMESPACE_PRESENTATION:
+ 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_path_id ) ) )
+ {
+ SvXMLUnitConverter::convertNumber(mnPathShapeId, sValue);
+ }
+ break;
+ }
+ }
+}
+
+XMLAnimationsEffectContext::~XMLAnimationsEffectContext()
+{
+}
+
+SvXMLImportContext * XMLAnimationsEffectContext::CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
+{
+ return new XMLAnimationsSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
+}
+
+void XMLAnimationsEffectContext::EndElement()
+{
+ // set effect on shape
+
+ try
+ {
+ UniReference< XMLShapeImportHelper > xShapeImport( GetImport().GetShapeImport() );
+ Any aAny;
+
+ if( mnShapeId != -1 )
+ {
+ Reference< XPropertySet > xSet;
+ if( mpImpl->mnLastShapeId != mnShapeId )
+ {
+ xSet = Reference< XPropertySet >::query( xShapeImport->getShapeFromId( mnShapeId ) );
+ if( xSet.is() )
+ {
+ // check for presentation shape service
+ {
+ Reference< XServiceInfo > xServiceInfo( xSet, UNO_QUERY );
+ if( !xServiceInfo.is() || !xServiceInfo->supportsService( mpImpl->msPresShapeService ) )
+ return;
+ }
+
+ mpImpl->mnLastShapeId = mnShapeId;
+ mpImpl->mxLastShape = xSet;
+
+ aAny <<= mpImpl->mnPresOrder++;
+ xSet->setPropertyValue( mpImpl->msPresOrder, aAny );
+ }
+ }
+ else
+ {
+ xSet = mpImpl->mxLastShape;
+ }
+
+ if( xSet.is() )
+ {
+ if( meKind == XMLE_DIM )
+ {
+ aAny = bool2any( sal_True );
+ xSet->setPropertyValue( mpImpl->msDimPrev, aAny );
+
+ aAny <<= (sal_Int32)maDimColor.GetColor();
+ xSet->setPropertyValue( mpImpl->msDimColor, aAny );
+ }
+ else
+ {
+ if( meKind == XMLE_HIDE && !mbTextEffect && meEffect == EK_none )
+ {
+ aAny = bool2any( sal_True );
+ xSet->setPropertyValue( mpImpl->msDimHide, aAny );
+ }
+ else
+ {
+ const AnimationEffect eEffect = getEffect( meEffect, meDirection, mnStartScale, meKind == XMLE_SHOW );
+
+ aAny <<= eEffect;
+ xSet->setPropertyValue( mbTextEffect ? mpImpl->msTextEffect : mpImpl->msEffect, aAny );
+
+ aAny <<= meSpeed;
+ xSet->setPropertyValue( mpImpl->msSpeed, aAny );
+
+ if( eEffect == AnimationEffect_PATH && mnPathShapeId != -1 )
+ {
+ Reference< XShape > xPath( xShapeImport->getShapeFromId( mnPathShapeId ) );
+ if( xPath.is() )
+ {
+ aAny <<= xPath;
+ xSet->setPropertyValue( mpImpl->msAnimPath, aAny );
+ }
+ }
+ }
+ }
+ }
+
+ if( maSoundURL.getLength() != 0 )
+ {
+ aAny <<= maSoundURL;
+ xSet->setPropertyValue( mpImpl->msSound, aAny );
+
+ aAny <<= bool2any( mbPlayFull );
+ xSet->setPropertyValue( mpImpl->msPlayFull, aAny );
+
+ aAny <<= bool2any( sal_True );
+ xSet->setPropertyValue( mpImpl->msSoundOn, aAny );
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ DBG_ERROR( "exception catched while importing animation information!" );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLAnimationsContext, SvXMLImportContext );
+
+XMLAnimationsContext::XMLAnimationsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList)
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+ mpImpl = new AnimImpImpl();
+}
+
+XMLAnimationsContext::~XMLAnimationsContext()
+{
+ delete mpImpl;
+}
+
+SvXMLImportContext * XMLAnimationsContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return new XMLAnimationsEffectContext( GetImport(), nPrefix, rLocalName, xAttrList, mpImpl );
+}
diff --git a/xmloff/source/draw/makefile.mk b/xmloff/source/draw/makefile.mk
index 5ecd1b50caca..2bcf31b50af8 100644
--- a/xmloff/source/draw/makefile.mk
+++ b/xmloff/source/draw/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $
+# last change: $Author: cl $ $Date: 2000-12-19 16:23:47 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -75,6 +75,9 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
SLOFILES = \
+ $(SLO)$/ximpshow.obj\
+ $(SLO)$/animimp.obj\
+ $(SLO)$/animexp.obj\
$(SLO)$/numithdl.obj\
$(SLO)$/sdxmlimp.obj \
$(SLO)$/sdxmlexp.obj \
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 6270b1d8321d..fc1a9faa5103 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sdxmlexp.cxx,v $
*
- * $Revision: 1.34 $
+ * $Revision: 1.35 $
*
- * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $
+ * last change: $Author: cl $ $Date: 2000-12-19 16:23:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -85,6 +85,10 @@
#include "xmlmetae.hxx"
#endif
+#ifndef _COM_SUN_STAR_PRESENTATION_XCUSTOMPRESENTATIONSUPPLIER_HPP_
+#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
+#endif
+
#ifndef _COM_SUN_STAR_DOCUMENT_XDOCUMENTINFOSUPPLIER_HPP_
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
#endif
@@ -251,6 +255,12 @@
using namespace ::rtl;
using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::presentation;
+
//////////////////////////////////////////////////////////////////////////////
@@ -1669,6 +1679,9 @@ void SdXMLExport::_ExportContent()
if( maDrawPagesStyleNames[nPageInd].getLength() )
AddAttribute(XML_NAMESPACE_DRAW, sXML_style_name, maDrawPagesStyleNames[nPageInd]);
+ if( IsImpress() )
+ AddAttribute(XML_NAMESPACE_DRAW, sXML_id, OUString::valueOf( sal_Int32( nPageInd + 1 ) ) );
+
// draw:master-page-name
uno::Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, uno::UNO_QUERY);
if(xMasterPageInt.is())
@@ -1693,6 +1706,13 @@ void SdXMLExport::_ExportContent()
// write page
SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, sXML_page, sal_True, sal_True);
+ // prepare animations exporter if impress
+ if(IsImpress())
+ {
+ UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
+ GetShapeExport()->setAnimationsExporter( xAnimExport );
+ }
+
// write graphic objects on this page (if any)
uno::Reference< container::XIndexAccess > xShapes(xDrawPage, uno::UNO_QUERY);
if(xShapes.is() && xShapes->getCount())
@@ -1701,9 +1721,18 @@ void SdXMLExport::_ExportContent()
ImpWriteSingleShapeStyleInfos(xShapes);
}
- // write presentation notes (ONLY if presentation)
+ // write animations and presentation notes (ONLY if presentation)
if(IsImpress())
{
+ // animations
+ UniReference< XMLAnimationsExporter > xAnimExport( GetShapeExport()->getAnimationsExporter() );
+ if( xAnimExport.is() )
+ xAnimExport->export( *this );
+
+ xAnimExport = NULL;
+ GetShapeExport()->setAnimationsExporter( xAnimExport );
+
+ // presentations
uno::Reference< presentation::XPresentationPage > xPresPage(xDrawPage, uno::UNO_QUERY);
if(xPresPage.is())
{
@@ -1724,6 +1753,60 @@ void SdXMLExport::_ExportContent()
}
}
}
+
+ if( IsImpress() )
+ {
+ Reference< XCustomPresentationSupplier > xSup( GetModel(), UNO_QUERY );
+ if( xSup.is() )
+ {
+ Reference< container::XNameContainer > xShows( xSup->getCustomPresentations() );
+ if( xShows.is() )
+ {
+ const OUString sPageNumber( RTL_CONSTASCII_USTRINGPARAM("Number") );
+
+ SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, sXML_shows, sal_True, sal_True);
+
+ Sequence< OUString > aShowNames = xShows->getElementNames();
+ const OUString* pShowNames = aShowNames.getArray();
+ const sal_Int32 nCount = aShowNames.getLength();
+
+ Reference< XIndexContainer > xShow;
+ Reference< XPropertySet > xPageSet;
+ sal_Int32 nPageNumber;
+ OUStringBuffer sTmp;
+
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++, pShowNames++ )
+ {
+ AddAttribute(XML_NAMESPACE_PRESENTATION, sXML_name, *pShowNames );
+
+ xShows->getByName( *pShowNames ) >>= xShow;
+ DBG_ASSERT( xShow.is(), "invalid custom show!" );
+ if( !xShow.is() )
+ continue;
+
+ const sal_Int32 nPageCount = xShow->getCount();
+ for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++ )
+ {
+ xShow->getByIndex( nPage ) >>= xPageSet;
+
+ if( !xPageSet.is() )
+ continue;
+
+ if( xPageSet->getPropertyValue( sPageNumber ) >>= nPageNumber )
+ {
+ if( sTmp.getLength() != 0 )
+ sTmp.append( sal_Unicode( ',' ) );
+ sTmp.append( nPageNumber );
+ }
+ }
+
+ AddAttribute(XML_NAMESPACE_PRESENTATION, sXML_pages, sTmp.makeStringAndClear() );
+
+ SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, sXML_show, sal_True, sal_True);
+ }
+ }
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////
@@ -2861,7 +2944,7 @@ void SdXMLExport::ImpExport3DShape(SvXMLExport& rExp,
case XmlShapeTypeDraw3DCubeObject:
{
// write 3DCube shape
- SvXMLElementExport aOBJ(rExp, XML_NAMESPACE_DR3D, sXML_3DCube, sal_True, sal_True);
+ SvXMLElementExport aOBJ(rExp, XML_NAMESPACE_DR3D, sXML_cube, sal_True, sal_True);
// minEdge
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")));
@@ -2899,7 +2982,7 @@ void SdXMLExport::ImpExport3DShape(SvXMLExport& rExp,
case XmlShapeTypeDraw3DSphereObject:
{
// write 3DSphere shape
- SvXMLElementExport aOBJ(rExp, XML_NAMESPACE_DR3D, sXML_3DSphere, sal_True, sal_True);
+ SvXMLElementExport aOBJ(rExp, XML_NAMESPACE_DR3D, sXML_sphere, sal_True, sal_True);
// Center
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")));
@@ -3032,12 +3115,12 @@ void SdXMLExport::ImpExport3DShape(SvXMLExport& rExp,
if(eShapeType == XmlShapeTypeDraw3DLatheObject)
{
// write 3DLathe shape
- SvXMLElementExport aOBJ(rExp, XML_NAMESPACE_DR3D, sXML_3DLathe, sal_True, sal_True);
+ SvXMLElementExport aOBJ(rExp, XML_NAMESPACE_DR3D, sXML_rotate, sal_True, sal_True);
}
else
{
// write 3DExtrude shape
- SvXMLElementExport aOBJ(rExp, XML_NAMESPACE_DR3D, sXML_3DExtrude, sal_True, sal_True);
+ SvXMLElementExport aOBJ(rExp, XML_NAMESPACE_DR3D, sXML_extrude, sal_True, sal_True);
}
break;
}
@@ -3401,7 +3484,7 @@ void SdXMLExport::ImpStartWriteGroupShape(SvXMLExport& rExp,
ImpPrepareExport3DScene(rExp, xShape, XmlShapeTypeDraw3DSceneObject, nFeatures, pRefPoint);
// write 3DScene shape
- SvXMLElementExport aOBJ(rExp, XML_NAMESPACE_DR3D, sXML_3DScene, sal_True, sal_True);
+ SvXMLElementExport aOBJ(rExp, XML_NAMESPACE_DR3D, sXML_scene, sal_True, sal_True);
// write 3DSceneLights
ImpExport3DLamps(rExp, xShape, XmlShapeTypeDraw3DSceneObject, nFeatures, pRefPoint);
@@ -3689,8 +3772,17 @@ void SdXMLExport::ImpWriteSingleShapeStyleInfos(uno::Reference< container::XInde
uno::Any aAny(xShapes->getByIndex(nShapeId));
uno::Reference< drawing::XShape > xShape;
- if(aAny >>= xShape)
+ aAny >>= xShape;
+ if(xShape.is())
{
+ // collect animation informations if needed
+ {
+ UniReference< XMLAnimationsExporter > xAnimExport( GetShapeExport()->getAnimationsExporter() );
+ if( xAnimExport.is() )
+ xAnimExport->collect( xShape );
+ }
+
+ // check for group or scene shape
uno::Reference< container::XIndexAccess > xShapes(xShape, uno::UNO_QUERY);
if(xShapes.is() && xShapes->getCount())
{
@@ -3720,7 +3812,7 @@ void SdXMLExport::ImpWriteSingleShapeStyleInfos(uno::Reference< container::XInde
ImpPrepareExport3DScene(*this, xShape, XmlShapeTypeDraw3DSceneObject, nFeatures, pRefPoint);
// write 3DScene shape
- SvXMLElementExport aOBJ(*this, XML_NAMESPACE_DR3D, sXML_3DScene, sal_True, sal_True);
+ SvXMLElementExport aOBJ(*this, XML_NAMESPACE_DR3D, sXML_scene, sal_True, sal_True);
// write 3DSceneLights
ImpExport3DLamps(*this, xShape, XmlShapeTypeDraw3DSceneObject, nFeatures, pRefPoint);
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index 82c5c2f8d405..0008ad0d9128 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sdxmlimp.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: cl $ $Date: 2000-12-12 14:38:12 $
+ * last change: $Author: cl $ $Date: 2000-12-19 16:23:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -152,6 +152,7 @@ static __FAR_DATA SvXMLTokenMapEntry aDocElemTokenMap[] =
static __FAR_DATA SvXMLTokenMapEntry aBodyElemTokenMap[] =
{
{ XML_NAMESPACE_DRAW, sXML_page, XML_TOK_BODY_PAGE },
+ { XML_NAMESPACE_PRESENTATION, sXML_shows, XML_TOK_BODY_SHOWS },
XML_TOKEN_MAP_END
};
@@ -201,6 +202,7 @@ static __FAR_DATA SvXMLTokenMapEntry aDrawPageAttrTokenMap[] =
{ XML_NAMESPACE_DRAW, sXML_style_name, XML_TOK_DRAWPAGE_STYLE_NAME },
{ XML_NAMESPACE_DRAW, sXML_master_page_name, XML_TOK_DRAWPAGE_MASTER_PAGE_NAME },
{ XML_NAMESPACE_PRESENTATION, sXML_presentation_page_layout_name, XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME },
+ { XML_NAMESPACE_DRAW, sXML_id, XML_TOK_DRAWPAGE_ID },
XML_TOKEN_MAP_END
};
@@ -650,6 +652,25 @@ SvXMLImportContext *SdXMLImport::CreateScriptContext(
GetModel() );
return pContext;
}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdXMLImport::setDrawPageId( sal_Int32 nId, uno::Reference< drawing::XDrawPage > xPage )
+{
+ maDrawPageIds[nId] = xPage;
+}
+
+uno::Reference< drawing::XDrawPage > SdXMLImport::getDrawPageForId( sal_Int32 nId )
+{
+ uno::Reference< drawing::XDrawPage > xPage;
+
+ DrawPageIdMap::iterator aFound( maDrawPageIds.find( nId ) );
+ if( aFound != maDrawPageIds.end() )
+ xPage = (*aFound).second;
+
+ return xPage;
+}
+
//////////////////////////////////////////////////////////////////////////////
uno::Reference< xml::sax::XDocumentHandler >
diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx
index 39d306491cb3..b4e8f8919c7b 100644
--- a/xmloff/source/draw/sdxmlimp_impl.hxx
+++ b/xmloff/source/draw/sdxmlimp_impl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sdxmlimp_impl.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: cl $ $Date: 2000-12-12 14:38:12 $
+ * last change: $Author: cl $ $Date: 2000-12-19 16:23:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,6 +62,10 @@
#ifndef _SDXMLIMP_IMPL_HXX
#define _SDXMLIMP_IMPL_HXX
+#ifndef _COM_SUN_STAR_DRAWING_XDRAWPAGE_HPP_
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#endif
+
#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
#include <com/sun/star/frame/XModel.hpp>
#endif
@@ -101,7 +105,8 @@ enum SdXMLDocElemTokenMap
enum SdXMLBodyElemTokenMap
{
- XML_TOK_BODY_PAGE
+ XML_TOK_BODY_PAGE,
+ XML_TOK_BODY_SHOWS
};
enum SdXMLStylesElemTokenMap
@@ -165,7 +170,8 @@ enum SdXMLDrawPageAttrTokenMap
XML_TOK_DRAWPAGE_NAME,
XML_TOK_DRAWPAGE_STYLE_NAME,
XML_TOK_DRAWPAGE_MASTER_PAGE_NAME,
- XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME
+ XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME,
+ XML_TOK_DRAWPAGE_ID
};
enum SdXMLDrawPageElemTokenMap
@@ -184,6 +190,18 @@ enum SdXMLPresentationPlaceholderAttrTokenMap
//////////////////////////////////////////////////////////////////////////////
+struct SdXMLltXDrawPageId
+{
+ bool operator()(sal_Int32 nId1, sal_Int32 nId2 ) const
+ {
+ return nId1 < nId2;
+ }
+};
+
+typedef std::map< sal_Int32, com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >, SdXMLltXDrawPageId > DrawPageIdMap;
+
+//////////////////////////////////////////////////////////////////////////////
+
class SvXMLUnitConverter;
class SvXMLTokenMap;
class XMLSdPropHdlFactory;
@@ -227,6 +245,8 @@ class SdXMLImport: public SvXMLImport
sal_Bool mbIsDraw;
sal_Bool mbLoadDoc;
+ DrawPageIdMap maDrawPageIds;
+
protected:
// This method is called after the namespace map has been updated, but
// before a context for the current element has been pushed.
@@ -296,6 +316,9 @@ public:
// import pool defaults. Parameter contains pool defaults read
// from input data. These data needs to be set at the model.
void ImportPoolDefaults(const XMLPropStyleContext* pPool);
+
+ void setDrawPageId( sal_Int32 nId, com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > );
+ com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > getDrawPageForId( sal_Int32 nId );
};
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler >
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx
index 9e4ad463125e..22d78fb04f56 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: shapeimport.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $
+ * last change: $Author: cl $ $Date: 2000-12-19 16:23:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -261,7 +261,7 @@ static __FAR_DATA SvXMLTokenMapEntry aGroupShapeElemTokenMap[] =
{ XML_NAMESPACE_CHART, sXML_chart, XML_TOK_GROUP_CHART },
{ XML_NAMESPACE_DRAW, sXML_image, XML_TOK_GROUP_IMAGE },
- { XML_NAMESPACE_DR3D, sXML_3DScene, XML_TOK_GROUP_3DSCENE },
+ { XML_NAMESPACE_DR3D, sXML_scene, XML_TOK_GROUP_3DSCENE },
XML_TOKEN_MAP_END
};
@@ -277,11 +277,11 @@ const SvXMLTokenMap& XMLShapeImportHelper::GetGroupShapeElemTokenMap()
static __FAR_DATA SvXMLTokenMapEntry a3DSceneShapeElemTokenMap[] =
{
- { XML_NAMESPACE_DR3D, sXML_3DScene, XML_TOK_3DSCENE_3DSCENE },
- { XML_NAMESPACE_DR3D, sXML_3DCube, XML_TOK_3DSCENE_3DCUBE },
- { XML_NAMESPACE_DR3D, sXML_3DSphere, XML_TOK_3DSCENE_3DSPHERE },
- { XML_NAMESPACE_DR3D, sXML_3DLathe, XML_TOK_3DSCENE_3DLATHE },
- { XML_NAMESPACE_DR3D, sXML_3DExtrude, XML_TOK_3DSCENE_3DEXTRUDE },
+ { XML_NAMESPACE_DR3D, sXML_scene, XML_TOK_3DSCENE_3DSCENE },
+ { XML_NAMESPACE_DR3D, sXML_cube, XML_TOK_3DSCENE_3DCUBE },
+ { XML_NAMESPACE_DR3D, sXML_sphere, XML_TOK_3DSCENE_3DSPHERE },
+ { XML_NAMESPACE_DR3D, sXML_rotate, XML_TOK_3DSCENE_3DLATHE },
+ { XML_NAMESPACE_DR3D, sXML_extrude, XML_TOK_3DSCENE_3DEXTRUDE },
XML_TOKEN_MAP_END
};
diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx
index 00ff781f5083..f54d8bf68792 100644
--- a/xmloff/source/draw/ximpbody.cxx
+++ b/xmloff/source/draw/ximpbody.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ximpbody.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $
+ * last change: $Author: cl $ $Date: 2000-12-19 16:23:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -97,6 +97,10 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
#ifndef _XMLOFF_PROPERTYSETMAPPER_HXX
#include "xmlprmap.hxx"
#endif
@@ -105,6 +109,10 @@
#include "families.hxx"
#endif
+#ifndef _XMLOFF_XIMPSHOW_HXX
+#include "ximpshow.hxx"
+#endif
+
#ifndef _XMLOFF_PROPERTYSETMERGER_HXX_
#include "PropertySetMerger.hxx"
#endif
@@ -120,6 +128,8 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
uno::Reference< drawing::XShapes >& rShapes)
: SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
{
+ sal_Int32 nPageId = -1;
+
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
for(sal_Int16 i=0; i < nAttrCount; i++)
@@ -152,13 +162,24 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
maPageLayoutName = sValue;
break;
}
+ case XML_TOK_DRAWPAGE_ID:
+ {
+ sal_Int32 nId;
+ if( SvXMLUnitConverter::convertNumber( nId, sValue ) )
+ nPageId = nId;
+ }
}
}
+ uno::Reference< drawing::XDrawPage > xDrawPage(rShapes, uno::UNO_QUERY);
+
+ // set an id?
+ if( nPageId != -1 && xDrawPage.is() )
+ rImport.setDrawPageId( nPageId, xDrawPage );
+
// set PageName?
if(maName.getLength())
{
- uno::Reference< drawing::XDrawPage > xDrawPage(rShapes, uno::UNO_QUERY);
if(xDrawPage.is())
{
uno::Reference < container::XNamed > xNamed(xDrawPage, uno::UNO_QUERY);
@@ -406,6 +427,10 @@ SvXMLImportContext *SdXMLBodyContext::CreateChildContext(
}
break;
}
+ case XML_TOK_BODY_SHOWS:
+ {
+ pContext = new SdXMLShowsContext( GetSdImport(), nPrefix, rLocalName, xAttrList );
+ }
}
// call parent when no own context was created
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx
index 8374cfa23f76..73054230b6dd 100644
--- a/xmloff/source/draw/ximppage.cxx
+++ b/xmloff/source/draw/ximppage.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ximppage.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: cl $ $Date: 2000-12-13 19:16:42 $
+ * last change: $Author: cl $ $Date: 2000-12-19 16:23:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,6 +61,12 @@
#pragma hdrstop
+#include "xmlkywd.hxx"
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
#ifndef _XIMPPAGE_HXX
#include "ximppage.hxx"
#endif
@@ -69,6 +75,10 @@
#include "ximpshap.hxx"
#endif
+#ifndef _XMLOFF_ANIMIMP_HXX
+#include "animimp.hxx"
+#endif
+
using namespace ::rtl;
using namespace ::com::sun::star;
@@ -101,14 +111,20 @@ SvXMLImportContext* SdXMLGenericPageContext::CreateChildContext( USHORT nPrefix,
{
SvXMLImportContext* pContext = 0L;
- // call GroupChildContext function at common ShapeImport
- pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList, mxShapes);
+ if( nPrefix == XML_NAMESPACE_PRESENTATION && rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_animations ) ) )
+ {
+ pContext = new XMLAnimationsContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ }
+ else
+ {
+ // call GroupChildContext function at common ShapeImport
+ pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
+ GetImport(), nPrefix, rLocalName, xAttrList, mxShapes);
+ }
// call parent when no own context was created
if(!pContext)
- pContext = SvXMLImportContext::CreateChildContext(
- nPrefix, rLocalName, xAttrList);
+ pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
return pContext;
}
diff --git a/xmloff/source/draw/ximpshow.cxx b/xmloff/source/draw/ximpshow.cxx
new file mode 100644
index 000000000000..445da9b35fcb
--- /dev/null
+++ b/xmloff/source/draw/ximpshow.cxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * $RCSfile: ximpshow.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: cl $ $Date: 2000-12-19 16:23:48 $
+ *
+ * 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 <tools/debug.hxx>
+
+#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PRESENTATION_XCUSTOMPRESENTATIONSUPPLIER_HPP_
+#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXCONTAINER_HPP_
+#include <com/sun/star/container/XIndexContainer.hpp>
+#endif
+
+#include "xmlkywd.hxx"
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_XIMPSHOW_HXX
+#include "ximpshow.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::container;
+using namespace ::com::sun::star::presentation;
+
+///////////////////////////////////////////////////////////////////////
+
+class ShowsImpImpl
+{
+public:
+ Reference< XSingleServiceFactory > mxShowFactory;
+ Reference< XNameContainer > mxShows;
+ SdXMLImport& mrImport;
+
+ ShowsImpImpl( SdXMLImport& rImport )
+ : mrImport( rImport )
+ {}
+};
+
+///////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SdXMLShowsContext, SvXMLImportContext );
+
+SdXMLShowsContext::SdXMLShowsContext( SdXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList )
+: SvXMLImportContext(rImport, nPrfx, rLocalName)
+{
+ mpImpl = new ShowsImpImpl( rImport );
+
+ Reference< XCustomPresentationSupplier > xShowsSupplier( rImport.GetModel(), UNO_QUERY );
+ if( xShowsSupplier.is() )
+ {
+ mpImpl->mxShows = xShowsSupplier->getCustomPresentations();
+ mpImpl->mxShowFactory = Reference< XSingleServiceFactory >::query( mpImpl->mxShows );
+ }
+
+ if( !mpImpl->mxShowFactory.is() )
+ {
+ delete mpImpl;
+ mpImpl = NULL;
+ }
+}
+
+SdXMLShowsContext::~SdXMLShowsContext()
+{
+ delete mpImpl;
+}
+
+SvXMLImportContext * SdXMLShowsContext::CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
+{
+ if( mpImpl && nPrefix == XML_NAMESPACE_PRESENTATION && rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_show ) ) )
+ {
+ OUString aName;
+ OUString aPages;
+
+ // read attributes
+ 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_PRESENTATION:
+ if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_name ) ) )
+ {
+ aName = sValue;
+ }
+ else if( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_pages ) ) )
+ {
+ aPages = sValue;
+ }
+ }
+ }
+
+ if( aName.getLength() != 0 && aPages.getLength() != 0 )
+ {
+ Reference< XIndexContainer > xShow( mpImpl->mxShowFactory->createInstance(), UNO_QUERY );
+ if( xShow.is() )
+ {
+ SvXMLTokenEnumerator aPageIds( aPages, sal_Unicode(',') );
+ OUString sPageId;
+ sal_Int32 nPageId;
+ Any aAny;
+ vector< sal_Int32 > aPages;
+
+ while( aPageIds.getNextToken( sPageId ) )
+ {
+ if( SvXMLUnitConverter::convertNumber( nPageId, sPageId ) )
+ {
+ Reference< XDrawPage > xPage( mpImpl->mrImport.getDrawPageForId( nPageId ) );
+
+ if( xPage.is() )
+ {
+ aAny <<= xPage;
+ xShow->insertByIndex( xShow->getCount(), aAny );
+ }
+ }
+ }
+
+ aAny <<= xShow;
+
+ if( mpImpl->mxShows->hasByName( aName ) )
+ {
+ mpImpl->mxShows->replaceByName( aName, aAny );
+ }
+ else
+ {
+ mpImpl->mxShows->insertByName( aName, aAny );
+ }
+ }
+ }
+ }
+
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
diff --git a/xmloff/source/draw/ximpshow.hxx b/xmloff/source/draw/ximpshow.hxx
new file mode 100644
index 000000000000..5adbadf1de5d
--- /dev/null
+++ b/xmloff/source/draw/ximpshow.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * $RCSfile: ximpshow.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: cl $ $Date: 2000-12-19 16:23:48 $
+ *
+ * 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_XIMPSHOW_HXX
+#define _XMLOFF_XIMPSHOW_HXX
+
+#ifndef _XMLOFF_XMLICTXT_HXX
+#include "xmlictxt.hxx"
+#endif
+
+#ifndef _SDXMLIMP_IMPL_HXX
+#include "sdxmlimp_impl.hxx"
+#endif
+
+class ShowsImpImpl;
+
+//////////////////////////////////////////////////////////////////////////////
+// presentations:animations
+
+class SdXMLShowsContext : public SvXMLImportContext
+{
+ ShowsImpImpl* mpImpl;
+
+public:
+ TYPEINFO();
+
+ SdXMLShowsContext( SdXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList);
+ virtual ~SdXMLShowsContext();
+
+ virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList );
+};
+
+#endif // _XMLOFF_XIMPSHOW_HXX
+