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
{
43 SlideTransitionContext::SlideTransitionContext( FragmentHandler2
& rParent
, const AttributeList
& rAttribs
, PropertyMap
& aProperties
) throw()
44 : FragmentHandler2( rParent
)
45 , maSlideProperties( aProperties
)
46 , mbHasTransition( false )
49 maTransition
.setOoxTransitionSpeed( rAttribs
.getToken( XML_spd
, XML_fast
) );
52 rAttribs
.getBool( XML_advClick
, true );
54 // careful. if missing, no auto advance... 0 looks like a valid value
56 if(rAttribs
.hasAttribute( XML_advTm
))
57 maTransition
.setOoxAdvanceTime( rAttribs
.getInteger( XML_advTm
, -1 ) );
60 SlideTransitionContext::~SlideTransitionContext() throw()
65 ::oox::core::ContextHandlerRef
SlideTransitionContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
67 switch( aElementToken
)
69 case PPT_TOKEN( blinds
):
70 case PPT_TOKEN( checker
):
71 case PPT_TOKEN( comb
):
72 case PPT_TOKEN( randomBar
):
75 mbHasTransition
= true;
76 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_horz
), 0);
79 case PPT_TOKEN( cover
):
80 case PPT_TOKEN( pull
):
83 mbHasTransition
= true;
84 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_l
), 0 );
87 case PPT_TOKEN( cut
):
88 case PPT_TOKEN( fade
):
91 mbHasTransition
= true;
92 maTransition
.setOoxTransitionType( aElementToken
, sal_Int32(rAttribs
.getBool( XML_thruBlk
, false )), 0);
95 case PPT_TOKEN( push
):
96 case PPT_TOKEN( wipe
):
99 mbHasTransition
= true;
100 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_l
), 0 );
103 case PPT_TOKEN( split
):
104 if (!mbHasTransition
)
106 mbHasTransition
= true;
107 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_orient
, XML_horz
), rAttribs
.getToken( XML_dir
, XML_out
) );
110 case PPT_TOKEN( zoom
):
111 if (!mbHasTransition
)
113 mbHasTransition
= true;
114 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getToken( XML_dir
, XML_out
), 0 );
117 case PPT_TOKEN( wheel
):
118 if (!mbHasTransition
)
120 mbHasTransition
= true;
121 maTransition
.setOoxTransitionType( aElementToken
, rAttribs
.getUnsigned( XML_spokes
, 4 ), 0 );
125 case PPT_TOKEN( circle
):
126 case PPT_TOKEN( diamond
):
127 case PPT_TOKEN( dissolve
):
128 case PPT_TOKEN( newsflash
):
129 case PPT_TOKEN( plus
):
130 case PPT_TOKEN( random
):
131 case PPT_TOKEN( wedge
):
133 if (!mbHasTransition
)
135 mbHasTransition
= true;
136 maTransition
.setOoxTransitionType( aElementToken
, 0, 0 );
140 case PPT_TOKEN( sndAc
): // CT_TransitionSoundAction
142 return new SoundActionContext ( *this, maSlideProperties
);
143 case PPT_TOKEN( extLst
): // CT_OfficeArtExtensionList
152 void SlideTransitionContext::onEndElement()
154 if( isCurrentElement(PPT_TOKEN( transition
)) )
156 if( mbHasTransition
)
158 maTransition
.setSlideProperties( maSlideProperties
);
159 mbHasTransition
= false;
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */