Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / oox / source / ppt / slidetransitioncontext.cxx
blob9b29653e98e60573785f66f05cd83542ee329249
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "oox/ppt/slidetransitioncontext.hxx"
22 #include "comphelper/anytostring.hxx"
23 #include "cppuhelper/exc_hlp.hxx"
25 #include <com/sun/star/beans/XMultiPropertySet.hpp>
26 #include <com/sun/star/container/XNamed.hpp>
28 #include <oox/ppt/backgroundproperties.hxx>
29 #include "oox/ppt/slidefragmenthandler.hxx"
30 #include "oox/ppt/soundactioncontext.hxx"
31 #include "oox/drawingml/shapegroupcontext.hxx"
32 #include "oox/helper/attributelist.hxx"
33 #include <oox/token/namespaces.hxx>
34 #include <oox/token/tokens.hxx>
36 using namespace ::com::sun::star;
37 using namespace ::oox::core;
38 using namespace ::oox::drawingml;
39 using namespace ::com::sun::star::uno;
40 using namespace ::com::sun::star::xml::sax;
41 using namespace ::com::sun::star::container;
43 namespace oox { namespace ppt {
45 SlideTransitionContext::SlideTransitionContext( FragmentHandler2& rParent, const AttributeList& rAttribs, PropertyMap & aProperties ) throw()
46 : FragmentHandler2( rParent )
47 , maSlideProperties( aProperties )
48 , mbHasTransition( false )
50 // ST_TransitionSpeed
51 maTransition.setOoxTransitionSpeed( rAttribs.getToken( XML_spd, XML_fast ) );
53 // TODO
54 rAttribs.getBool( XML_advClick, true );
56 // careful. if missing, no auto advance... 0 looks like a valid value
57 // for auto advance
58 if(rAttribs.hasAttribute( XML_advTm ))
59 maTransition.setOoxAdvanceTime( rAttribs.getInteger( XML_advTm, -1 ) );
62 SlideTransitionContext::~SlideTransitionContext() throw()
67 ::oox::core::ContextHandlerRef SlideTransitionContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
69 switch( aElementToken )
71 case PPT_TOKEN( blinds ):
72 case PPT_TOKEN( checker ):
73 case PPT_TOKEN( comb ):
74 case PPT_TOKEN( randomBar ):
75 if (!mbHasTransition)
77 mbHasTransition = true;
78 maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_horz ), 0);
80 return this;
81 case PPT_TOKEN( cover ):
82 case PPT_TOKEN( pull ):
83 if (!mbHasTransition)
85 mbHasTransition = true;
86 maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 );
88 return this;
89 case PPT_TOKEN( cut ):
90 case PPT_TOKEN( fade ):
91 if (!mbHasTransition)
93 mbHasTransition = true;
94 maTransition.setOoxTransitionType( aElementToken, sal_Int32(rAttribs.getBool( XML_thruBlk, false )), 0);
96 return this;
97 case PPT_TOKEN( push ):
98 case PPT_TOKEN( wipe ):
99 if (!mbHasTransition)
101 mbHasTransition = true;
102 maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 );
104 return this;
105 case PPT_TOKEN( split ):
106 if (!mbHasTransition)
108 mbHasTransition = true;
109 maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_orient, XML_horz ), rAttribs.getToken( XML_dir, XML_out ) );
111 return this;
112 case PPT_TOKEN( zoom ):
113 if (!mbHasTransition)
115 mbHasTransition = true;
116 maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_out ), 0 );
118 return this;
119 case PPT_TOKEN( wheel ):
120 if (!mbHasTransition)
122 mbHasTransition = true;
123 maTransition.setOoxTransitionType( aElementToken, rAttribs.getUnsigned( XML_spokes, 4 ), 0 );
124 // unsignedInt
126 return this;
127 case PPT_TOKEN( circle ):
128 case PPT_TOKEN( diamond ):
129 case PPT_TOKEN( dissolve ):
130 case PPT_TOKEN( newsflash ):
131 case PPT_TOKEN( plus ):
132 case PPT_TOKEN( random ):
133 case PPT_TOKEN( wedge ):
134 case P14_TOKEN( vortex ):
135 case P14_TOKEN( ripple ):
136 case P14_TOKEN( glitter ):
137 case P14_TOKEN( honeycomb ):
138 // CT_Empty
139 if (!mbHasTransition)
141 mbHasTransition = true;
142 maTransition.setOoxTransitionType( aElementToken, 0, 0 );
144 return this;
146 case PPT_TOKEN( sndAc ): // CT_TransitionSoundAction
147 //"Sound"
148 return new SoundActionContext ( *this, maSlideProperties );
149 case PPT_TOKEN( extLst ): // CT_OfficeArtExtensionList
150 return this;
152 case P14_TOKEN(prism):
153 if (!mbHasTransition)
155 mbHasTransition = true;
156 maTransition.setOoxTransitionType(aElementToken, sal_Int32(rAttribs.getBool(XML_isInverted, false)), 0);
158 return this;
159 case P15_TOKEN(prstTrans):
160 if (!mbHasTransition)
162 mbHasTransition = true;
163 maTransition.setPresetTransition(rAttribs.getString(XML_prst, ""));
165 return this;
168 default:
169 break;
172 return this;
175 void SlideTransitionContext::onEndElement()
177 if( isCurrentElement(PPT_TOKEN( transition )) )
179 if( mbHasTransition )
181 maTransition.setSlideProperties( maSlideProperties );
182 mbHasTransition = false;
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */