Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "oox/ppt/slidetransitioncontext.hxx"
21 :
22 : #include "comphelper/anytostring.hxx"
23 : #include "cppuhelper/exc_hlp.hxx"
24 :
25 : #include <com/sun/star/beans/XMultiPropertySet.hpp>
26 : #include <com/sun/star/container/XNamed.hpp>
27 :
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 :
34 : using rtl::OUString;
35 : using namespace ::com::sun::star;
36 : using namespace ::oox::core;
37 : using namespace ::oox::drawingml;
38 : using namespace ::com::sun::star::uno;
39 : using namespace ::com::sun::star::xml::sax;
40 : using namespace ::com::sun::star::container;
41 :
42 : namespace oox { namespace ppt {
43 :
44 :
45 0 : SlideTransitionContext::SlideTransitionContext( FragmentHandler2& rParent, const AttributeList& rAttribs, PropertyMap & aProperties ) throw()
46 : : FragmentHandler2( rParent )
47 : , maSlideProperties( aProperties )
48 0 : , mbHasTransition( sal_False )
49 : {
50 : // ST_TransitionSpeed
51 0 : maTransition.setOoxTransitionSpeed( rAttribs.getToken( XML_spd, XML_fast ) );
52 :
53 : // TODO
54 0 : rAttribs.getBool( XML_advClick, true );
55 :
56 : // careful. if missing, no auto advance... 0 looks like a valid value
57 : // for auto advance
58 0 : if(rAttribs.hasAttribute( XML_advTm ))
59 0 : maTransition.setOoxAdvanceTime( rAttribs.getInteger( XML_advTm, -1 ) );
60 0 : }
61 :
62 0 : SlideTransitionContext::~SlideTransitionContext() throw()
63 : {
64 :
65 0 : }
66 :
67 0 : ::oox::core::ContextHandlerRef SlideTransitionContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
68 : {
69 0 : switch( aElementToken )
70 : {
71 : case PPT_TOKEN( blinds ):
72 : case PPT_TOKEN( checker ):
73 : case PPT_TOKEN( comb ):
74 : case PPT_TOKEN( randomBar ):
75 0 : if (!mbHasTransition)
76 : {
77 0 : mbHasTransition = true;
78 0 : maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_horz ), 0);
79 : // ST_Direction { XML_horz, XML_vert }
80 : }
81 0 : return this;
82 : case PPT_TOKEN( cover ):
83 : case PPT_TOKEN( pull ):
84 0 : if (!mbHasTransition)
85 : {
86 0 : mbHasTransition = true;
87 0 : maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 );
88 : // ST_TransitionEightDirectionType { ST_TransitionSideDirectionType {
89 : // XML_d, XML_d, XML_r, XML_u },
90 : // ST_TransitionCornerDirectionType {
91 : // XML_ld, XML_lu, XML_rd, XML_ru }
92 : }
93 0 : return this;
94 : case PPT_TOKEN( cut ):
95 : case PPT_TOKEN( fade ):
96 0 : if (!mbHasTransition)
97 : {
98 0 : mbHasTransition = true;
99 : // CT_OptionalBlackTransition xdb:bool
100 0 : maTransition.setOoxTransitionType( aElementToken, rAttribs.getBool( XML_thruBlk, false ), 0);
101 : }
102 0 : return this;
103 : case PPT_TOKEN( push ):
104 : case PPT_TOKEN( wipe ):
105 0 : if (!mbHasTransition)
106 : {
107 0 : mbHasTransition = true;
108 0 : maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 );
109 : // ST_TransitionSideDirectionType { XML_d, XML_l, XML_r, XML_u }
110 : }
111 0 : return this;
112 : case PPT_TOKEN( split ):
113 0 : if (!mbHasTransition)
114 : {
115 0 : mbHasTransition = true;
116 0 : maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_orient, XML_horz ), rAttribs.getToken( XML_dir, XML_out ) );
117 : // ST_Direction { XML_horz, XML_vert }
118 : // ST_TransitionInOutDirectionType { XML_out, XML_in }
119 : }
120 0 : return this;
121 : case PPT_TOKEN( zoom ):
122 0 : if (!mbHasTransition)
123 : {
124 0 : mbHasTransition = true;
125 0 : maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_out ), 0 );
126 : // ST_TransitionInOutDirectionType { XML_out, XML_in }
127 : }
128 0 : return this;
129 : case PPT_TOKEN( wheel ):
130 0 : if (!mbHasTransition)
131 : {
132 0 : mbHasTransition = true;
133 0 : maTransition.setOoxTransitionType( aElementToken, rAttribs.getUnsigned( XML_spokes, 4 ), 0 );
134 : // unsignedInt
135 : }
136 0 : return this;
137 : case PPT_TOKEN( circle ):
138 : case PPT_TOKEN( diamond ):
139 : case PPT_TOKEN( dissolve ):
140 : case PPT_TOKEN( newsflash ):
141 : case PPT_TOKEN( plus ):
142 : case PPT_TOKEN( random ):
143 : case PPT_TOKEN( wedge ):
144 : // CT_Empty
145 0 : if (!mbHasTransition)
146 : {
147 0 : mbHasTransition = true;
148 0 : maTransition.setOoxTransitionType( aElementToken, 0, 0 );
149 : }
150 0 : return this;
151 :
152 : case PPT_TOKEN( sndAc ): // CT_TransitionSoundAction
153 : //"Sound"
154 0 : return new SoundActionContext ( *this, maSlideProperties );
155 : case PPT_TOKEN( extLst ): // CT_OfficeArtExtensionList
156 0 : return this;
157 : default:
158 0 : break;
159 : }
160 :
161 0 : return this;
162 : }
163 :
164 0 : void SlideTransitionContext::onEndElement()
165 : {
166 0 : if( isCurrentElement(PPT_TOKEN( transition )) )
167 : {
168 0 : if( mbHasTransition )
169 : {
170 0 : maTransition.setSlideProperties( maSlideProperties );
171 0 : mbHasTransition = false;
172 : }
173 : }
174 0 : }
175 :
176 :
177 51 : } }
178 :
179 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|