1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 )
51 maTransition
.setOoxTransitionSpeed( rAttribs
.getToken( XML_spd
, XML_fast
) );
54 rAttribs
.getBool( XML_advClick
, true );
56 // careful. if missing, no auto advance... 0 looks like a valid value
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
):
77 mbHasTransition
= true;
78 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_horz
), 0);
81 case PPT_TOKEN( cover
):
82 case PPT_TOKEN( pull
):
85 mbHasTransition
= true;
86 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_l
), 0 );
89 case PPT_TOKEN( cut
):
90 case PPT_TOKEN( fade
):
93 mbHasTransition
= true;
94 maTransition
.setOoxTransitionType( aElementToken
, sal_Int32(rAttribs
.getBool( XML_thruBlk
, false )), 0);
97 case PPT_TOKEN( push
):
98 case PPT_TOKEN( wipe
):
101 mbHasTransition
= true;
102 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_l
), 0 );
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
) );
112 case PPT_TOKEN( zoom
):
113 if (!mbHasTransition
)
115 mbHasTransition
= true;
116 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_out
), 0 );
119 case PPT_TOKEN( wheel
):
120 if (!mbHasTransition
)
122 mbHasTransition
= true;
123 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getUnsigned( XML_spokes
, 4 ), 0 );
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
):
139 if (!mbHasTransition
)
141 mbHasTransition
= true;
142 maTransition
.setOoxTransitionType( aElementToken
, 0, 0 );
146 case PPT_TOKEN( sndAc
): // CT_TransitionSoundAction
148 return new SoundActionContext ( *this, maSlideProperties
);
149 case PPT_TOKEN( extLst
): // CT_OfficeArtExtensionList
152 case P14_TOKEN(prism
):
153 if (!mbHasTransition
)
155 mbHasTransition
= true;
156 maTransition
.setOoxTransitionType(aElementToken
, sal_Int32(rAttribs
.getBool(XML_isInverted
, false)), 0);
159 case P15_TOKEN(prstTrans
):
160 if (!mbHasTransition
)
162 mbHasTransition
= true;
163 maTransition
.setPresetTransition(rAttribs
.getString(XML_prst
, ""));
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: */