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"
34 using namespace ::com::sun::star
;
35 using namespace ::oox::core
;
36 using namespace ::oox::drawingml
;
37 using namespace ::com::sun::star::uno
;
38 using namespace ::com::sun::star::xml::sax
;
39 using namespace ::com::sun::star::container
;
41 namespace oox
{ namespace ppt
{
44 SlideTransitionContext::SlideTransitionContext( FragmentHandler2
& rParent
, const AttributeList
& rAttribs
, PropertyMap
& aProperties
) throw()
45 : FragmentHandler2( rParent
)
46 , maSlideProperties( aProperties
)
47 , mbHasTransition( sal_False
)
50 maTransition
.setOoxTransitionSpeed( rAttribs
.getToken( XML_spd
, XML_fast
) );
53 rAttribs
.getBool( XML_advClick
, true );
55 // careful. if missing, no auto advance... 0 looks like a valid value
57 if(rAttribs
.hasAttribute( XML_advTm
))
58 maTransition
.setOoxAdvanceTime( rAttribs
.getInteger( XML_advTm
, -1 ) );
61 SlideTransitionContext::~SlideTransitionContext() throw()
66 ::oox::core::ContextHandlerRef
SlideTransitionContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
68 switch( aElementToken
)
70 case PPT_TOKEN( blinds
):
71 case PPT_TOKEN( checker
):
72 case PPT_TOKEN( comb
):
73 case PPT_TOKEN( randomBar
):
76 mbHasTransition
= true;
77 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_horz
), 0);
80 case PPT_TOKEN( cover
):
81 case PPT_TOKEN( pull
):
84 mbHasTransition
= true;
85 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_l
), 0 );
88 case PPT_TOKEN( cut
):
89 case PPT_TOKEN( fade
):
92 mbHasTransition
= true;
93 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getBool( XML_thruBlk
, false ), 0);
96 case PPT_TOKEN( push
):
97 case PPT_TOKEN( wipe
):
100 mbHasTransition
= true;
101 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_l
), 0 );
104 case PPT_TOKEN( split
):
105 if (!mbHasTransition
)
107 mbHasTransition
= true;
108 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_orient
, XML_horz
), rAttribs
.getToken( XML_dir
, XML_out
) );
111 case PPT_TOKEN( zoom
):
112 if (!mbHasTransition
)
114 mbHasTransition
= true;
115 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_out
), 0 );
118 case PPT_TOKEN( wheel
):
119 if (!mbHasTransition
)
121 mbHasTransition
= true;
122 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getUnsigned( XML_spokes
, 4 ), 0 );
126 case PPT_TOKEN( circle
):
127 case PPT_TOKEN( diamond
):
128 case PPT_TOKEN( dissolve
):
129 case PPT_TOKEN( newsflash
):
130 case PPT_TOKEN( plus
):
131 case PPT_TOKEN( random
):
132 case PPT_TOKEN( wedge
):
134 if (!mbHasTransition
)
136 mbHasTransition
= true;
137 maTransition
.setOoxTransitionType( aElementToken
, 0, 0 );
141 case PPT_TOKEN( sndAc
): // CT_TransitionSoundAction
143 return new SoundActionContext ( *this, maSlideProperties
);
144 case PPT_TOKEN( extLst
): // CT_OfficeArtExtensionList
153 void SlideTransitionContext::onEndElement()
155 if( isCurrentElement(PPT_TOKEN( transition
)) )
157 if( mbHasTransition
)
159 maTransition
.setSlideProperties( maSlideProperties
);
160 mbHasTransition
= false;
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */