update dev300-m57
[ooovba.git] / oox / source / ppt / slidetransitioncontext.cxx
blob9a2a99c38c71753257c80ca4c8533803c07fe760
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: slidetransitioncontext.cxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/ppt/slidetransitioncontext.hxx"
33 #include "comphelper/anytostring.hxx"
34 #include "cppuhelper/exc_hlp.hxx"
36 #include <com/sun/star/beans/XMultiPropertySet.hpp>
37 #include <com/sun/star/container/XNamed.hpp>
39 #include <oox/ppt/backgroundproperties.hxx>
40 #include "oox/ppt/slidefragmenthandler.hxx"
41 #include "oox/ppt/soundactioncontext.hxx"
42 #include "oox/drawingml/shapegroupcontext.hxx"
43 #include "oox/helper/attributelist.hxx"
44 #include "oox/core/namespaces.hxx"
46 #include "tokens.hxx"
48 using rtl::OUString;
49 using namespace ::com::sun::star;
50 using namespace ::oox::core;
51 using namespace ::oox::drawingml;
52 using namespace ::com::sun::star::uno;
53 using namespace ::com::sun::star::xml::sax;
54 using namespace ::com::sun::star::container;
56 namespace oox { namespace ppt {
59 SlideTransitionContext::SlideTransitionContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, PropertyMap & aProperties ) throw()
60 : ContextHandler( rParent )
61 , maSlideProperties( aProperties )
62 , mbHasTransition( sal_False )
64 AttributeList attribs(xAttribs);
66 // ST_TransitionSpeed
67 maTransition.setOoxTransitionSpeed( xAttribs->getOptionalValueToken( XML_spd, XML_fast ) );
69 // TODO
70 attribs.getBool( XML_advClick, true );
72 // careful. if missing, no auto advance... 0 looks like a valid value
73 // for auto advance
74 if(attribs.hasAttribute( XML_advTm ))
76 // TODO
77 xAttribs->getOptionalValue( XML_advTm );
81 SlideTransitionContext::~SlideTransitionContext() throw()
86 Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
88 Reference< XFastContextHandler > xRet;
90 switch( aElementToken )
92 case NMSP_PPT|XML_blinds:
93 case NMSP_PPT|XML_checker:
94 case NMSP_PPT|XML_comb:
95 case NMSP_PPT|XML_randomBar:
96 if (!mbHasTransition)
98 mbHasTransition = true;
99 maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_horz ), 0);
100 // ST_Direction { XML_horz, XML_vert }
102 break;
103 case NMSP_PPT|XML_cover:
104 case NMSP_PPT|XML_pull:
105 if (!mbHasTransition)
107 mbHasTransition = true;
108 maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_l ), 0 );
109 // ST_TransitionEightDirectionType { ST_TransitionSideDirectionType {
110 // XML_d, XML_d, XML_r, XML_u },
111 // ST_TransitionCornerDirectionType {
112 // XML_ld, XML_lu, XML_rd, XML_ru }
114 break;
115 case NMSP_PPT|XML_cut:
116 case NMSP_PPT|XML_fade:
117 if (!mbHasTransition)
119 mbHasTransition = true;
120 AttributeList attribs(xAttribs);
121 // CT_OptionalBlackTransition xdb:bool
122 maTransition.setOoxTransitionType( aElementToken, attribs.getBool( XML_thruBlk, false ), 0);
124 break;
125 case NMSP_PPT|XML_push:
126 case NMSP_PPT|XML_wipe:
127 if (!mbHasTransition)
129 mbHasTransition = true;
130 maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_l ), 0 );
131 // ST_TransitionSideDirectionType { XML_d, XML_l, XML_r, XML_u }
133 break;
134 case NMSP_PPT|XML_split:
135 if (!mbHasTransition)
137 mbHasTransition = true;
138 maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_orient, XML_horz ), xAttribs->getOptionalValueToken( XML_dir, XML_out ) );
139 // ST_Direction { XML_horz, XML_vert }
140 // ST_TransitionInOutDirectionType { XML_out, XML_in }
142 break;
143 case NMSP_PPT|XML_zoom:
144 if (!mbHasTransition)
146 mbHasTransition = true;
147 maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_out ), 0 );
148 // ST_TransitionInOutDirectionType { XML_out, XML_in }
150 break;
151 case NMSP_PPT|XML_wheel:
152 if (!mbHasTransition)
154 mbHasTransition = true;
155 AttributeList attribs(xAttribs);
156 maTransition.setOoxTransitionType( aElementToken, attribs.getUnsigned( XML_spokes, 4 ), 0 );
157 // unsignedInt
159 break;
160 case NMSP_PPT|XML_circle:
161 case NMSP_PPT|XML_diamond:
162 case NMSP_PPT|XML_dissolve:
163 case NMSP_PPT|XML_newsflash:
164 case NMSP_PPT|XML_plus:
165 case NMSP_PPT|XML_random:
166 case NMSP_PPT|XML_wedge:
167 // CT_Empty
168 if (!mbHasTransition)
170 mbHasTransition = true;
171 maTransition.setOoxTransitionType( aElementToken, 0, 0 );
173 break;
176 case NMSP_PPT|XML_sndAc: // CT_TransitionSoundAction
177 //"Sound"
178 xRet.set( new SoundActionContext ( *this, maSlideProperties ) );
179 break;
180 case NMSP_PPT|XML_extLst: // CT_OfficeArtExtensionList
181 return xRet;
182 default:
183 break;
186 if( !xRet.is() )
187 xRet.set(this);
189 return xRet;
192 void SlideTransitionContext::endFastElement( sal_Int32 aElement ) throw (::com::sun::star::xml::sax::SAXException, RuntimeException)
194 if( aElement == (NMSP_PPT|XML_transition) )
196 if( mbHasTransition )
198 maTransition.setSlideProperties( maSlideProperties );
199 mbHasTransition = false;