Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
30 : : #include <com/sun/star/animations/AnimationFill.hpp>
31 : : #include <com/sun/star/animations/AnimationRestart.hpp>
32 : : #include <com/sun/star/animations/Timing.hpp>
33 : : #include <com/sun/star/animations/Event.hpp>
34 : : #include <com/sun/star/animations/AnimationEndSync.hpp>
35 : : #include <com/sun/star/animations/EventTrigger.hpp>
36 : : #include <com/sun/star/presentation/EffectNodeType.hpp>
37 : : #include <com/sun/star/presentation/EffectPresetClass.hpp>
38 : : #include <com/sun/star/animations/AnimationNodeType.hpp>
39 : : #include <com/sun/star/animations/AnimationTransformType.hpp>
40 : : #include <com/sun/star/animations/AnimationCalcMode.hpp>
41 : : #include <com/sun/star/animations/AnimationValueType.hpp>
42 : : #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
43 : : #include <com/sun/star/animations/XIterateContainer.hpp>
44 : : #include <com/sun/star/animations/XAnimateSet.hpp>
45 : : #include <com/sun/star/animations/XAudio.hpp>
46 : : #include <com/sun/star/animations/XCommand.hpp>
47 : : #include <com/sun/star/animations/XTransitionFilter.hpp>
48 : : #include <com/sun/star/animations/XAnimateColor.hpp>
49 : : #include <com/sun/star/animations/XAnimateMotion.hpp>
50 : : #include <com/sun/star/animations/XAnimateTransform.hpp>
51 : : #include <com/sun/star/animations/ValuePair.hpp>
52 : : #include <com/sun/star/animations/AnimationColorSpace.hpp>
53 : : #include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
54 : : #include <com/sun/star/presentation/EffectCommands.hpp>
55 : : #include <com/sun/star/beans/NamedValue.hpp>
56 : : #include <com/sun/star/drawing/FillStyle.hpp>
57 : : #include <com/sun/star/drawing/LineStyle.hpp>
58 : : #include <com/sun/star/awt/FontWeight.hpp>
59 : : #include <com/sun/star/awt/FontUnderline.hpp>
60 : : #include <com/sun/star/awt/FontSlant.hpp>
61 : : #include <com/sun/star/container/XEnumerationAccess.hpp>
62 : : #include <com/sun/star/presentation/ParagraphTarget.hpp>
63 : : #include <com/sun/star/presentation/TextAnimationType.hpp>
64 : : #include <comphelper/processfactory.hxx>
65 : : #include <rtl/ustrbuf.hxx>
66 : : #include <rtl/math.hxx>
67 : :
68 : : #include <vcl/vclenum.hxx>
69 : : #include <svx/svdotext.hxx>
70 : : #include <editeng/outlobj.hxx>
71 : : #include <editeng/editobj.hxx>
72 : : #include <pptinanimations.hxx>
73 : : #include <pptatom.hxx>
74 : : #include "pptin.hxx"
75 : : #include <algorithm>
76 : :
77 : : using ::std::map;
78 : : using ::rtl::OUString;
79 : : using ::rtl::OUStringBuffer;
80 : : using ::com::sun::star::uno::Any;
81 : : using ::com::sun::star::uno::Reference;
82 : : using ::com::sun::star::uno::UNO_QUERY;
83 : : using ::com::sun::star::uno::UNO_QUERY_THROW;
84 : : using ::com::sun::star::uno::Sequence;
85 : : using ::com::sun::star::uno::makeAny;
86 : : using ::com::sun::star::uno::Exception;
87 : : using ::com::sun::star::uno::XInterface;
88 : : using ::com::sun::star::beans::NamedValue;
89 : : using ::com::sun::star::container::XEnumerationAccess;
90 : : using ::com::sun::star::container::XEnumeration;
91 : : using ::com::sun::star::lang::XMultiServiceFactory;
92 : :
93 : : using namespace ::com::sun::star::drawing;
94 : : using namespace ::com::sun::star::animations;
95 : : using namespace ::com::sun::star::presentation;
96 : :
97 : : namespace sd
98 : : {
99 : : extern Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetClass );
100 : : }
101 : :
102 : : namespace ppt
103 : : {
104 : :
105 : 0 : const transition* transition::find( const OUString& rName )
106 : : {
107 : 0 : const transition* p = gTransitions;
108 : :
109 [ # # ]: 0 : while( p->mpName )
110 : : {
111 [ # # ]: 0 : if( rName.compareToAscii( p->mpName ) == 0 )
112 : 0 : return p;
113 : :
114 : 0 : p++;
115 : : }
116 : :
117 : 0 : return NULL;
118 : : }
119 : :
120 : : // ====================================================================
121 : :
122 : :
123 : :
124 : : // ====================================================================
125 : :
126 : 0 : SvStream& operator>>(SvStream& rIn, AnimationNode& rNode )
127 : : {
128 : 0 : rIn >> rNode.mnU1;
129 : 0 : rIn >> rNode.mnRestart;
130 : 0 : rIn >> rNode.mnGroupType;
131 : 0 : rIn >> rNode.mnFill;
132 : 0 : rIn >> rNode.mnU3;
133 : 0 : rIn >> rNode.mnU4;
134 : 0 : rIn >> rNode.mnDuration;
135 : 0 : rIn >> rNode.mnNodeType;
136 : :
137 : 0 : return rIn;
138 : : }
139 : :
140 : : // ====================================================================
141 : :
142 : 0 : static bool convertMeasure( OUString& rString )
143 : : {
144 : 0 : bool bRet = false;
145 : :
146 : 0 : const sal_Char* pSource[] = { "ppt_x", "ppt_y", "ppt_w", "ppt_h", NULL };
147 : 0 : const sal_Char* pDest[] = { "x", "y", "width", "height", NULL };
148 : 0 : sal_Int32 nIndex = 0;
149 : :
150 : 0 : const sal_Char** ps = pSource;
151 : 0 : const sal_Char** pd = pDest;
152 : :
153 [ # # ]: 0 : while( *ps )
154 : : {
155 : 0 : const OUString aSearch( OUString::createFromAscii( *ps ) );
156 [ # # ]: 0 : while( (nIndex = rString.indexOf( aSearch, nIndex )) != -1 )
157 : : {
158 : 0 : sal_Int32 nLength = aSearch.getLength();
159 [ # # ][ # # ]: 0 : if( nIndex && (rString.getStr()[nIndex-1] == '#' ) )
[ # # ]
160 : : {
161 : 0 : nIndex--;
162 : 0 : nLength++;
163 : : }
164 : :
165 : 0 : const OUString aNew( OUString::createFromAscii( *pd ) );
166 : 0 : rString = rString.replaceAt( nIndex, nLength, aNew );
167 : 0 : nIndex += aNew.getLength();
168 : 0 : bRet = true;
169 : 0 : }
170 : 0 : ps++;
171 : 0 : pd++;
172 : 0 : }
173 : :
174 : 0 : return bRet;
175 : : }
176 : :
177 : :
178 : : // ====================================================================
179 : :
180 : 0 : bool PropertySet::hasProperty( sal_Int32 nProperty ) const
181 : : {
182 [ # # ]: 0 : return maProperties.find( nProperty ) != maProperties.end();
183 : : }
184 : :
185 : : // --------------------------------------------------------------------
186 : :
187 : 0 : Any PropertySet::getProperty( sal_Int32 nProperty ) const
188 : : {
189 [ # # ]: 0 : PropertySetMap_t::const_iterator aIter( maProperties.find( nProperty ) );
190 [ # # ]: 0 : if( aIter != maProperties.end() )
191 : 0 : return (*aIter).second;
192 : : else
193 : 0 : return Any();
194 : : }
195 : :
196 : : // ====================================================================
197 : :
198 : : /** this adds an any to another any.
199 : : if rNewValue is empty, rOldValue is returned.
200 : : if rOldValue is empty, rNewValue is returned.
201 : : if rOldValue contains a value, a sequence with rOldValue and rNewValue is returned.
202 : : if rOldValue contains a sequence, a new sequence with the old sequence and rNewValue is returned.
203 : : */
204 : 0 : static Any addToSequence( const Any& rOldValue, const Any& rNewValue )
205 : : {
206 [ # # ]: 0 : if( !rNewValue.hasValue() )
207 : : {
208 : 0 : return rOldValue;
209 : : }
210 [ # # ]: 0 : else if( !rOldValue.hasValue() )
211 : : {
212 : 0 : return rNewValue;
213 : : }
214 : : else
215 : : {
216 [ # # ]: 0 : Sequence< Any > aNewSeq;
217 [ # # ][ # # ]: 0 : if( rOldValue >>= aNewSeq )
218 : : {
219 : 0 : sal_Int32 nSize = aNewSeq.getLength();
220 [ # # ]: 0 : aNewSeq.realloc(nSize+1);
221 [ # # ]: 0 : aNewSeq[nSize] = rNewValue;
222 : : }
223 : : else
224 : : {
225 [ # # ]: 0 : aNewSeq.realloc(2);
226 [ # # ]: 0 : aNewSeq[0] = rOldValue;
227 [ # # ]: 0 : aNewSeq[1] = rNewValue;
228 : : }
229 [ # # ][ # # ]: 0 : return makeAny( aNewSeq );
230 : : }
231 : : }
232 : :
233 : : // ====================================================================
234 : :
235 : 12 : AnimationImporter::AnimationImporter( ImplSdPPTImport* pPPTImport, SvStream& rStCtrl )
236 [ + - ]: 12 : : mpPPTImport( pPPTImport ), mrStCtrl( rStCtrl )
237 : : {
238 : 12 : }
239 : :
240 : : // --------------------------------------------------------------------
241 : :
242 : 12 : void AnimationImporter::import( const Reference< XDrawPage >& xPage, const DffRecordHeader& rProgTagContentHd )
243 : : {
244 : : #ifdef DBG_ANIM_LOG
245 : : mpFile = fopen( "c:\\output.xml", "w+" );
246 : : #endif
247 : 12 : dump("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
248 : :
249 [ + - ]: 12 : Reference< XAnimationNodeSupplier > xNodeSupplier( xPage, UNO_QUERY );
250 [ + - ]: 12 : if( xNodeSupplier.is() )
251 : : {
252 [ + - ][ + - ]: 12 : mxRootNode = xNodeSupplier->getAnimationNode();
[ + - ]
253 [ - + ]: 12 : if( mxRootNode.is() )
254 : : {
255 : 0 : Reference< XAnimationNode > xParent;
256 : :
257 [ # # ]: 0 : const Atom* pAtom = Atom::import( rProgTagContentHd, mrStCtrl );
258 [ # # ]: 0 : if( pAtom )
259 : : {
260 [ # # ]: 0 : importAnimationContainer( pAtom, xParent );
261 : : }
262 : :
263 [ # # ]: 0 : processAfterEffectNodes();
264 : : }
265 : 12 : }
266 : :
267 : : #ifdef DBG_ANIM_LOG
268 : : fclose( mpFile );
269 : : #endif
270 : 12 : }
271 : :
272 : : // --------------------------------------------------------------------
273 : :
274 : 0 : void AnimationImporter::processAfterEffectNodes()
275 : : {
276 : 0 : std::for_each( maAfterEffectNodes.begin(), maAfterEffectNodes.end(), sd::stl_process_after_effect_node_func );
277 : 0 : }
278 : :
279 : : // --------------------------------------------------------------------
280 : :
281 : 0 : Reference< XAnimationNode > AnimationImporter::createNode( const Atom* pAtom, const AnimationNode& rNode )
282 : : {
283 : 0 : const char* pServiceName = NULL;
284 : :
285 [ # # # # : 0 : switch( rNode.mnGroupType )
# ]
286 : : {
287 : : case mso_Anim_GroupType_PAR:
288 [ # # ]: 0 : if( pAtom->hasChildAtom( DFF_msofbtAnimIteration ) )
289 : 0 : pServiceName = "com.sun.star.animations.IterateContainer";
290 : : else
291 : 0 : pServiceName = "com.sun.star.animations.ParallelTimeContainer";
292 : 0 : break;
293 : : case mso_Anim_GroupType_SEQ:
294 : 0 : pServiceName = "com.sun.star.animations.SequenceTimeContainer";
295 : 0 : break;
296 : : case mso_Anim_GroupType_NODE:
297 : : {
298 [ # # ]: 0 : switch( rNode.mnNodeType )
299 : : {
300 : : case mso_Anim_Behaviour_FILTER:
301 : : case mso_Anim_Behaviour_ANIMATION:
302 [ # # ]: 0 : if( pAtom->hasChildAtom( DFF_msofbtAnimateSet ) )
303 : 0 : pServiceName = "com.sun.star.animations.AnimateSet";
304 [ # # ]: 0 : else if( pAtom->hasChildAtom( DFF_msofbtAnimateColor ) )
305 : 0 : pServiceName = "com.sun.star.animations.AnimateColor";
306 [ # # ]: 0 : else if( pAtom->hasChildAtom( DFF_msofbtAnimateScale ) )
307 : 0 : pServiceName = "com.sun.star.animations.AnimateTransform";
308 [ # # ]: 0 : else if( pAtom->hasChildAtom( DFF_msofbtAnimateRotation ) )
309 : 0 : pServiceName = "com.sun.star.animations.AnimateTransform";
310 [ # # ]: 0 : else if( pAtom->hasChildAtom( DFF_msofbtAnimateMotion ) )
311 : 0 : pServiceName = "com.sun.star.animations.AnimateMotion";
312 [ # # ]: 0 : else if( pAtom->hasChildAtom( DFF_msofbtAnimateFilter ) )
313 : 0 : pServiceName = "com.sun.star.animations.TransitionFilter";
314 [ # # ]: 0 : else if( pAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
315 : 0 : pServiceName = "com.sun.star.animations.Command";
316 : : else
317 : 0 : pServiceName = "com.sun.star.animations.Animate";
318 : 0 : break;
319 : : }
320 : 0 : break;
321 : : }
322 : : case mso_Anim_GroupType_MEDIA:
323 : 0 : pServiceName = "com.sun.star.animations.Audio";
324 : 0 : break;
325 : :
326 : : default:
327 : 0 : pServiceName = "com.sun.star.animations.Animate";
328 : 0 : break;
329 : : }
330 : :
331 : 0 : Reference< XAnimationNode > xNode;
332 [ # # ]: 0 : if( pServiceName )
333 : : {
334 : 0 : const OUString aServiceName( OUString::createFromAscii(pServiceName) );
335 [ # # ][ # # ]: 0 : Reference< XInterface > xFac( ::comphelper::getProcessServiceFactory()->createInstance(aServiceName) );
[ # # ]
336 [ # # ]: 0 : xNode.set(xFac , UNO_QUERY );
337 : : }
338 : :
339 : : DBG_ASSERT( xNode.is(), "sd::AnimationImporter::createNode(), node creation failed!" );
340 : 0 : return xNode;
341 : : }
342 : :
343 : : // --------------------------------------------------------------------
344 : :
345 : 0 : static bool is_random( const AnimationNode& rNode, const PropertySet& rSet, sal_Int32& rPresetClass )
346 : : {
347 [ # # ]: 0 : if( rNode.mnGroupType != mso_Anim_GroupType_PAR )
348 : 0 : return false;
349 : :
350 [ # # ][ # # ]: 0 : if( !rSet.hasProperty( DFF_ANIM_PRESET_ID ) || !rSet.hasProperty( DFF_ANIM_PRESET_CLASS ) )
[ # # ][ # # ]
[ # # ]
351 : 0 : return false;
352 : :
353 : 0 : sal_Int32 nPresetId = 0;
354 [ # # ][ # # ]: 0 : if( !(rSet.getProperty( DFF_ANIM_PRESET_ID ) >>= nPresetId) || (nPresetId != 24) )
[ # # ][ # # ]
[ # # # # ]
355 : 0 : return false;
356 : :
357 : 0 : sal_Int32 nPresetClass = 0;
358 [ # # ][ # # ]: 0 : if( !(rSet.getProperty( DFF_ANIM_PRESET_CLASS ) >>= nPresetClass) )
359 : 0 : return false;
360 : :
361 [ # # # ]: 0 : switch( nPresetClass )
362 : : {
363 : 0 : case DFF_ANIM_PRESS_CLASS_ENTRANCE: rPresetClass = EffectPresetClass::ENTRANCE; return true;
364 : 0 : case DFF_ANIM_PRESS_CLASS_EXIT: rPresetClass = EffectPresetClass::EXIT; return true;
365 : : }
366 : 0 : return false;
367 : : }
368 : :
369 : :
370 : 0 : void AnimationImporter::importAnimationContainer( const Atom* pAtom, const Reference< XAnimationNode >& xParent )
371 : : {
372 [ # # ]: 0 : if( pAtom->seekToContent() )
373 : : {
374 : : AnimationNode aNode;
375 [ # # ]: 0 : const Atom* pAnimationNodeAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimNode );
376 [ # # ][ # # ]: 0 : if( pAnimationNodeAtom && pAnimationNodeAtom->seekToContent() )
[ # # ][ # # ]
377 [ # # ]: 0 : mrStCtrl >> aNode;
378 : :
379 [ # # ]: 0 : PropertySet aSet;
380 [ # # ]: 0 : const Atom* pAnimationPropertySetAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimPropertySet );
381 [ # # ]: 0 : if( pAnimationPropertySetAtom )
382 [ # # ]: 0 : importPropertySetContainer( pAnimationPropertySetAtom, aSet );
383 : :
384 : 0 : Reference< XAnimationNode > xNode;
385 : :
386 [ # # ]: 0 : if( xParent.is() )
387 : : {
388 : : sal_Int32 nPresetClass;
389 [ # # ][ # # ]: 0 : if( is_random( aNode, aSet, nPresetClass ) )
390 : : {
391 : : // create a random animation node with the given preset class
392 [ # # ][ # # ]: 0 : xNode.set( sd::RandomAnimationNode_createInstance( (sal_Int16)nPresetClass ), UNO_QUERY );
393 : : }
394 : :
395 [ # # ]: 0 : if( !xNode.is() )
396 : : {
397 : : // create a node for the given atom
398 [ # # ][ # # ]: 0 : xNode = createNode( pAtom, aNode );
399 : : }
400 : : }
401 : : else
402 : : {
403 : : // if we have no parent we fill the root node
404 [ # # ]: 0 : xNode = mxRootNode;
405 : : }
406 : :
407 : : // import if we have a node and its not random
408 [ # # ]: 0 : if( xNode.is() )
409 : : {
410 [ # # ]: 0 : fillNode( xNode, aNode, aSet );
411 : :
412 [ # # # # : 0 : switch( aNode.mnGroupType )
# ]
413 : : {
414 : : case mso_Anim_GroupType_PAR:
415 : : {
416 : 0 : dump( "<par" );
417 : 0 : dump( aNode );
418 : 0 : dump( aSet );
419 [ # # ]: 0 : importTimeContainer( pAtom, xNode );
420 : 0 : dump( "</par>\n" );
421 : :
422 : : // for iteration containers, map target from children to iteration
423 [ # # ]: 0 : Reference< XIterateContainer > xIter( xNode, UNO_QUERY );
424 [ # # ]: 0 : if( xIter.is() )
425 : : {
426 : 0 : double fDuration = 0.0;
427 : 0 : Any aTarget, aEmpty;
428 [ # # ]: 0 : Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
429 [ # # ]: 0 : if( xEnumerationAccess.is() )
430 : : {
431 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
[ # # ]
432 [ # # ]: 0 : if( xEnumeration.is() )
433 : : {
434 [ # # ][ # # ]: 0 : while( xEnumeration->hasMoreElements() )
[ # # ]
435 : : {
436 [ # # ][ # # ]: 0 : Reference< XAnimate > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
[ # # ]
437 [ # # ]: 0 : if( xChildNode.is() )
438 : : {
439 : 0 : double fChildBegin = 0.0;
440 : 0 : double fChildDuration = 0.0;
441 [ # # ][ # # ]: 0 : xChildNode->getBegin() >>= fChildBegin;
442 [ # # ][ # # ]: 0 : xChildNode->getDuration() >>= fChildDuration;
443 : :
444 : 0 : fChildDuration += fChildBegin;
445 [ # # ]: 0 : if( fChildDuration > fDuration )
446 : 0 : fDuration = fChildDuration;
447 : :
448 [ # # ]: 0 : if( !aTarget.hasValue() )
449 [ # # ][ # # ]: 0 : aTarget = xChildNode->getTarget();
450 : :
451 [ # # ][ # # ]: 0 : xChildNode->setTarget( aEmpty );
452 : : }
453 : 0 : }
454 : 0 : }
455 : : }
456 : :
457 [ # # ][ # # ]: 0 : xIter->setTarget( aTarget );
458 : :
459 [ # # ][ # # ]: 0 : double fIterateInterval = xIter->getIterateInterval() * fDuration / 100;
460 [ # # ][ # # ]: 0 : xIter->setIterateInterval( fIterateInterval );
461 : 0 : }
462 : : }
463 : 0 : break;
464 : :
465 : : case mso_Anim_GroupType_SEQ:
466 : : {
467 : 0 : dump( "<seq" );
468 : 0 : dump( aNode );
469 : 0 : dump( aSet );
470 [ # # ]: 0 : importTimeContainer( pAtom, xNode );
471 : 0 : dump( "</seq>\n" );
472 : :
473 [ # # ][ # # ]: 0 : if( aSet.hasProperty( DFF_ANIM_NODE_TYPE ) )
474 : : {
475 : 0 : sal_Int32 nPPTNodeType = 0;
476 [ # # ][ # # ]: 0 : if( aSet.getProperty( DFF_ANIM_NODE_TYPE ) >>= nPPTNodeType )
477 : : {
478 [ # # # ]: 0 : switch(nPPTNodeType)
479 : : {
480 : : case DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE:
481 [ # # ]: 0 : fixMainSequenceTiming( xNode );
482 : 0 : break;
483 : : case DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ:
484 [ # # ]: 0 : fixInteractiveSequenceTiming( xNode );
485 : 0 : break;
486 : : }
487 : : }
488 : : }
489 : : }
490 : 0 : break;
491 : :
492 : : case mso_Anim_GroupType_NODE:
493 : : {
494 : : #ifdef DBG_ANIM_LOG
495 : : if( pAtom->hasChildAtom( DFF_msofbtAnimateSet ) )
496 : : {
497 : : dump( "<set" );
498 : : }
499 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimateColor ) )
500 : : {
501 : : dump( "<animateColor" );
502 : : }
503 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimateScale ) )
504 : : {
505 : : dump( "<animateScale" );
506 : : }
507 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimateRotation ) )
508 : : {
509 : : dump( "<animateRotation" );
510 : : }
511 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimateMotion ) )
512 : : {
513 : : dump( "<animateMotion" );
514 : : }
515 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimate ) )
516 : : {
517 : : dump( "<animate" );
518 : : }
519 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimateFilter ) )
520 : : {
521 : : dump( "<animateFilter" );
522 : : }
523 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
524 : : {
525 : : dump( "<command" );
526 : : }
527 : : else
528 : : {
529 : : OSL_FAIL( "unknown node atom!" );
530 : : dump_atom_header( pAtom, true, false );
531 : : dump_atom( pAtom );
532 : : dump_atom_header( pAtom, false, false );
533 : : break;
534 : : }
535 : : dump( aNode );
536 : : dump( aSet );
537 : : #endif
538 [ # # ]: 0 : importAnimationNodeContainer( pAtom, xNode );
539 [ # # ][ # # ]: 0 : if( !convertAnimationNode( xNode, xParent ) )
540 [ # # ]: 0 : xNode = 0;
541 : 0 : dump( "/>\n");
542 : :
543 : : }
544 : 0 : break;
545 : :
546 : : case mso_Anim_GroupType_MEDIA:
547 : : {
548 : 0 : dump( "<audio" );
549 : 0 : dump( aNode );
550 : 0 : dump( aSet );
551 [ # # ]: 0 : importAudioContainer( pAtom, xNode );
552 : 0 : dump( "</audio>\n" );
553 : : }
554 : 0 : break;
555 : :
556 : : default:
557 : : OSL_FAIL( "unknown group atom!" );
558 : :
559 : 0 : dump_atom_header( pAtom, true, false );
560 : 0 : dump_atom( pAtom );
561 : 0 : dump_atom_header( pAtom, false, false );
562 : 0 : break;
563 : :
564 : : }
565 : : }
566 : :
567 [ # # ][ # # ]: 0 : if( xParent.is() && xNode.is() )
[ # # ]
568 : : {
569 [ # # ]: 0 : Reference< XTimeContainer > xParentContainer( xParent, UNO_QUERY );
570 : : DBG_ASSERT( xParentContainer.is(), "parent is no container, then why do I have a child here?" );
571 [ # # ]: 0 : if( xParentContainer.is() )
572 : : {
573 [ # # ][ # # ]: 0 : xParentContainer->appendChild( xNode );
574 : 0 : }
575 : 0 : }
576 : : }
577 : 0 : }
578 : :
579 : : // --------------------------------------------------------------------
580 : 0 : void AnimationImporter::fixMainSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
581 : : {
582 : : try
583 : : {
584 : 0 : bool bFirst = true;
585 [ # # ]: 0 : Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW );
586 [ # # ][ # # ]: 0 : Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW );
[ # # ]
587 [ # # ][ # # ]: 0 : while( xE->hasMoreElements() )
[ # # ]
588 : : {
589 : : // click node
590 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY );
[ # # ]
591 : :
592 : 0 : Event aEvent;
593 : 0 : aEvent.Trigger = EventTrigger::ON_NEXT;
594 : 0 : aEvent.Repeat = 0;
595 [ # # ][ # # ]: 0 : xClickNode->setBegin( makeAny( aEvent ) );
[ # # ]
596 : :
597 [ # # ]: 0 : if( bFirst )
598 : : {
599 : 0 : bFirst = false;
600 [ # # ]: 0 : Reference< XEnumerationAccess > xEA2( xClickNode, UNO_QUERY_THROW );
601 [ # # ][ # # ]: 0 : Reference< XEnumeration > xE2( xEA2->createEnumeration(), UNO_QUERY_THROW );
[ # # ]
602 [ # # ][ # # ]: 0 : if( xE2->hasMoreElements() )
[ # # ]
603 : : {
604 : : // with node
605 [ # # ][ # # ]: 0 : xE2->nextElement() >>= xEA2;
[ # # ]
606 [ # # ]: 0 : if( xEA2.is() )
607 [ # # ][ # # ]: 0 : xE2.query( xEA2->createEnumeration() );
[ # # ]
608 : : else
609 : 0 : xE2.clear();
610 : :
611 [ # # ][ # # ]: 0 : if( xE2.is() && xE2->hasMoreElements() )
[ # # ][ # # ]
[ # # ]
612 : : {
613 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xEffectNode( xE2->nextElement(), UNO_QUERY_THROW );
[ # # ]
614 [ # # ][ # # ]: 0 : const Sequence< NamedValue > aUserData( xEffectNode->getUserData() );
615 : 0 : const NamedValue* p = aUserData.getConstArray();
616 : 0 : sal_Int32 nLength = aUserData.getLength();
617 [ # # ]: 0 : while( nLength-- )
618 : : {
619 [ # # ]: 0 : if ( p->Name == "node-type" )
620 : : {
621 : 0 : sal_Int16 nNodeType = 0;
622 : 0 : p->Value >>= nNodeType;
623 [ # # ]: 0 : if( nNodeType != ::com::sun::star::presentation::EffectNodeType::ON_CLICK )
624 : : {
625 : : // first effect does not start on click, so correct
626 : : // first click nodes begin to 0s
627 [ # # ][ # # ]: 0 : xClickNode->setBegin( makeAny( (double)0.0 ) );
[ # # ]
628 : : break;
629 : : }
630 : : }
631 : 0 : p++;
632 [ # # ]: 0 : }
633 : : }
634 : 0 : }
635 : : }
636 [ # # ]: 0 : }
637 : : }
638 : 0 : catch( Exception& )
639 : : {
640 : : OSL_FAIL("sd::AnimationImporter::fixMainSequenceTiming(), exception caught!" );
641 : : }
642 : 0 : }
643 : :
644 : : // --------------------------------------------------------------------
645 : :
646 : 0 : void AnimationImporter::fixInteractiveSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
647 : : {
648 : : try
649 : : {
650 [ # # ][ # # ]: 0 : Any aBegin( xNode->getBegin() );
651 : 0 : Any aEmpty;
652 [ # # ][ # # ]: 0 : xNode->setBegin( aEmpty );
653 : :
654 [ # # ]: 0 : Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW );
655 [ # # ][ # # ]: 0 : Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW );
[ # # ]
656 [ # # ][ # # ]: 0 : while( xE->hasMoreElements() )
[ # # ]
657 : : {
658 : : // click node
659 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY );
[ # # ]
660 [ # # ][ # # ]: 0 : xClickNode->setBegin( aBegin );
661 [ # # ]: 0 : }
662 : : }
663 : 0 : catch( Exception& )
664 : : {
665 : : OSL_FAIL("sd::AnimationImporter::fixInteractiveSequenceTiming(), exception caught!" );
666 : : }
667 : 0 : }
668 : :
669 : : // --------------------------------------------------------------------
670 : :
671 : 0 : bool AnimationImporter::convertAnimationNode( const Reference< XAnimationNode >& xNode, const Reference< XAnimationNode >& xParent )
672 : : {
673 [ # # ]: 0 : Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
674 [ # # ]: 0 : if( !xAnimate.is() )
675 : 0 : return true;
676 : :
677 [ # # ][ # # ]: 0 : if( !xAnimate->getTarget().hasValue() )
[ # # ]
678 : 0 : return false;
679 : :
680 [ # # ][ # # ]: 0 : const sal_Int16 nNodeType = xNode->getType();
681 : :
682 [ # # ]: 0 : if( nNodeType == AnimationNodeType::TRANSITIONFILTER )
683 : 0 : return true;
684 : :
685 [ # # ][ # # ]: 0 : OUString aAttributeName( xAnimate->getAttributeName() );
686 : :
687 [ # # ][ # # ]: 0 : if( (nNodeType == AnimationNodeType::SET) && aAttributeName == "fill.on" )
[ # # ]
688 : 0 : return false;
689 : :
690 : 0 : const ImplAttributeNameConversion* p = gImplConversionList;
691 : :
692 : 0 : MS_AttributeNames eAttribute = MS_UNKNOWN;
693 : :
694 [ # # ][ # # ]: 0 : if( (nNodeType == AnimationNodeType::ANIMATEMOTION) ||
695 : : (nNodeType == AnimationNodeType::ANIMATETRANSFORM) )
696 : : {
697 : 0 : OUString aEmpty;
698 : 0 : aAttributeName = aEmpty;
699 : : }
700 : : else
701 : : {
702 [ # # ]: 0 : while( p->mpMSName )
703 : : {
704 [ # # ]: 0 : if( aAttributeName.compareToAscii( p->mpMSName ) == 0 )
705 : 0 : break;
706 : :
707 : 0 : p++;
708 : : }
709 : :
710 : : DBG_ASSERT( p->mpMSName || aAttributeName.isEmpty(), "sd::AnimationImporter::convertAnimationNode(), unknown attribute!" );
711 : : #ifdef DBG_ANIM_LOG
712 : : if( p->mpMSName == 0 ) dump( "<error text=\"sd::AnimationImporter::convertAnimationNode(), unknown attribute!\"/>\n" );
713 : : #endif
714 : :
715 : 0 : eAttribute = p->meAttribute;
716 : :
717 [ # # ]: 0 : if( p->mpAPIName )
718 : 0 : aAttributeName = OUString::createFromAscii( p->mpAPIName );
719 : : }
720 : :
721 [ # # ][ # # ]: 0 : xAnimate->setAttributeName( aAttributeName );
722 : :
723 [ # # ]: 0 : if( eAttribute != MS_UNKNOWN )
724 : : {
725 [ # # ][ # # ]: 0 : Any aAny( xAnimate->getFrom() );
726 [ # # ]: 0 : if( aAny.hasValue() )
727 : : {
728 [ # # ][ # # ]: 0 : if( convertAnimationValue( eAttribute, aAny ) )
729 [ # # ][ # # ]: 0 : xAnimate->setFrom( aAny );
730 : : }
731 : :
732 [ # # ][ # # ]: 0 : aAny = xAnimate->getBy();
733 [ # # ]: 0 : if( aAny.hasValue() )
734 : : {
735 [ # # ][ # # ]: 0 : if( convertAnimationValue( eAttribute, aAny ) )
736 [ # # ][ # # ]: 0 : xAnimate->setBy( aAny );
737 : : }
738 : :
739 [ # # ][ # # ]: 0 : aAny = xAnimate->getTo();
740 [ # # ]: 0 : if( aAny.hasValue() )
741 : : {
742 [ # # ][ # # ]: 0 : if( convertAnimationValue( eAttribute, aAny ) )
743 [ # # ][ # # ]: 0 : xAnimate->setTo( aAny );
744 : : }
745 : :
746 [ # # ][ # # ]: 0 : Sequence< Any > aValues( xAnimate->getValues() );
747 : 0 : sal_Int32 nValues = aValues.getLength();
748 [ # # ]: 0 : if( nValues )
749 : : {
750 [ # # ]: 0 : Any* p2 = aValues.getArray();
751 [ # # ]: 0 : while( nValues-- )
752 [ # # ]: 0 : convertAnimationValue( eAttribute, *p2++ );
753 : :
754 [ # # ][ # # ]: 0 : xAnimate->setValues( aValues );
755 : : }
756 : :
757 [ # # ][ # # ]: 0 : OUString aFormula( xAnimate->getFormula() );
758 [ # # ]: 0 : if( !aFormula.isEmpty() )
759 : : {
760 [ # # ]: 0 : if( convertMeasure( aFormula ) )
761 [ # # ][ # # ]: 0 : xAnimate->setFormula( aFormula );
762 [ # # ]: 0 : }
763 : : }
764 : :
765 : : // check for after-affect
766 [ # # ][ # # ]: 0 : Sequence< NamedValue > aUserData( xNode->getUserData() );
767 [ # # ]: 0 : NamedValue* pValue = aUserData.getArray();
768 : 0 : NamedValue* pLastValue = pValue;
769 : 0 : sal_Int32 nLength = aUserData.getLength(), nRemoved = 0;
770 : :
771 : 0 : sal_Bool bAfterEffect = false;
772 : 0 : sal_Int32 nMasterRel = 0;
773 [ # # ]: 0 : for( ; nLength--; pValue++ )
774 : : {
775 [ # # ]: 0 : if ( pValue->Name == "after-effect" )
776 : : {
777 : 0 : pValue->Value >>= bAfterEffect;
778 : 0 : nRemoved++;
779 : : }
780 [ # # ]: 0 : else if ( pValue->Name == "master-rel" )
781 : : {
782 : 0 : pValue->Value >>= nMasterRel;
783 : 0 : nRemoved++;
784 : : }
785 : : else
786 : : {
787 [ # # ]: 0 : if( nRemoved )
788 : 0 : *pLastValue = *pValue;
789 : 0 : pLastValue++;
790 : : }
791 : : }
792 : :
793 [ # # ]: 0 : if( nRemoved )
794 : : {
795 [ # # ]: 0 : aUserData.realloc( aUserData.getLength() - nRemoved );
796 [ # # ][ # # ]: 0 : xNode->setUserData( aUserData );
797 : : }
798 : :
799 : : // if its an after effect node, add it to the list for
800 : : // later processing
801 : : // after effect nodes are not inserted at their import
802 : : // position, so return false in this case
803 [ # # ]: 0 : if( bAfterEffect )
804 : : {
805 [ # # ]: 0 : if( nMasterRel != 2 )
806 : : {
807 : 0 : Event aEvent;
808 : :
809 [ # # ]: 0 : aEvent.Source <<= xParent;
810 : 0 : aEvent.Trigger = EventTrigger::END_EVENT;
811 : 0 : aEvent.Repeat = 0;
812 : :
813 [ # # ][ # # ]: 0 : xNode->setBegin( makeAny( aEvent ) );
[ # # ]
814 : : }
815 : :
816 : : // add to after effect nodes for later processing
817 [ # # ]: 0 : sd::AfterEffectNode aNode( xNode, xParent, nMasterRel == 2 );
818 [ # # ]: 0 : maAfterEffectNodes.push_back( aNode );
819 [ # # ]: 0 : return false;
820 : : }
821 : :
822 [ # # ]: 0 : return true;
823 : : }
824 : :
825 : 0 : static int lcl_gethex( int nChar )
826 : : {
827 [ # # ][ # # ]: 0 : if( nChar >= '0' && nChar <= '9' )
828 : 0 : return nChar - '0';
829 [ # # ][ # # ]: 0 : else if( nChar >= 'a' && nChar <= 'f' )
830 : 0 : return nChar - 'a' + 10;
831 [ # # ][ # # ]: 0 : else if( nChar >= 'A' && nChar <= 'F' )
832 : 0 : return nChar - 'A' + 10;
833 : : else
834 : 0 : return 0;
835 : : }
836 : :
837 : 0 : bool AnimationImporter::convertAnimationValue( MS_AttributeNames eAttribute, Any& rValue )
838 : : {
839 : 0 : bool bRet = false;
840 [ # # # # : 0 : switch( eAttribute )
# # # # #
# # # ]
841 : : {
842 : : case MS_PPT_X:
843 : : case MS_PPT_Y:
844 : : case MS_PPT_W:
845 : : case MS_PPT_H:
846 : : {
847 : 0 : OUString aString;
848 : :
849 [ # # ][ # # ]: 0 : if( rValue.getValueType() == ::getCppuType((const ValuePair*)0) )
850 : : {
851 : 0 : ValuePair aValuePair;
852 [ # # ][ # # ]: 0 : if( rValue >>= aValuePair )
853 : : {
854 [ # # ]: 0 : if( aValuePair.First >>= aString )
855 : : {
856 [ # # ]: 0 : if( convertMeasure( aString ) )
857 : : {
858 [ # # ]: 0 : aValuePair.First <<= aString;
859 : 0 : bRet = true;
860 : : }
861 : : }
862 : :
863 [ # # ]: 0 : if( aValuePair.Second >>= aString )
864 : : {
865 [ # # ]: 0 : if( convertMeasure( aString ) )
866 : : {
867 [ # # ]: 0 : aValuePair.Second <<= aString;
868 : 0 : bRet = true;
869 : : }
870 : : }
871 : 0 : }
872 : : }
873 [ # # ][ # # ]: 0 : else if( rValue.getValueType() == ::getCppuType((const OUString*)0) )
874 : : {
875 [ # # ]: 0 : if( rValue >>= aString )
876 : : {
877 : 0 : bRet = convertMeasure( aString );
878 : :
879 [ # # ]: 0 : if( bRet )
880 [ # # ]: 0 : rValue <<= aString;
881 : : }
882 : 0 : }
883 : : }
884 : 0 : break;
885 : :
886 : : case MS_XSHEAR:
887 : : case MS_R:
888 : : {
889 : 0 : OUString aString;
890 [ # # ]: 0 : if( rValue >>= aString )
891 : : {
892 [ # # ]: 0 : rValue <<= aString.toDouble();
893 : 0 : bRet = true;
894 : 0 : }
895 : : }
896 : 0 : break;
897 : :
898 : : case MS_STYLEROTATION:
899 : : {
900 [ # # ]: 0 : if( rValue.getValueType() == ::getCppuType((const OUString*)0) )
901 : : {
902 : 0 : OUString aString;
903 : 0 : rValue >>= aString;
904 [ # # ]: 0 : rValue <<= (sal_Int16)aString.toDouble();
905 : 0 : bRet = true;
906 : : }
907 [ # # ]: 0 : else if( rValue.getValueType() == ::getCppuType((const double*)0) )
908 : : {
909 : 0 : double fValue = 0.0;
910 : 0 : rValue >>= fValue;
911 [ # # ]: 0 : rValue <<= (sal_Int16)fValue;
912 : 0 : bRet = true;
913 : : }
914 : : }
915 : 0 : break;
916 : :
917 : : case MS_FILLCOLOR:
918 : : case MS_STROKECOLOR:
919 : : case MS_STYLECOLOR:
920 : : case MS_PPT_C:
921 : : {
922 : 0 : OUString aString;
923 [ # # ]: 0 : if( rValue >>= aString )
924 : : {
925 [ # # ][ # # ]: 0 : if( aString.getLength() >= 7 && aString[0] == '#' )
[ # # ]
926 : : {
927 : 0 : Color aColor;
928 [ # # ]: 0 : aColor.SetRed( (sal_uInt8)(lcl_gethex( aString[1] ) * 16 + lcl_gethex( aString[2] )) );
929 [ # # ]: 0 : aColor.SetGreen( (sal_uInt8)(lcl_gethex( aString[3] ) * 16 + lcl_gethex( aString[4] )) );
930 [ # # ]: 0 : aColor.SetBlue( (sal_uInt8)(lcl_gethex( aString[5] ) * 16 + lcl_gethex( aString[6] )) );
931 [ # # ]: 0 : rValue <<= (sal_Int32)aColor.GetColor();
932 : 0 : bRet = true;
933 : : }
934 [ # # ]: 0 : else if( aString.matchAsciiL( "rgb(", 4, 0 ) )
935 : : {
936 : 0 : aString = aString.copy( 4, aString.getLength() - 5 );
937 : 0 : Color aColor;
938 : 0 : sal_Int32 index = 0;
939 [ # # ]: 0 : aColor.SetRed( (sal_uInt8)aString.getToken( 0, (sal_Unicode)',', index ).toInt32() );
940 [ # # ]: 0 : aColor.SetGreen( (sal_uInt8)aString.getToken( 0, (sal_Unicode)',', index ).toInt32() );
941 [ # # ]: 0 : aColor.SetRed( (sal_uInt8)aString.getToken( 0, (sal_Unicode)',', index ).toInt32() );
942 [ # # ]: 0 : rValue <<= (sal_Int32)aColor.GetColor();
943 : 0 : bRet = true;
944 : : }
945 [ # # ]: 0 : else if( aString.matchAsciiL( "hsl(", 4, 0 ) )
946 : : {
947 : 0 : sal_Int32 index = 0;
948 : 0 : sal_Int32 nA = aString.getToken( 0, (sal_Unicode)',', index ).toInt32();
949 : 0 : sal_Int32 nB = aString.getToken( 0, (sal_Unicode)',', index ).toInt32();
950 : 0 : sal_Int32 nC = aString.getToken( 0, (sal_Unicode)',', index ).toInt32();
951 : 0 : dump( "hsl(%ld", nA );
952 : 0 : dump( ",%ld", nB );
953 : 0 : dump( ",%ld)", nC );
954 [ # # ]: 0 : Sequence< double > aHSL( 3 );
955 [ # # ]: 0 : aHSL[0] = nA * 360.0/255.0;
956 [ # # ]: 0 : aHSL[1] = nB / 255.0;
957 [ # # ]: 0 : aHSL[2] = nC / 255.0;
958 [ # # ]: 0 : rValue <<= aHSL;
959 [ # # ]: 0 : bRet = true;
960 : : }
961 : 0 : }
962 : : }
963 : 0 : break;
964 : :
965 : : case MS_FILLTYPE:
966 : : {
967 : 0 : OUString aString;
968 [ # # ]: 0 : if( rValue >>= aString )
969 : : {
970 [ # # ][ # # ]: 0 : rValue <<= aString == "solid" ? FillStyle_SOLID : FillStyle_NONE;
971 : 0 : bRet = true;
972 : 0 : }
973 : : }
974 : 0 : break;
975 : :
976 : : case MS_STROKEON:
977 : : {
978 : 0 : OUString aString;
979 [ # # ]: 0 : if( rValue >>= aString )
980 : : {
981 [ # # ][ # # ]: 0 : rValue <<= aString == "true" ? ::com::sun::star::drawing::LineStyle_SOLID : ::com::sun::star::drawing::LineStyle_NONE;
982 : 0 : bRet = true;
983 : 0 : }
984 : : }
985 : 0 : break;
986 : :
987 : : case MS_FONTWEIGHT:
988 : : {
989 : 0 : OUString aString;
990 [ # # ]: 0 : if( rValue >>= aString )
991 : : {
992 [ # # ][ # # ]: 0 : rValue <<= aString == "bold" ? com::sun::star::awt::FontWeight::BOLD : com::sun::star::awt::FontWeight::NORMAL;
993 : 0 : bRet = true;
994 : 0 : }
995 : : }
996 : 0 : break;
997 : :
998 : : case MS_STYLEFONTSTYLE:
999 : : {
1000 : 0 : OUString aString;
1001 [ # # ]: 0 : if( rValue >>= aString )
1002 : : {
1003 [ # # ][ # # ]: 0 : rValue <<= aString == "italic" ? com::sun::star::awt::FontSlant_ITALIC : com::sun::star::awt::FontSlant_NONE;
1004 : 0 : bRet = true;
1005 : 0 : }
1006 : : }
1007 : 0 : break;
1008 : :
1009 : : case MS_STYLEUNDERLINE:
1010 : : {
1011 : 0 : OUString aString;
1012 [ # # ]: 0 : if( rValue >>= aString )
1013 : : {
1014 [ # # ][ # # ]: 0 : rValue <<= aString == "true" ? com::sun::star::awt::FontUnderline::SINGLE : com::sun::star::awt::FontUnderline::NONE;
1015 : 0 : bRet = true;
1016 : 0 : }
1017 : : }
1018 : 0 : break;
1019 : :
1020 : : case MS_STYLEOPACITY:
1021 : : case MS_STYLEFONTSIZE:
1022 : : {
1023 : 0 : OUString aString;
1024 [ # # ]: 0 : if( rValue >>= aString )
1025 : : {
1026 [ # # ]: 0 : rValue <<= (float)aString.toDouble();
1027 : 0 : bRet = true;
1028 : 0 : }
1029 : : }
1030 : 0 : break;
1031 : :
1032 : : case MS_STYLEVISIBILITY:
1033 : : {
1034 : 0 : OUString aString;
1035 [ # # ]: 0 : if( rValue >>= aString )
1036 : : {
1037 [ # # ][ # # ]: 0 : rValue <<= aString == "visible" ? sal_True : sal_False;
1038 : 0 : bRet = true;
1039 : 0 : }
1040 : : }
1041 : 0 : break;
1042 : : default:
1043 : 0 : break;
1044 : : }
1045 : :
1046 : 0 : return bRet;
1047 : : }
1048 : :
1049 : : // --------------------------------------------------------------------
1050 : :
1051 : 0 : static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId, sal_Int32 nPresetSubType )
1052 : : {
1053 : 0 : const sal_Char* pStr = 0;
1054 : :
1055 [ # # ][ # # ]: 0 : if( (nPresetClass == EffectPresetClass::ENTRANCE) || (nPresetClass == EffectPresetClass::EXIT) )
1056 : : {
1057 : : // skip wheel effect
1058 [ # # ]: 0 : if( nPresetId != 21 )
1059 : : {
1060 [ # # ]: 0 : if( nPresetId == 5 )
1061 : : {
1062 : : // checkerboard
1063 [ # # # ]: 0 : switch( nPresetSubType )
1064 : : {
1065 : 0 : case 5: pStr = "downward"; break;
1066 : 0 : case 10: pStr = "across"; break;
1067 : : }
1068 : : }
1069 [ # # ]: 0 : else if( nPresetId == 17 )
1070 : : {
1071 : : // stretch
1072 [ # # ]: 0 : if( nPresetSubType == 10 )
1073 : 0 : pStr = "across";
1074 : : }
1075 [ # # ]: 0 : else if( nPresetId == 18 )
1076 : : {
1077 : : // strips
1078 [ # # # # : 0 : switch( nPresetSubType )
# ]
1079 : : {
1080 : 0 : case 3: pStr = "right-to-top"; break;
1081 : 0 : case 6: pStr = "right-to-bottom"; break;
1082 : 0 : case 9: pStr = "left-to-top"; break;
1083 : 0 : case 12: pStr = "left-to-bottom"; break;
1084 : : }
1085 : : }
1086 : :
1087 [ # # ]: 0 : if( pStr == 0 )
1088 : : {
1089 : 0 : const convert_subtype* p = gConvertArray;
1090 : :
1091 [ # # ]: 0 : while( p->mpStrSubType )
1092 : : {
1093 [ # # ]: 0 : if( p->mnID == nPresetSubType )
1094 : : {
1095 : 0 : pStr = p->mpStrSubType;
1096 : 0 : break;
1097 : : }
1098 : 0 : p++;
1099 : : }
1100 : : }
1101 : : }
1102 : : }
1103 : :
1104 [ # # ]: 0 : if( pStr )
1105 : 0 : return OUString::createFromAscii( pStr );
1106 : : else
1107 : 0 : return OUString::valueOf( nPresetSubType );
1108 : : }
1109 : :
1110 : : // --------------------------------------------------------------------
1111 : :
1112 : 0 : void AnimationImporter::fillNode( Reference< XAnimationNode >& xNode, const AnimationNode& rNode, const PropertySet& rSet )
1113 : : {
1114 : 0 : sal_Bool bAfterEffect = false;
1115 : :
1116 : : // attribute Restart
1117 [ # # ]: 0 : if( rNode.mnRestart )
1118 : : {
1119 : 0 : sal_Int16 nRestart = AnimationRestart::DEFAULT;
1120 [ # # # # ]: 0 : switch( rNode.mnRestart )
1121 : : {
1122 : 0 : case 1: nRestart = AnimationRestart::ALWAYS; break;
1123 : 0 : case 2: nRestart = AnimationRestart::WHEN_NOT_ACTIVE; break;
1124 : 0 : case 3: nRestart = AnimationRestart::NEVER; break;
1125 : : }
1126 [ # # ][ # # ]: 0 : xNode->setRestart( nRestart );
1127 : : }
1128 : :
1129 : : // attribute Fill
1130 [ # # ]: 0 : if( rNode.mnFill )
1131 : : {
1132 : 0 : sal_Int16 nFill = AnimationFill::DEFAULT;
1133 [ # # # # : 0 : switch( rNode.mnFill )
# ]
1134 : : {
1135 : 0 : case 1: nFill = AnimationFill::REMOVE; break;
1136 : 0 : case 2: nFill = AnimationFill::FREEZE; break;
1137 : 0 : case 3: nFill = AnimationFill::HOLD; break;
1138 : 0 : case 4: nFill = AnimationFill::TRANSITION; break;
1139 : : }
1140 [ # # ][ # # ]: 0 : xNode->setFill( nFill );
1141 : : }
1142 : :
1143 : : // attribute Duration
1144 [ # # ]: 0 : if( rNode.mnDuration )
1145 : : {
1146 : 0 : Any aDuration;
1147 [ # # ]: 0 : if( rNode.mnDuration > 0 )
1148 : : {
1149 [ # # ]: 0 : aDuration <<= (double)(rNode.mnDuration / 1000.0);
1150 : : }
1151 [ # # ]: 0 : else if( rNode.mnDuration < 0 )
1152 : : {
1153 [ # # ]: 0 : aDuration <<= Timing_INDEFINITE;
1154 : : }
1155 [ # # ][ # # ]: 0 : xNode->setDuration( aDuration );
1156 : : }
1157 : :
1158 : : // TODO: DFF_ANIM_PATH_EDIT_MODE
1159 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_PATH_EDIT_MODE ) )
1160 : : {
1161 : : sal_Int32 nPathEditMode ;
1162 [ # # ]: 0 : if( rSet.getProperty( DFF_ANIM_PATH_EDIT_MODE ) >>= nPathEditMode )
1163 : : {
1164 : : }
1165 : : }
1166 : :
1167 : : // set user data
1168 [ # # ]: 0 : Sequence< NamedValue > aUserData;
1169 : :
1170 : : // attribute Type
1171 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_NODE_TYPE ) )
1172 : : {
1173 : 0 : sal_Int32 nPPTNodeType = 0;
1174 [ # # ][ # # ]: 0 : if( rSet.getProperty( DFF_ANIM_NODE_TYPE ) >>= nPPTNodeType )
1175 : : {
1176 : 0 : sal_Int16 nNodeType = ::com::sun::star::presentation::EffectNodeType::DEFAULT;
1177 [ # # # # : 0 : switch( nPPTNodeType )
# # # ]
1178 : : {
1179 : 0 : case DFF_ANIM_NODE_TYPE_ON_CLICK: nNodeType = ::com::sun::star::presentation::EffectNodeType::ON_CLICK; break;
1180 : 0 : case DFF_ANIM_NODE_TYPE_WITH_PREVIOUS: nNodeType = ::com::sun::star::presentation::EffectNodeType::WITH_PREVIOUS; break;
1181 : 0 : case DFF_ANIM_NODE_TYPE_AFTER_PREVIOUS: nNodeType = ::com::sun::star::presentation::EffectNodeType::AFTER_PREVIOUS; break;
1182 : 0 : case DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE: nNodeType = ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE; break;
1183 : 0 : case DFF_ANIM_NODE_TYPE_TIMING_ROOT: nNodeType = ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT; break;
1184 : 0 : case DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ:nNodeType = ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE; break;
1185 : : }
1186 : :
1187 : 0 : sal_Int32 nSize = aUserData.getLength();
1188 [ # # ]: 0 : aUserData.realloc(nSize+1);
1189 [ # # ]: 0 : aUserData[nSize].Name = "node-type";
1190 [ # # ][ # # ]: 0 : aUserData[nSize].Value <<= nNodeType;
1191 : : }
1192 : : }
1193 : :
1194 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_GROUP_ID ) )
1195 : : {
1196 : : sal_Int32 nGroupId;
1197 [ # # ][ # # ]: 0 : if( rSet.getProperty( DFF_ANIM_GROUP_ID ) >>= nGroupId )
1198 : : {
1199 : 0 : sal_Int32 nSize = aUserData.getLength();
1200 [ # # ]: 0 : aUserData.realloc(nSize+1);
1201 [ # # ]: 0 : aUserData[nSize].Name = "group-id";
1202 [ # # ][ # # ]: 0 : aUserData[nSize].Value <<= nGroupId;
1203 : : }
1204 : : }
1205 : :
1206 : 0 : sal_Int16 nEffectPresetClass = EffectPresetClass::CUSTOM;
1207 : 0 : sal_Int32 nPresetId = 0;
1208 : :
1209 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_PRESET_CLASS ) )
1210 : : {
1211 : 0 : sal_Int32 nPresetClass = 0;
1212 [ # # ][ # # ]: 0 : if ( rSet.getProperty( DFF_ANIM_PRESET_CLASS ) >>= nPresetClass )
1213 : : {
1214 [ # # # # : 0 : switch( nPresetClass )
# # # ]
1215 : : {
1216 : 0 : case DFF_ANIM_PRESS_CLASS_ENTRANCE: nEffectPresetClass = EffectPresetClass::ENTRANCE; break;
1217 : 0 : case DFF_ANIM_PRESS_CLASS_EXIT: nEffectPresetClass = EffectPresetClass::EXIT; break;
1218 : 0 : case DFF_ANIM_PRESS_CLASS_EMPHASIS: nEffectPresetClass = EffectPresetClass::EMPHASIS; break;
1219 : 0 : case DFF_ANIM_PRESS_CLASS_MOTIONPATH: nEffectPresetClass = EffectPresetClass::MOTIONPATH; break;
1220 : 0 : case DFF_ANIM_PRESS_CLASS_OLE_ACTION: nEffectPresetClass = EffectPresetClass::OLEACTION; break;
1221 : 0 : case DFF_ANIM_PRESS_CLASS_MEDIACALL: nEffectPresetClass = EffectPresetClass::MEDIACALL; break;
1222 : : }
1223 : 0 : sal_Int32 nSize = aUserData.getLength();
1224 [ # # ]: 0 : aUserData.realloc(nSize+1);
1225 [ # # ]: 0 : aUserData[nSize].Name = "preset-class";
1226 [ # # ][ # # ]: 0 : aUserData[nSize].Value <<= nEffectPresetClass;
1227 : : }
1228 : : }
1229 : :
1230 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_PRESET_ID ) )
1231 : : {
1232 [ # # ][ # # ]: 0 : if( rSet.getProperty( DFF_ANIM_PRESET_ID ) >>= nPresetId )
1233 : : {
1234 : 0 : sal_Int32 nSize = aUserData.getLength();
1235 [ # # ]: 0 : aUserData.realloc(nSize+1);
1236 [ # # ]: 0 : aUserData[nSize].Name = "preset-id";
1237 : :
1238 : 0 : const preset_maping* p = gPresetMaping;
1239 [ # # ][ # # ]: 0 : while( p->mpStrPresetId && ((p->mnPresetClass != nEffectPresetClass) || (p->mnPresetId != nPresetId )) )
[ # # ][ # # ]
1240 : 0 : p++;
1241 : :
1242 [ # # ]: 0 : if( p->mpStrPresetId )
1243 : : {
1244 [ # # ][ # # ]: 0 : aUserData[nSize].Value <<= OUString::createFromAscii( p->mpStrPresetId );
1245 : : }
1246 : : else
1247 : : {
1248 : 0 : OUStringBuffer sBuffer;
1249 [ # # ]: 0 : sBuffer.appendAscii( "ppt_" );
1250 [ # # # # : 0 : switch( nEffectPresetClass )
# # # ]
1251 : : {
1252 [ # # ]: 0 : case EffectPresetClass::ENTRANCE: sBuffer.appendAscii( "entrance_" ); break;
1253 [ # # ]: 0 : case EffectPresetClass::EXIT: sBuffer.appendAscii( "exit_" ); break;
1254 [ # # ]: 0 : case EffectPresetClass::EMPHASIS: sBuffer.appendAscii( "emphasis_" ); break;
1255 [ # # ]: 0 : case EffectPresetClass::MOTIONPATH: sBuffer.appendAscii( "motionpath_" ); break;
1256 [ # # ]: 0 : case EffectPresetClass::OLEACTION: sBuffer.appendAscii( "oleaction_" ); break;
1257 [ # # ]: 0 : case EffectPresetClass::MEDIACALL: sBuffer.appendAscii( "mediacall_" ); break;
1258 : : }
1259 [ # # ]: 0 : sBuffer.append( nPresetId );
1260 : :
1261 [ # # ][ # # ]: 0 : aUserData[nSize].Value <<= sBuffer.makeStringAndClear();
[ # # ]
1262 : : }
1263 : : }
1264 : : }
1265 : :
1266 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_PRESET_SUB_TYPE ) )
1267 : : {
1268 : 0 : sal_Int32 nPresetSubType = 0;
1269 [ # # ][ # # ]: 0 : if( (rSet.getProperty( DFF_ANIM_PRESET_SUB_TYPE ) >>= nPresetSubType) )
1270 : : {
1271 [ # # ]: 0 : if( nPresetSubType )
1272 : : {
1273 : 0 : sal_Int32 nSize = aUserData.getLength();
1274 [ # # ]: 0 : aUserData.realloc(nSize+1);
1275 [ # # ]: 0 : aUserData[nSize].Name = "preset-sub-type";
1276 [ # # ][ # # ]: 0 : aUserData[nSize].Value <<= getConvertedSubType( nEffectPresetClass, nPresetId, nPresetSubType );
1277 : : }
1278 : : }
1279 : : }
1280 : :
1281 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_AFTEREFFECT ) )
1282 : : {
1283 [ # # ][ # # ]: 0 : if( rSet.getProperty( DFF_ANIM_AFTEREFFECT ) >>= bAfterEffect )
1284 : : {
1285 : 0 : sal_Int32 nSize = aUserData.getLength();
1286 [ # # ]: 0 : aUserData.realloc(nSize+1);
1287 [ # # ]: 0 : aUserData[nSize].Name = "after-effect";
1288 [ # # ][ # # ]: 0 : aUserData[nSize].Value <<= bAfterEffect;
1289 : : }
1290 : : }
1291 : :
1292 [ # # ][ # # ]: 0 : if( bAfterEffect && rSet.hasProperty( DFF_ANIM_MASTERREL ) )
[ # # ][ # # ]
1293 : : {
1294 : 0 : sal_Int32 nMasterRel = 2;
1295 [ # # ][ # # ]: 0 : if( rSet.getProperty( DFF_ANIM_MASTERREL ) >>= nMasterRel )
1296 : : {
1297 : 0 : sal_Int32 nSize = aUserData.getLength();
1298 [ # # ]: 0 : aUserData.realloc(nSize+1);
1299 [ # # ]: 0 : aUserData[nSize].Name = "master-rel";
1300 [ # # ][ # # ]: 0 : aUserData[nSize].Value <<= nMasterRel;
1301 : : }
1302 : : }
1303 : :
1304 [ # # ][ # # ]: 0 : xNode->setUserData( aUserData );
1305 : :
1306 : : // TODO: DFF_ANIM_ID
1307 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_ID ) )
1308 : : {
1309 : 0 : rtl::OUString aString;
1310 [ # # ]: 0 : rSet.getProperty( DFF_ANIM_ID ) >>= aString;
1311 : : //if( !aString.isEmpty() )
1312 : : //{
1313 : : //}
1314 : : }
1315 : :
1316 : : // TODO: DFF_ANIM_EVENT_FILTER
1317 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_EVENT_FILTER ) )
1318 : : {
1319 : 0 : rtl::OUString aString;
1320 [ # # ]: 0 : rSet.getProperty( DFF_ANIM_EVENT_FILTER ) >>= aString;
1321 : : //if( !aString.isEmpty() )
1322 : : //{
1323 : : //}
1324 : : }
1325 : :
1326 : : // DFF_ANIM_TIMEFILTER
1327 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_TIMEFILTER ) )
1328 : : {
1329 [ # # ]: 0 : Reference< XAnimate > xAnim( xNode, UNO_QUERY );
1330 [ # # ]: 0 : if( xAnim.is() )
1331 : : {
1332 : 0 : rtl::OUString aString;
1333 [ # # ]: 0 : rSet.getProperty( DFF_ANIM_TIMEFILTER ) >>= aString;
1334 [ # # ]: 0 : if( !aString.isEmpty() )
1335 : : {
1336 : 0 : sal_Int32 nElements = 1; // a non empty string has at least one value
1337 : :
1338 : 0 : sal_Int32 fromIndex = 0;
1339 : 0 : while(true)
1340 : : {
1341 : 0 : fromIndex = aString.indexOf( (sal_Unicode)';', fromIndex );
1342 [ # # ]: 0 : if( fromIndex == -1 )
1343 : 0 : break;
1344 : :
1345 : 0 : fromIndex++;
1346 : 0 : nElements++;
1347 : : }
1348 : :
1349 [ # # ]: 0 : Sequence< TimeFilterPair > aTimeFilter( nElements );
1350 : :
1351 [ # # ]: 0 : TimeFilterPair* pValues = aTimeFilter.getArray();
1352 : 0 : sal_Int32 nIndex = 0;
1353 [ # # ][ # # ]: 0 : while( (nElements--) && (nIndex >= 0) )
[ # # ]
1354 : : {
1355 : 0 : const OUString aToken( aString.getToken( 0, ';', nIndex ) );
1356 : :
1357 : 0 : sal_Int32 nPos = aToken.indexOf( ',' );
1358 [ # # ]: 0 : if( nPos >= 0 )
1359 : : {
1360 : 0 : pValues->Time = aToken.copy( 0, nPos ).toDouble();
1361 : 0 : pValues->Progress = aToken.copy( nPos+1, aToken.getLength() - nPos - 1 ).toDouble();
1362 : : }
1363 : 0 : pValues++;
1364 : 0 : }
1365 : :
1366 [ # # ][ # # ]: 0 : xAnim->setTimeFilter( aTimeFilter );
[ # # ]
1367 : 0 : }
1368 : 0 : }
1369 : : }
1370 : :
1371 : :
1372 : : // TODO: DFF_ANIM_ENDAFTERSLIDE / DFF_ANIM_VOLUME handling. git history has sample code
1373 [ # # ]: 0 : Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
1374 [ # # ]: 0 : if( xColor.is() )
1375 : : {
1376 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_DIRECTION ) )
1377 : : {
1378 : 0 : sal_Bool bDirection = sal_False;
1379 [ # # ][ # # ]: 0 : if( rSet.getProperty( DFF_ANIM_DIRECTION ) >>= bDirection )
1380 [ # # ][ # # ]: 0 : xColor->setDirection( (sal_Bool)!bDirection );
1381 : : }
1382 : :
1383 [ # # ][ # # ]: 0 : if( rSet.hasProperty( DFF_ANIM_COLORSPACE ) )
1384 : : {
1385 : 0 : sal_Int32 nColorSpace = 0;
1386 [ # # ]: 0 : rSet.getProperty( DFF_ANIM_COLORSPACE ) >>= nColorSpace;
1387 [ # # ][ # # ]: 0 : xColor->setColorInterpolation( (nColorSpace == 0) ? AnimationColorSpace::RGB : AnimationColorSpace::HSL );
[ # # ]
1388 : : }
1389 [ # # ]: 0 : }
1390 : 0 : }
1391 : :
1392 : : // --------------------------------------------------------------------
1393 : :
1394 : 0 : void AnimationImporter::importTimeContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
1395 : : {
1396 : : DBG_ASSERT( pAtom && xNode.is(), "invalid call to ppt::AnimationImporter::importTimeContainer()!");
1397 [ # # ][ # # ]: 0 : if( pAtom && xNode.is() )
[ # # ]
1398 : : {
1399 : 0 : importAnimationEvents( pAtom, xNode );
1400 : 0 : importAnimationValues( pAtom, xNode );
1401 : 0 : importAnimationActions( pAtom, xNode );
1402 : :
1403 : 0 : dump(">\n");
1404 : :
1405 : : // import sub containers
1406 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
1407 : :
1408 [ # # ]: 0 : while( pChildAtom )
1409 : : {
1410 [ # # # # : 0 : switch( pChildAtom->getType() )
# # ]
1411 : : {
1412 : : case DFF_msofbtAnimNode:
1413 : : case DFF_msofbtAnimEvent:
1414 : : case DFF_msofbtAnimValue:
1415 : : case DFF_msofbtAnimAction:
1416 : : case DFF_msofbtAnimPropertySet:
1417 : 0 : break;
1418 : :
1419 : : case DFF_msofbtAnimSubGoup :
1420 : : {
1421 [ # # ]: 0 : if( pChildAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
1422 : : {
1423 : 0 : const OUString aServiceName( "com.sun.star.animations.Command" );
1424 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xChildNode( ::comphelper::getProcessServiceFactory()->createInstance(aServiceName), UNO_QUERY );
[ # # ][ # # ]
1425 [ # # ]: 0 : importAnimationNodeContainer( pChildAtom, xChildNode );
1426 [ # # ]: 0 : Reference< XTimeContainer > xParentContainer( xNode, UNO_QUERY );
1427 [ # # ][ # # ]: 0 : if( xParentContainer.is() && xChildNode.is() )
[ # # ]
1428 [ # # ][ # # ]: 0 : xParentContainer->appendChild( xChildNode );
1429 : : }
1430 : : else
1431 : : {
1432 : 0 : importAnimationContainer( pChildAtom, xNode );
1433 : : }
1434 : : }
1435 : 0 : break;
1436 : : case DFF_msofbtAnimGroup :
1437 : : {
1438 : 0 : importAnimationContainer( pChildAtom, xNode );
1439 : : }
1440 : 0 : break;
1441 : : case DFF_msofbtAnimIteration:
1442 : : {
1443 [ # # ]: 0 : if( pChildAtom->seekToContent() )
1444 : : {
1445 : : float fInterval;
1446 : : sal_Int32 nTextUnitEffect, nU1, nU2, nU3;
1447 : :
1448 [ # # ][ # # ]: 0 : mrStCtrl >> fInterval >> nTextUnitEffect >> nU1 >> nU2 >> nU3;
[ # # ][ # # ]
[ # # ]
1449 : :
1450 [ # # ]: 0 : Reference< XIterateContainer > xIter( xNode, UNO_QUERY );
1451 [ # # ]: 0 : if( xIter.is() )
1452 : : {
1453 : 0 : sal_Int16 nIterateType = TextAnimationType::BY_PARAGRAPH;
1454 [ # # # ]: 0 : switch( nTextUnitEffect )
1455 : : {
1456 : 0 : case 1: nIterateType = TextAnimationType::BY_WORD; break;
1457 : 0 : case 2: nIterateType = TextAnimationType::BY_LETTER; break;
1458 : : }
1459 [ # # ][ # # ]: 0 : xIter->setIterateType( nIterateType );
1460 [ # # ][ # # ]: 0 : xIter->setIterateInterval( (double)fInterval );
1461 : : }
1462 : :
1463 : 0 : dump( "<iterate" );
1464 [ # # ][ # # ]: 0 : dump( " iterateType=\"%s\"", (nTextUnitEffect == 0) ? "byElement" : (nTextUnitEffect == 1) ? "byWord" : "byLetter" );
1465 : 0 : dump( " iterateInterval=\"%g\"", fInterval );
1466 : 0 : dump( " u1=\"%ld\"", nU1 );
1467 : 0 : dump( " u2=\"%ld\"", nU2 );
1468 : 0 : dump( " u3=\"%ld\"/>\n", nU3 );
1469 : : }
1470 : : }
1471 : 0 : break;
1472 : :
1473 : : case 0xf136:
1474 : : {
1475 : : #ifdef DBG_ANIM_LOG
1476 : : sal_uInt32 nU1, nU2;
1477 : : mrStCtrl >> nU1 >> nU2;
1478 : :
1479 : : fprintf( mpFile, "<unknown_0xf136 nU1=\"%ld\" nU2=\"%ld\"/>\n", nU1, nU2 );
1480 : : #endif
1481 : : }
1482 : 0 : break;
1483 : :
1484 : : default:
1485 : : {
1486 : 0 : dump_atom_header( pChildAtom, true, false );
1487 : 0 : dump_atom( pChildAtom );
1488 : 0 : dump_atom_header( pChildAtom, false, false );
1489 : : }
1490 : 0 : break;
1491 : : }
1492 : :
1493 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
1494 : : }
1495 : : }
1496 : 0 : }
1497 : :
1498 : : // --------------------------------------------------------------------
1499 : :
1500 : 0 : void AnimationImporter::importAnimationNodeContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
1501 : : {
1502 : : DBG_ASSERT( pAtom && xNode.is(), "invalid call to ppt::AnimationImporter::importAnimationNodeContainer()!");
1503 [ # # ][ # # ]: 0 : if( pAtom && xNode.is() )
[ # # ]
1504 : : {
1505 : 0 : importAnimationEvents( pAtom, xNode );
1506 : 0 : importAnimationValues( pAtom, xNode );
1507 : 0 : importAnimationActions( pAtom, xNode );
1508 : :
1509 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
1510 : :
1511 [ # # ]: 0 : while( pChildAtom )
1512 : : {
1513 [ # # # # : 0 : switch( pChildAtom->getType() )
# # # # #
# ]
1514 : : {
1515 : : case DFF_msofbtAnimNode:
1516 : : case DFF_msofbtAnimEvent:
1517 : : case DFF_msofbtAnimValue:
1518 : : case DFF_msofbtAnimAction:
1519 : : case DFF_msofbtAnimPropertySet:
1520 : 0 : break;
1521 : :
1522 : : case DFF_msofbtAnimateFilter:
1523 : 0 : importAnimateFilterContainer( pChildAtom, xNode );
1524 : 0 : break;
1525 : :
1526 : : case DFF_msofbtAnimateSet:
1527 : 0 : importAnimateSetContainer( pChildAtom, xNode );
1528 : 0 : break;
1529 : :
1530 : : case DFF_msofbtAnimate:
1531 : 0 : importAnimateContainer( pChildAtom, xNode );
1532 : 0 : break;
1533 : :
1534 : : case DFF_msofbtAnimateScale:
1535 : 0 : importAnimateScaleContainer( pChildAtom, xNode );
1536 : 0 : break;
1537 : :
1538 : : case DFF_msofbtAnimateColor:
1539 : 0 : importAnimateColorContainer( pChildAtom, xNode );
1540 : 0 : break;
1541 : :
1542 : : case DFF_msofbtAnimateRotation:
1543 : 0 : importAnimateRotationContainer( pChildAtom, xNode );
1544 : 0 : break;
1545 : :
1546 : : case DFF_msofbtAnimateMotion:
1547 : 0 : importAnimateMotionContainer( pChildAtom, xNode );
1548 : 0 : break;
1549 : :
1550 : : case DFF_msofbtAnimCommand:
1551 : 0 : importCommandContainer( pChildAtom, xNode );
1552 : 0 : break;
1553 : :
1554 : : default:
1555 : : {
1556 : 0 : dump_atom_header( pChildAtom, true, false );
1557 : 0 : dump_atom( pChildAtom );
1558 : 0 : dump_atom_header( pChildAtom, false, false );
1559 : : }
1560 : 0 : break;
1561 : : }
1562 : :
1563 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
1564 : : }
1565 : : }
1566 : 0 : }
1567 : :
1568 : : // --------------------------------------------------------------------
1569 : :
1570 : 0 : void AnimationImporter::importAnimateFilterContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
1571 : : {
1572 [ # # ]: 0 : Reference< XTransitionFilter > xFilter( xNode, UNO_QUERY );
1573 : :
1574 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateFilter && xFilter.is(), "invalid call to ppt::AnimationImporter::importAnimateFilterContainer()!");
1575 [ # # ][ # # ]: 0 : if( pAtom && xFilter.is() )
[ # # ]
1576 : : {
1577 : 0 : sal_uInt32 nBits = 0;
1578 : :
1579 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
1580 : :
1581 [ # # ]: 0 : while( pChildAtom )
1582 : : {
1583 [ # # ]: 0 : if( !pChildAtom->isContainer() )
1584 : : {
1585 [ # # ][ # # ]: 0 : if( !pChildAtom->seekToContent() )
1586 : 0 : break;
1587 : : }
1588 : :
1589 [ # # # # ]: 0 : switch( pChildAtom->getType() )
1590 : : {
1591 : : case DFF_msofbtAnimateFilterData:
1592 : : {
1593 : : sal_uInt32 transition;
1594 [ # # ]: 0 : mrStCtrl >> nBits;
1595 [ # # ]: 0 : mrStCtrl >> transition;
1596 : :
1597 [ # # ]: 0 : if( nBits & 1 )
1598 [ # # ][ # # ]: 0 : xFilter->setMode( transition == 0 );
1599 : :
1600 [ # # ]: 0 : dump( " transition=\"%s\"", (transition == 0) ? "in" : "out" );
1601 : : }
1602 : 0 : break;
1603 : :
1604 : : case DFF_msofbtAnimAttributeValue:
1605 : : {
1606 [ # # ][ # # ]: 0 : if( (nBits & 2 ) && ( pChildAtom->getInstance() == 1 ) )
[ # # ]
1607 : : {
1608 : 0 : Any aAny;
1609 [ # # ][ # # ]: 0 : if ( importAttributeValue( pChildAtom, aAny ) )
1610 : : {
1611 : 0 : rtl::OUString filter;
1612 : 0 : aAny >>= filter;
1613 : :
1614 : 0 : dump( " filter=\"%s\"", filter );
1615 : :
1616 : 0 : const transition* pTransition = transition::find( filter );
1617 [ # # ]: 0 : if( pTransition )
1618 : : {
1619 [ # # ][ # # ]: 0 : xFilter->setTransition( pTransition->mnType );
1620 [ # # ][ # # ]: 0 : xFilter->setSubtype( pTransition->mnSubType );
1621 [ # # ][ # # ]: 0 : xFilter->setDirection( pTransition->mbDirection );
1622 : : }
1623 : : else
1624 : : {
1625 : : OSL_FAIL( "unknown transition!" );
1626 : 0 : }
1627 : 0 : }
1628 : : }
1629 : : }
1630 : 0 : break;
1631 : :
1632 : : case DFF_msofbtAnimateTarget:
1633 [ # # ]: 0 : importAnimateAttributeTargetContainer( pChildAtom, xNode );
1634 : 0 : break;
1635 : :
1636 : : default:
1637 : 0 : dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
1638 : 0 : break;
1639 : :
1640 : : }
1641 : :
1642 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
1643 : : }
1644 : 0 : }
1645 : 0 : }
1646 : :
1647 : : // --------------------------------------------------------------------
1648 : :
1649 : 0 : void AnimationImporter::importAnimateAttributeTargetContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
1650 : : {
1651 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateTarget, "invalid call to ppt::AnimationImporter::importAnimateAttributeTargetContainer()!");
1652 : :
1653 : 0 : Any aTarget;
1654 : :
1655 [ # # ]: 0 : Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
1656 : :
1657 : 0 : bool bWrongContext = false;
1658 : :
1659 [ # # ]: 0 : if( pAtom )
1660 : : {
1661 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
1662 : :
1663 [ # # ]: 0 : while( pChildAtom )
1664 : : {
1665 [ # # ]: 0 : if( !pChildAtom->isContainer() )
1666 : : {
1667 [ # # ][ # # ]: 0 : if( !pChildAtom->seekToContent() )
1668 : 0 : break;
1669 : : }
1670 : :
1671 [ # # # # : 0 : switch( pChildAtom->getType() )
# ]
1672 : : {
1673 : : case DFF_msofbtAnimPropertySet:
1674 : : {
1675 [ # # ]: 0 : PropertySet aSet;
1676 [ # # ]: 0 : importPropertySetContainer( pChildAtom, aSet );
1677 [ # # ][ # # ]: 0 : if( aSet.hasProperty( DFF_ANIM_RUNTIMECONTEXT ) )
1678 : : {
1679 : 0 : OUString aContext;
1680 [ # # ][ # # ]: 0 : if( aSet.getProperty( DFF_ANIM_RUNTIMECONTEXT ) >>= aContext )
1681 : : {
1682 [ # # ]: 0 : if( aContext != "PPT" )
1683 : 0 : bWrongContext = true;
1684 : 0 : }
1685 : : }
1686 : :
1687 : 0 : dump( aSet );
1688 : : }
1689 : 0 : break;
1690 : :
1691 : : case DFF_msofbtAnimateTargetSettings:
1692 : : {
1693 [ # # ]: 0 : if( xAnimate.is() )
1694 : : {
1695 : : sal_uInt32 nBits;
1696 : : sal_uInt32 nAdditive;
1697 : : sal_uInt32 nAccumulate;
1698 : : sal_uInt32 nTransformType;
1699 : :
1700 [ # # ][ # # ]: 0 : mrStCtrl >> nBits >> nAdditive >> nAccumulate >> nTransformType;
[ # # ][ # # ]
1701 : :
1702 : : // nBits %0001: additive, %0010: accumulate, %0100: attributeName, %1000: transformtype
1703 : : // nAdditive 0 = base, 1 = sum, 2 = replace, 3 = multiply, 4 = none
1704 : : // nAccumulate 0 = none, 1 = always
1705 : : // nTransformType 0: "property" else "image"
1706 : :
1707 [ # # ]: 0 : if( nBits & 3 )
1708 : : {
1709 [ # # ]: 0 : if( xAnimate.is() )
1710 : : {
1711 [ # # ]: 0 : if( nBits & 1 )
1712 : : {
1713 : 0 : sal_Int16 nTemp = AnimationAdditiveMode::BASE;
1714 [ # # # # : 0 : switch( nAdditive )
# ]
1715 : : {
1716 : 0 : case 1: nTemp = AnimationAdditiveMode::SUM; break;
1717 : 0 : case 2: nTemp = AnimationAdditiveMode::REPLACE; break;
1718 : 0 : case 3: nTemp = AnimationAdditiveMode::MULTIPLY; break;
1719 : 0 : case 4: nTemp = AnimationAdditiveMode::NONE; break;
1720 : : }
1721 [ # # ][ # # ]: 0 : xAnimate->setAdditive( nTemp );
1722 : : }
1723 : :
1724 [ # # ]: 0 : if( nBits & 2 )
1725 : : {
1726 [ # # ][ # # ]: 0 : xAnimate->setAccumulate( (nAccumulate == 0) ? sal_True : sal_False );
[ # # ]
1727 : : }
1728 : : }
1729 : : }
1730 : : #ifdef DBG_ANIM_LOG
1731 : : if( nBits & 1 )
1732 : : fprintf( mpFile, " additive=\"%s\"", (nAdditive == 0) ? "base" : (nAdditive == 2) ? "replace" : (nAdditive == 1) ? "sum" : (nAdditive == 3 ) ? "multiply" : (nAdditive == 4) ? "none" : "unknown" );
1733 : :
1734 : : if( nBits & 2 )
1735 : : fprintf( mpFile, " accumulate=\"%s\"", (nAccumulate == 0) ? "none" : "always" );
1736 : :
1737 : : if( nBits & 8 )
1738 : : fprintf( mpFile, " transformType=\"%s\"", (nTransformType == 0) ? "property" : "image" );
1739 : : #endif
1740 : : }
1741 : : }
1742 : 0 : break;
1743 : :
1744 : : case DFF_msofbtAnimateAttributeNames:
1745 : : {
1746 [ # # ]: 0 : if( xAnimate.is() )
1747 : : {
1748 : 0 : OUString aAttributeName;
1749 [ # # ]: 0 : importAttributeNamesContainer( pChildAtom, aAttributeName );
1750 [ # # ]: 0 : if( xAnimate.is() )
1751 [ # # ][ # # ]: 0 : xAnimate->setAttributeName( aAttributeName );
1752 : 0 : dump( " attributeName=\"%s\"", aAttributeName );
1753 : : }
1754 : : }
1755 : 0 : break;
1756 : :
1757 : : case DFF_msofbtAnimateTargetElement:
1758 : : {
1759 : : sal_Int16 nSubType;
1760 [ # # ]: 0 : importTargetElementContainer( pChildAtom, aTarget, nSubType );
1761 [ # # ]: 0 : if( xAnimate.is() )
1762 [ # # ][ # # ]: 0 : xAnimate->setSubItem( nSubType );
1763 : :
1764 : 0 : dump( " target=\"" );
1765 : 0 : dump_target( aTarget );
1766 : 0 : dump( "\"" );
1767 : : }
1768 : 0 : break;
1769 : :
1770 : : default:
1771 : 0 : dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
1772 : 0 : break;
1773 : : }
1774 : :
1775 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
1776 : : }
1777 : : }
1778 : :
1779 [ # # ]: 0 : if( bWrongContext )
1780 : 0 : aTarget.clear();
1781 : :
1782 [ # # ]: 0 : if( xAnimate.is() )
1783 [ # # ][ # # ]: 0 : xAnimate->setTarget( aTarget );
1784 : : else
1785 : : {
1786 [ # # ]: 0 : Reference< XCommand > xCommand( xNode, UNO_QUERY );
1787 [ # # ]: 0 : if( xCommand.is() )
1788 [ # # ][ # # ]: 0 : xCommand->setTarget( aTarget );
1789 : 0 : }
1790 : 0 : }
1791 : :
1792 : : // --------------------------------------------------------------------
1793 : :
1794 : 0 : sal_Int16 AnimationImporter::implGetColorSpace( sal_Int32 nMode, sal_Int32 /*nA*/, sal_Int32 /*nB*/, sal_Int32 /*nC*/ )
1795 : : {
1796 [ # # ]: 0 : switch( nMode )
1797 : : {
1798 : : case 2: // index
1799 : : // FALLTHROUGH intended
1800 : : default:
1801 : : // FALLTHROUGH intended
1802 : : case 0: // rgb
1803 : 0 : return AnimationColorSpace::RGB;
1804 : :
1805 : : case 1: // hsl
1806 : 0 : return AnimationColorSpace::HSL;
1807 : : }
1808 : : }
1809 : :
1810 : : // --------------------------------------------------------------------
1811 : :
1812 : 0 : Any AnimationImporter::implGetColorAny( sal_Int32 nMode, sal_Int32 nA, sal_Int32 nB, sal_Int32 nC )
1813 : : {
1814 [ # # # # ]: 0 : switch( nMode )
1815 : : {
1816 : : case 0: // rgb
1817 : : {
1818 : 0 : dump( "rgb(%ld", nA );
1819 : 0 : dump( ",%ld", nB );
1820 : 0 : dump( ",%ld)", nC );
1821 : 0 : Color aColor( (sal_uInt8)nA, (sal_uInt8)nB, (sal_uInt8)nC );
1822 [ # # ]: 0 : return makeAny( (sal_Int32)aColor.GetRGBColor() );
1823 : : }
1824 : : case 1: // hsl
1825 : : {
1826 : 0 : dump( "hsl(%ld", nA );
1827 : 0 : dump( ",%ld", nB );
1828 : 0 : dump( ",%ld)", nC );
1829 [ # # ]: 0 : Sequence< double > aHSL( 3 );
1830 [ # # ]: 0 : aHSL[0] = nA * 360.0/255.0;
1831 [ # # ]: 0 : aHSL[1] = nB / 255.0;
1832 [ # # ]: 0 : aHSL[2] = nC / 255.0;
1833 [ # # ][ # # ]: 0 : return makeAny( aHSL );
1834 : : }
1835 : :
1836 : : case 2: // index
1837 : : {
1838 : 0 : Color aColor;
1839 [ # # ]: 0 : mpPPTImport->GetColorFromPalette((sal_uInt16)nA, aColor );
1840 : 0 : dump( "index(%ld", nA );
1841 : 0 : dump( " [%ld", (sal_Int32)aColor.GetRed() );
1842 : 0 : dump( ",%ld", (sal_Int32)aColor.GetGreen() );
1843 : 0 : dump( ",%ld])", (sal_Int32)aColor.GetBlue() );
1844 [ # # ]: 0 : return makeAny( (sal_Int32)aColor.GetRGBColor() );
1845 : : }
1846 : :
1847 : : default:
1848 : : {
1849 : 0 : dump( "unknown_%ld(", nMode );
1850 : 0 : dump( "%ld", nA );
1851 : 0 : dump( ",%ld", nB );
1852 : 0 : dump( ",%ld)", nC );
1853 : : OSL_FAIL( "ppt::implGetColorAny(), unhandled color type" );
1854 : :
1855 : 0 : Any aAny;
1856 : 0 : return aAny;
1857 : : }
1858 : : }
1859 : : }
1860 : :
1861 : 0 : void AnimationImporter::importAnimateColorContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
1862 : : {
1863 [ # # ]: 0 : Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
1864 : :
1865 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateColor && xColor.is(), "invalid call to ppt::AnimationImporter::importAnimateColorContainer()!");
1866 [ # # ][ # # ]: 0 : if( pAtom && xColor.is() )
[ # # ]
1867 : : {
1868 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
1869 : :
1870 [ # # ]: 0 : while( pChildAtom )
1871 : : {
1872 [ # # ]: 0 : if( !pChildAtom->isContainer() )
1873 : : {
1874 [ # # ][ # # ]: 0 : if( !pChildAtom->seekToContent() )
1875 : 0 : break;
1876 : : }
1877 : :
1878 [ # # # ]: 0 : switch( pChildAtom->getType() )
1879 : : {
1880 : : case DFF_msofbtAnimateColorData:
1881 : : {
1882 : : sal_uInt32 nBits;
1883 : : sal_Int32 nByMode, nByA, nByB, nByC;
1884 : : sal_Int32 nFromMode, nFromA, nFromB, nFromC;
1885 : : sal_Int32 nToMode, nToA, nToB, nToC;
1886 [ # # ]: 0 : mrStCtrl >> nBits;
1887 [ # # ][ # # ]: 0 : mrStCtrl >> nByMode >> nByA >> nByB >> nByC;
[ # # ][ # # ]
1888 [ # # ][ # # ]: 0 : mrStCtrl >> nFromMode >> nFromA >> nFromB >> nFromC;
[ # # ][ # # ]
1889 [ # # ][ # # ]: 0 : mrStCtrl >> nToMode >> nToA >> nToB >> nToC;
[ # # ][ # # ]
1890 : :
1891 [ # # ]: 0 : if( nBits & 1 )
1892 : : {
1893 : 0 : dump( " by=\"" );
1894 [ # # ][ # # ]: 0 : xColor->setBy( implGetColorAny( nByMode, nByA, nByB, nByC ) );
[ # # ]
1895 [ # # ][ # # ]: 0 : xColor->setColorInterpolation( implGetColorSpace( nByMode, nByA, nByB, nByC ) );
1896 : 0 : dump( "\"");
1897 : : }
1898 : :
1899 [ # # ]: 0 : if( nBits & 2 )
1900 : : {
1901 : 0 : dump( " from=\"" );
1902 [ # # ][ # # ]: 0 : xColor->setFrom( implGetColorAny( nFromMode, nFromA, nFromB, nFromC ) );
[ # # ]
1903 [ # # ][ # # ]: 0 : xColor->setColorInterpolation( implGetColorSpace( nFromMode, nFromA, nFromB, nFromC ) );
1904 : 0 : dump( "\"");
1905 : : }
1906 : :
1907 [ # # ]: 0 : if( nBits & 4 )
1908 : : {
1909 : 0 : dump( " to=\"" );
1910 [ # # ][ # # ]: 0 : xColor->setTo( implGetColorAny( nToMode, nToA, nToB, nToC ) );
[ # # ]
1911 [ # # ][ # # ]: 0 : xColor->setColorInterpolation( implGetColorSpace( nToMode, nToA, nToB, nToC ) );
1912 : 0 : dump( "\"");
1913 : : }
1914 : : }
1915 : 0 : break;
1916 : :
1917 : : case DFF_msofbtAnimateTarget:
1918 [ # # ]: 0 : importAnimateAttributeTargetContainer( pChildAtom, xNode );
1919 : 0 : break;
1920 : :
1921 : : default:
1922 : 0 : dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
1923 : 0 : break;
1924 : : }
1925 : :
1926 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
1927 : : }
1928 : 0 : }
1929 : 0 : }
1930 : :
1931 : : // --------------------------------------------------------------------
1932 : :
1933 : 0 : void AnimationImporter::importAnimateSetContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
1934 : : {
1935 [ # # ]: 0 : Reference< XAnimateSet > xSet( xNode, UNO_QUERY );
1936 : :
1937 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateSet && xSet.is(), "invalid call to ppt::AnimationImporter::importAnimateSetContainer()!");
1938 [ # # ][ # # ]: 0 : if( pAtom && xSet.is() )
[ # # ]
1939 : : {
1940 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
1941 : :
1942 [ # # ]: 0 : while( pChildAtom )
1943 : : {
1944 [ # # ]: 0 : if( !pChildAtom->isContainer() )
1945 : : {
1946 [ # # ][ # # ]: 0 : if( !pChildAtom->seekToContent() )
1947 : 0 : break;
1948 : : }
1949 : :
1950 [ # # # # ]: 0 : switch( pChildAtom->getType() )
1951 : : {
1952 : : case DFF_msofbtAnimateSetData:
1953 : : {
1954 : : sal_Int32 nU1, nU2;
1955 [ # # ][ # # ]: 0 : mrStCtrl >> nU1 >> nU2;
1956 : :
1957 : 0 : dump( " set_1=\"%ld\"", nU1 ),
1958 : 0 : dump( " set_2=\"%ld\"", nU2 );
1959 : : }
1960 : 0 : break;
1961 : :
1962 : : case DFF_msofbtAnimAttributeValue:
1963 : : {
1964 : 0 : Any aTo;
1965 [ # # ][ # # ]: 0 : if ( importAttributeValue( pChildAtom, aTo ) )
1966 : : {
1967 [ # # ][ # # ]: 0 : xSet->setTo( aTo );
1968 : :
1969 : 0 : dump( " value=\"" );
1970 : 0 : dump( aTo );
1971 : 0 : dump( "\"" );
1972 : 0 : }
1973 : : }
1974 : 0 : break;
1975 : :
1976 : : case DFF_msofbtAnimateTarget:
1977 [ # # ]: 0 : importAnimateAttributeTargetContainer( pChildAtom, xNode );
1978 : 0 : break;
1979 : :
1980 : : default:
1981 : 0 : dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
1982 : 0 : break;
1983 : : }
1984 : :
1985 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
1986 : : }
1987 : 0 : }
1988 : 0 : }
1989 : :
1990 : : // --------------------------------------------------------------------
1991 : :
1992 : 0 : void AnimationImporter::importAnimateContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
1993 : : {
1994 [ # # ]: 0 : Reference< XAnimate > xAnim( xNode, UNO_QUERY );
1995 : :
1996 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimate && xAnim.is(), "invalid call to ppt::AnimationImporter::importAnimateContainer()!");
1997 [ # # ][ # # ]: 0 : if( pAtom && xAnim.is() )
[ # # ]
1998 : : {
1999 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
2000 : :
2001 [ # # ]: 0 : while( pChildAtom )
2002 : : {
2003 [ # # ]: 0 : if( !pChildAtom->isContainer() )
2004 : : {
2005 [ # # ][ # # ]: 0 : if( !pChildAtom->seekToContent() )
2006 : 0 : break;
2007 : : }
2008 : :
2009 [ # # # # : 0 : switch( pChildAtom->getType() )
# ]
2010 : : {
2011 : : case DFF_msofbtAnimateData:
2012 : : {
2013 : : sal_uInt32 nCalcmode, nBits, nValueType;
2014 [ # # ][ # # ]: 0 : mrStCtrl >> nCalcmode >> nBits >> nValueType;
[ # # ]
2015 : :
2016 [ # # ]: 0 : if( nBits & 0x08 )
2017 : : {
2018 [ # # ]: 0 : sal_Int16 n = (nCalcmode == 1) ? AnimationCalcMode::LINEAR : /* (nCalcmode == 2) ? AnimationCalcMode::FORMULA : */ AnimationCalcMode::DISCRETE;
2019 [ # # ][ # # ]: 0 : xAnim->setCalcMode( n );
2020 [ # # ][ # # ]: 0 : dump( " calcmode=\"%s\"", (nCalcmode == 0) ? "discrete" : (nCalcmode == 1) ? "linear" : (nCalcmode == 2) ? "formula" : "unknown" );
[ # # ]
2021 : : }
2022 : :
2023 [ # # ]: 0 : if( nBits & 0x30 )
2024 : : {
2025 [ # # ][ # # ]: 0 : sal_Int16 n = (nValueType == 1) ? AnimationValueType::NUMBER : (nValueType == 2 ) ? AnimationValueType::COLOR : AnimationValueType::STRING;
2026 [ # # ][ # # ]: 0 : xAnim->setValueType( n );
2027 [ # # ][ # # ]: 0 : dump( " valueType=\"%s\"", (nValueType == 0) ? "string" : (nValueType == 1) ? "number" : (nValueType == 2) ? "color" : "unknown" );
[ # # ]
2028 : : }
2029 : : }
2030 : 0 : break;
2031 : :
2032 : : case DFF_msofbtAnimateTarget:
2033 [ # # ]: 0 : importAnimateAttributeTargetContainer( pChildAtom, xNode );
2034 : 0 : break;
2035 : :
2036 : : case DFF_msofbtAnimKeyPoints:
2037 [ # # ]: 0 : importAnimateKeyPoints( pChildAtom, xNode );
2038 : 0 : break;
2039 : :
2040 : : case DFF_msofbtAnimAttributeValue:
2041 : : {
2042 : 0 : Any a;
2043 [ # # ][ # # ]: 0 : if ( importAttributeValue( pChildAtom, a ) )
2044 : : {
2045 [ # # # # ]: 0 : switch( pChildAtom->getInstance() )
2046 : : {
2047 [ # # ][ # # ]: 0 : case 1: xAnim->setBy( a ); dump( " by=\"" ); break;
2048 [ # # ][ # # ]: 0 : case 2: xAnim->setFrom( a ); dump( " from=\"" ); break;
2049 [ # # ][ # # ]: 0 : case 3: xAnim->setTo( a ); dump( " to=\"" ); break;
2050 : : default:
2051 : 0 : dump( " unknown_value=\"" );
2052 : : }
2053 : :
2054 : 0 : dump( a );
2055 : 0 : dump( "\"" );
2056 : 0 : }
2057 : : }
2058 : 0 : break;
2059 : : default:
2060 : 0 : dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
2061 : 0 : break;
2062 : : }
2063 : :
2064 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
2065 : : }
2066 : 0 : }
2067 : 0 : }
2068 : :
2069 : : // --------------------------------------------------------------------
2070 : :
2071 : 0 : void AnimationImporter::importAnimateMotionContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
2072 : : {
2073 [ # # ]: 0 : Reference< XAnimateMotion > xMotion( xNode, UNO_QUERY );
2074 : :
2075 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateMotion && xMotion.is(), "invalid call to ppt::AnimationImporter::importAnimateMotionContainer()!");
2076 [ # # ][ # # ]: 0 : if( pAtom && xMotion.is() )
[ # # ]
2077 : : {
2078 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
2079 : :
2080 [ # # ]: 0 : while( pChildAtom )
2081 : : {
2082 [ # # ]: 0 : if( !pChildAtom->isContainer() )
2083 : : {
2084 [ # # ][ # # ]: 0 : if( !pChildAtom->seekToContent() )
2085 : 0 : break;
2086 : : }
2087 : :
2088 [ # # # # ]: 0 : switch( pChildAtom->getType() )
2089 : : {
2090 : : case DFF_msofbtAnimateMotionData:
2091 : : {
2092 : : sal_uInt32 nBits, nOrigin;
2093 : : float fByX, fByY, fFromX, fFromY, fToX, fToY;
2094 : :
2095 [ # # ][ # # ]: 0 : mrStCtrl >> nBits >> fByX >> fByY >> fFromX >> fFromY >> fToX >> fToY >> nOrigin;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2096 : :
2097 : : #ifdef DBG_ANIM_LOG
2098 : : if( nBits & 1 )
2099 : : fprintf( mpFile, " by=\"%g,%g\"", (double)fByX, (double)fByY );
2100 : :
2101 : : if( nBits & 2 )
2102 : : fprintf( mpFile, " from=\"%g,%g\"", (double)fFromX, (double)fFromY );
2103 : :
2104 : : if( nBits & 4 )
2105 : : fprintf( mpFile, " to=\"%g,%g\"", (double)fToX, (double)fToY );
2106 : :
2107 : : if( nBits & 8 )
2108 : : fprintf( mpFile, " origin=\"%s\"", (nOrigin == 1) ? "parent" : (nOrigin == 2) ? "layout" : "unknown" );
2109 : :
2110 : : #endif
2111 : : }
2112 : 0 : break;
2113 : :
2114 : : case DFF_msofbtAnimAttributeValue:
2115 : : {
2116 : 0 : Any aPath;
2117 [ # # ][ # # ]: 0 : if ( importAttributeValue( pChildAtom, aPath ) )
2118 : : {
2119 : 0 : rtl::OUString aStr;
2120 [ # # ]: 0 : if ( aPath >>= aStr )
2121 : : {
2122 : 0 : aStr = aStr.replace( 'E', ' ' );
2123 : 0 : aStr = aStr.trim();
2124 [ # # ]: 0 : aPath <<= aStr;
2125 [ # # ][ # # ]: 0 : xMotion->setPath( aPath );
2126 : 0 : dump( " path=\"" );
2127 : 0 : dump( aPath );
2128 : 0 : dump( "\"" );
2129 : 0 : }
2130 : 0 : }
2131 : : }
2132 : 0 : break;
2133 : :
2134 : : case DFF_msofbtAnimateTarget:
2135 [ # # ]: 0 : importAnimateAttributeTargetContainer( pChildAtom, xNode );
2136 : 0 : break;
2137 : :
2138 : : default:
2139 : 0 : dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
2140 : 0 : break;
2141 : : }
2142 : :
2143 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
2144 : : }
2145 : 0 : }
2146 : 0 : }
2147 : :
2148 : : // --------------------------------------------------------------------
2149 : :
2150 : 0 : void AnimationImporter::importCommandContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
2151 : : {
2152 [ # # ]: 0 : Reference< XCommand > xCommand( xNode, UNO_QUERY );
2153 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimCommand && xCommand.is(), "invalid call to ppt::AnimationImporter::importCommandContainer()!");
2154 [ # # ][ # # ]: 0 : if( pAtom && xCommand.is() )
[ # # ]
2155 : : {
2156 : 0 : sal_Int32 nBits = 0, nType = 0;
2157 : 0 : Any aValue;
2158 : :
2159 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
2160 : :
2161 [ # # ]: 0 : while( pChildAtom )
2162 : : {
2163 [ # # ]: 0 : if( !pChildAtom->isContainer() )
2164 : : {
2165 [ # # ][ # # ]: 0 : if( !pChildAtom->seekToContent() )
2166 : 0 : break;
2167 : : }
2168 : :
2169 [ # # # # ]: 0 : switch( pChildAtom->getType() )
2170 : : {
2171 : : case DFF_msofbtCommandData:
2172 : : {
2173 : : sal_Int32 nCommandType;
2174 : : // looks like U1 is a bitset, bit 1 enables the type and bit 2 enables
2175 : : // a propertyvalue that follows
2176 [ # # ]: 0 : mrStCtrl >> nBits;
2177 [ # # ]: 0 : mrStCtrl >> nCommandType;
2178 : :
2179 [ # # ]: 0 : if( nBits & 1 )
2180 : : {
2181 [ # # ][ # # ]: 0 : dump( " type=\"%s\"", (nCommandType == 0) ? "event" : ( nCommandType == 1) ? "call" : "verb" );
2182 : : }
2183 : : }
2184 : 0 : break;
2185 : :
2186 : : case DFF_msofbtAnimAttributeValue:
2187 : : {
2188 [ # # ][ # # ]: 0 : if ( importAttributeValue( pChildAtom, aValue ) )
2189 : : {
2190 [ # # ]: 0 : if( nBits & 2 )
2191 : : {
2192 : 0 : dump( " cmd=\"" );
2193 : 0 : dump( aValue );
2194 : 0 : dump( "\"" );
2195 : : }
2196 : : }
2197 : : }
2198 : 0 : break;
2199 : :
2200 : : case DFF_msofbtAnimateTarget:
2201 [ # # ]: 0 : importAnimateAttributeTargetContainer( pChildAtom, xNode );
2202 : 0 : break;
2203 : :
2204 : : default:
2205 : 0 : dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
2206 : 0 : break;
2207 : : }
2208 : :
2209 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
2210 : : }
2211 : :
2212 [ # # ]: 0 : if( nBits & 3 )
2213 : : {
2214 : 0 : OUString aParam;
2215 : 0 : aValue >>= aParam;
2216 : :
2217 : 0 : sal_Int16 nCommand = EffectCommands::CUSTOM;
2218 : :
2219 : 0 : NamedValue aParamValue;
2220 : :
2221 [ # # # ]: 0 : switch( nType )
2222 : : {
2223 : : case 0: // event
2224 : : case 1: // call
2225 [ # # ]: 0 : if ( aParam == "onstopaudio" )
2226 : : {
2227 : 0 : nCommand = EffectCommands::STOPAUDIO;
2228 : : }
2229 [ # # ]: 0 : else if ( aParam == "play" )
2230 : : {
2231 : 0 : nCommand = EffectCommands::PLAY;
2232 : : }
2233 [ # # ]: 0 : else if( aParam.compareToAscii( RTL_CONSTASCII_STRINGPARAM("playFrom") ) == 0 )
2234 : : {
2235 : 0 : const OUString aMediaTime( aParam.copy( 9, aParam.getLength() - 10 ) );
2236 : : rtl_math_ConversionStatus eStatus;
2237 : 0 : double fMediaTime = ::rtl::math::stringToDouble( aMediaTime, (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
2238 [ # # ]: 0 : if( eStatus == rtl_math_ConversionStatus_Ok )
2239 : : {
2240 : 0 : aParamValue.Name = "MediaTime";
2241 [ # # ]: 0 : aParamValue.Value <<= fMediaTime;
2242 : : }
2243 : 0 : nCommand = EffectCommands::PLAY;
2244 : : }
2245 [ # # ]: 0 : else if ( aParam == "togglePause" )
2246 : : {
2247 : 0 : nCommand = EffectCommands::TOGGLEPAUSE;
2248 : : }
2249 [ # # ]: 0 : else if ( aParam == "stop" )
2250 : : {
2251 : 0 : nCommand = EffectCommands::STOP;
2252 : : }
2253 : 0 : break;
2254 : : case 2: // verb
2255 : : {
2256 : 0 : aParamValue.Name = "Verb";
2257 [ # # ]: 0 : aParamValue.Value <<= aParam.toInt32();
2258 : :
2259 : 0 : nCommand = EffectCommands::VERB;
2260 : : }
2261 : 0 : break;
2262 : : }
2263 : :
2264 [ # # ][ # # ]: 0 : xCommand->setCommand( nCommand );
2265 [ # # ]: 0 : if( nCommand == EffectCommands::CUSTOM )
2266 : : {
2267 : : OSL_FAIL("sd::AnimationImporter::importCommandContainer(), unknown command!");
2268 : 0 : aParamValue.Name = "UserDefined";
2269 [ # # ]: 0 : aParamValue.Value <<= aParam;
2270 : : }
2271 : :
2272 [ # # ]: 0 : if( aParamValue.Value.hasValue() )
2273 : : {
2274 [ # # ]: 0 : Sequence< NamedValue > aParamSeq( &aParamValue, 1 );
2275 [ # # ][ # # ]: 0 : xCommand->setParameter( makeAny( aParamSeq ) );
[ # # ][ # # ]
2276 : 0 : }
2277 : 0 : }
2278 : 0 : }
2279 : 0 : }
2280 : :
2281 : : // --------------------------------------------------------------------
2282 : :
2283 : 0 : void AnimationImporter::importAudioContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
2284 : : {
2285 [ # # ]: 0 : Reference< XAudio > xAudio( xNode, UNO_QUERY );
2286 : : DBG_ASSERT( pAtom && xAudio.is() &&
2287 : : ( (pAtom->getType() == DFF_msofbtAnimGroup) ||
2288 : : (pAtom->getType() == DFF_msofbtAnimSubGoup) ), "invalid call to ppt::AnimationImporter::importAudioContainer()!");
2289 [ # # ][ # # ]: 0 : if( pAtom && xAudio.is() )
[ # # ]
2290 : : {
2291 [ # # ]: 0 : importAnimationEvents( pAtom, xNode );
2292 [ # # ]: 0 : importAnimationValues( pAtom, xNode );
2293 [ # # ]: 0 : importAnimationActions( pAtom, xNode );
2294 : :
2295 : 0 : dump(">\n");
2296 : :
2297 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
2298 : :
2299 [ # # ]: 0 : while( pChildAtom )
2300 : : {
2301 [ # # ]: 0 : if( !pChildAtom->isContainer() )
2302 : : {
2303 [ # # ][ # # ]: 0 : if( !pChildAtom->seekToContent() )
2304 : 0 : break;
2305 : : }
2306 : :
2307 [ # # # # ]: 0 : switch( pChildAtom->getType() )
2308 : : {
2309 : : case DFF_msofbtAnimNode:
2310 : : case DFF_msofbtAnimEvent:
2311 : : case DFF_msofbtAnimValue:
2312 : : case DFF_msofbtAnimAction:
2313 : : case DFF_msofbtAnimPropertySet:
2314 : 0 : break;
2315 : :
2316 : : case DFF_msofbtAnimAttributeValue:
2317 : : {
2318 : 0 : Any aValue;
2319 [ # # ][ # # ]: 0 : if ( importAttributeValue( pChildAtom, aValue ) )
2320 : : {
2321 : 0 : dump( " value=\"" );
2322 : 0 : dump( aValue );
2323 : 0 : dump( "\"" );
2324 : 0 : }
2325 : : }
2326 : 0 : break;
2327 : :
2328 : : case DFF_msofbtAnimateTargetElement:
2329 : : {
2330 : : sal_Int16 nSubType;
2331 : 0 : Any aSource;
2332 [ # # ]: 0 : importTargetElementContainer( pChildAtom, aSource, nSubType );
2333 [ # # ]: 0 : if( xAudio.is() )
2334 [ # # ][ # # ]: 0 : xAudio->setSource( aSource );
2335 : : }
2336 : 0 : break;
2337 : :
2338 : : default:
2339 : 0 : dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
2340 : 0 : break;
2341 : : }
2342 : :
2343 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
2344 : : }
2345 : :
2346 : : // TODO: What to do with them?
2347 : 0 : Any aEmpty;
2348 [ # # ][ # # ]: 0 : xAudio->setBegin( aEmpty );
2349 [ # # ][ # # ]: 0 : xAudio->setEnd( aEmpty );
2350 : 0 : }
2351 : 0 : }
2352 : :
2353 : : // --------------------------------------------------------------------
2354 : :
2355 : 0 : void AnimationImporter::importAnimateScaleContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
2356 : : {
2357 [ # # ]: 0 : Reference< XAnimateTransform > xTransform( xNode, UNO_QUERY );
2358 : :
2359 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateScale && xTransform.is(), "invalid call to ppt::AnimationImporter::importAnimateScaleContainer()!");
2360 [ # # ][ # # ]: 0 : if( pAtom && xTransform.is() )
[ # # ]
2361 : : {
2362 [ # # ][ # # ]: 0 : xTransform->setTransformType( AnimationTransformType::SCALE );
2363 : :
2364 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
2365 : :
2366 [ # # ]: 0 : while( pChildAtom )
2367 : : {
2368 [ # # ]: 0 : if( !pChildAtom->isContainer() )
2369 : : {
2370 [ # # ][ # # ]: 0 : if( !pChildAtom->seekToContent() )
2371 : 0 : break;
2372 : : }
2373 : :
2374 [ # # # ]: 0 : switch( pChildAtom->getType() )
2375 : : {
2376 : : case DFF_msofbtAnimateScaleData:
2377 : : {
2378 : : sal_uInt32 nBits, nZoomContents;
2379 : : float fByX, fByY, fFromX, fFromY, fToX, fToY;
2380 : :
2381 : : // nBits %001: by, %010: from, %100: to, %1000: zoomContents(bool)
2382 [ # # ][ # # ]: 0 : mrStCtrl >> nBits >> fByX >> fByY >> fFromX >> fFromY >> fToX >> fToY >> nZoomContents;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2383 : :
2384 : 0 : ValuePair aPair;
2385 : : // 'from' value
2386 [ # # ]: 0 : if( nBits & 2 )
2387 : : {
2388 [ # # ]: 0 : aPair.First <<= (double)fFromX / 100.0;
2389 [ # # ]: 0 : aPair.Second <<= (double)fFromY / 100.0;
2390 [ # # ][ # # ]: 0 : xTransform->setFrom( makeAny( aPair ) );
[ # # ]
2391 : : }
2392 : :
2393 : : // 'to' value
2394 [ # # ]: 0 : if( nBits & 4 )
2395 : : {
2396 [ # # ]: 0 : aPair.First <<= (double)fToX / 100.0;
2397 [ # # ]: 0 : aPair.Second <<= (double)fToY / 100.0;
2398 [ # # ][ # # ]: 0 : xTransform->setTo( makeAny( aPair ) );
[ # # ]
2399 : : }
2400 : :
2401 : : // 'by' value
2402 [ # # ]: 0 : if( nBits & 1 )
2403 : : {
2404 [ # # ]: 0 : aPair.First <<= (double)fByX / 100.0;
2405 [ # # ]: 0 : aPair.Second <<= (double)fByY / 100.0;
2406 : :
2407 [ # # ]: 0 : if( nBits & 2 )
2408 : : {
2409 : : // 'from' value given, import normally
2410 [ # # ][ # # ]: 0 : xTransform->setBy( makeAny( aPair ) );
[ # # ]
2411 : : }
2412 : : else
2413 : : {
2414 : : // mapping 'by' to 'to', if no 'from' is
2415 : : // given. This is due to a non-conformity in
2416 : : // PPT, which exports animateScale effects
2417 : : // with a sole 'by' value, but with the
2418 : : // semantics of a sole 'to' animation
2419 [ # # ][ # # ]: 0 : xTransform->setTo( makeAny( aPair ) );
[ # # ]
2420 : : }
2421 : 0 : }
2422 : :
2423 : :
2424 : : #ifdef DBG_ANIM_LOG
2425 : : if( nBits & 1 )
2426 : : fprintf( mpFile, " by=\"%g,%g\"", (double)fByX, (double)fByY );
2427 : :
2428 : : if( nBits & 2 )
2429 : : fprintf( mpFile, " from=\"%g,%g\"", (double)fFromX, (double)fFromY );
2430 : :
2431 : : if( nBits & 4 )
2432 : : fprintf( mpFile, " to=\"%g,%g\"", (double)fToX, (double)fToY );
2433 : :
2434 : : if( nBits & 8 )
2435 : : fprintf( mpFile, " zoomContents=\"%s\"", nZoomContents ? "true" : "false" );
2436 : : #endif
2437 : : }
2438 : 0 : break;
2439 : :
2440 : : case DFF_msofbtAnimateTarget:
2441 [ # # ]: 0 : importAnimateAttributeTargetContainer( pChildAtom, xNode );
2442 : 0 : break;
2443 : :
2444 : : default:
2445 : 0 : dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
2446 : 0 : break;
2447 : : }
2448 : :
2449 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
2450 : : }
2451 : 0 : }
2452 : 0 : }
2453 : :
2454 : : // --------------------------------------------------------------------
2455 : :
2456 : 0 : void AnimationImporter::importAnimateRotationContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
2457 : : {
2458 [ # # ]: 0 : Reference< XAnimateTransform > xTransform( xNode, UNO_QUERY );
2459 : :
2460 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateRotation && xTransform.is(), "invalid call to ppt::AnimationImporter::importAnimateRotationContainer()!");
2461 [ # # ][ # # ]: 0 : if( pAtom && xTransform.is() )
[ # # ]
2462 : : {
2463 [ # # ][ # # ]: 0 : xTransform->setTransformType( AnimationTransformType::ROTATE );
2464 : :
2465 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
2466 : :
2467 [ # # ]: 0 : while( pChildAtom )
2468 : : {
2469 [ # # ]: 0 : if( !pChildAtom->isContainer() )
2470 : : {
2471 [ # # ][ # # ]: 0 : if( !pChildAtom->seekToContent() )
2472 : 0 : break;
2473 : : }
2474 : :
2475 [ # # # ]: 0 : switch( pChildAtom->getType() )
2476 : : {
2477 : : case DFF_msofbtAnimateRotationData:
2478 : : {
2479 : : sal_uInt32 nBits, nU1;
2480 : : float fBy, fFrom, fTo;
2481 : :
2482 : : // nBits %001: by, %010: from, %100: to, %1000: zoomContents(bool)
2483 [ # # ][ # # ]: 0 : mrStCtrl >> nBits >> fBy >> fFrom >> fTo >> nU1;
[ # # ][ # # ]
[ # # ]
2484 : :
2485 [ # # ]: 0 : if( nBits & 1 )
2486 [ # # ][ # # ]: 0 : xTransform->setBy( makeAny( (double) fBy ) );
[ # # ]
2487 : :
2488 [ # # ]: 0 : if( nBits & 2 )
2489 [ # # ][ # # ]: 0 : xTransform->setFrom( makeAny( (double) fFrom ) );
[ # # ]
2490 : :
2491 [ # # ]: 0 : if( nBits & 4 )
2492 [ # # ][ # # ]: 0 : xTransform->setTo( makeAny( (double) fTo ) );
[ # # ]
2493 : :
2494 : : #ifdef DBG_ANIM_LOG
2495 : : if( nBits & 1 )
2496 : : fprintf( mpFile, " by=\"%g\"", (double)fBy );
2497 : :
2498 : : if( nBits & 2 )
2499 : : fprintf( mpFile, " from=\"%g\"", (double)fFrom );
2500 : :
2501 : : if( nBits & 4 )
2502 : : fprintf( mpFile, " to=\"%g\"", (double)fTo );
2503 : :
2504 : : if( nU1 )
2505 : : fprintf( mpFile, " rotation_1=\"%ld\"", nU1 );
2506 : : #endif
2507 : : }
2508 : 0 : break;
2509 : :
2510 : : case DFF_msofbtAnimateTarget:
2511 [ # # ]: 0 : importAnimateAttributeTargetContainer( pChildAtom, xNode );
2512 : 0 : break;
2513 : :
2514 : : default:
2515 : 0 : dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
2516 : 0 : break;
2517 : : }
2518 : :
2519 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
2520 : : }
2521 : 0 : }
2522 : 0 : }
2523 : : // --------------------------------------------------------------------
2524 : :
2525 : 0 : bool AnimationImporter::importAttributeNamesContainer( const Atom* pAtom, OUString& rAttributeNames )
2526 : : {
2527 : 0 : OUStringBuffer aNames;
2528 : :
2529 : : DBG_ASSERT( pAtom && (pAtom->getType() == DFF_msofbtAnimateAttributeNames), "invalid call to ppt::AnimationImporter::importAttributeName()!" );
2530 [ # # ]: 0 : if( pAtom )
2531 : : {
2532 [ # # ]: 0 : const Atom* pAttributeValueAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimAttributeValue );
2533 : :
2534 [ # # ]: 0 : while( pAttributeValueAtom )
2535 : : {
2536 : 0 : Any aAny;
2537 [ # # ][ # # ]: 0 : if ( importAttributeValue( pAttributeValueAtom, aAny ) )
2538 : : {
2539 : 0 : OUString aName;
2540 [ # # ]: 0 : if( aAny >>= aName )
2541 : : {
2542 [ # # ]: 0 : if( aNames.getLength() )
2543 [ # # ]: 0 : aNames.append( (sal_Unicode)';' );
2544 : :
2545 [ # # ]: 0 : aNames.append( aName );
2546 : 0 : }
2547 : : }
2548 : : else
2549 : : {
2550 : : OSL_FAIL( "error during ppt::AnimationImporter::importAttributeName()!" );
2551 : : }
2552 : :
2553 [ # # ]: 0 : pAttributeValueAtom = pAtom->findNextChildAtom( DFF_msofbtAnimAttributeValue, pAttributeValueAtom );
2554 : 0 : }
2555 : : }
2556 : :
2557 [ # # ]: 0 : rAttributeNames = aNames.makeStringAndClear();
2558 : 0 : return true;
2559 : : }
2560 : :
2561 : : // --------------------------------------------------------------------
2562 : :
2563 : 0 : void AnimationImporter::importAnimationValues( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
2564 : : {
2565 : : DBG_ASSERT( pAtom, "invalid call to ppt::AnimationImporter::importAnimationValues()!" );
2566 : :
2567 [ # # ]: 0 : if( pAtom )
2568 : : {
2569 : 0 : const Atom* pValueAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimValue );
2570 : :
2571 [ # # ][ # # ]: 0 : while( pValueAtom && pValueAtom->seekToContent() )
[ # # ]
2572 : : {
2573 : : sal_uInt32 nType;
2574 [ # # ]: 0 : mrStCtrl >> nType;
2575 [ # # # # : 0 : switch( nType )
# ]
2576 : : {
2577 : : case 0:
2578 : : {
2579 : : float fRepeat;
2580 [ # # ]: 0 : mrStCtrl >> fRepeat;
2581 [ # # ][ # # ]: 0 : xNode->setRepeatCount( (fRepeat < ((float)3.40282346638528860e+38)) ? makeAny( (double)fRepeat ) : makeAny( Timing_INDEFINITE ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
[ # # # # ]
2582 : :
2583 : : #ifdef DBG_ANIM_LOG
2584 : : if( (fRepeat < ((float)3.40282346638528860e+38)) )
2585 : : {
2586 : : dump( " repeat=\"%g\"", (double)fRepeat );
2587 : : }
2588 : : else
2589 : : {
2590 : : dump( " repeat=\"indefinite\"" );
2591 : : }
2592 : : #endif
2593 : : }
2594 : 0 : break;
2595 : :
2596 : : case 3:
2597 : : {
2598 : : float faccelerate;
2599 [ # # ]: 0 : mrStCtrl >> faccelerate;
2600 [ # # ][ # # ]: 0 : xNode->setAcceleration( faccelerate );
2601 : 0 : dump( " accelerate=\"%g\"", (double)faccelerate );
2602 : : }
2603 : 0 : break;
2604 : :
2605 : : case 4:
2606 : : {
2607 : : float fdecelerate;
2608 [ # # ]: 0 : mrStCtrl >> fdecelerate;
2609 [ # # ][ # # ]: 0 : xNode->setDecelerate( fdecelerate );
2610 : 0 : dump( " decelerate=\"%g\"", (double)fdecelerate );
2611 : : }
2612 : 0 : break;
2613 : :
2614 : : case 5:
2615 : : {
2616 : : sal_Int32 nAutoreverse;
2617 [ # # ]: 0 : mrStCtrl >> nAutoreverse;
2618 [ # # ][ # # ]: 0 : xNode->setAutoReverse( nAutoreverse != 0 );
2619 : 0 : dump( " autoreverse=\"%#lx\"", nAutoreverse );
2620 : : }
2621 : 0 : break;
2622 : :
2623 : : default:
2624 : : {
2625 : : sal_uInt32 nUnknown;
2626 [ # # ]: 0 : mrStCtrl >> nUnknown;
2627 : : #ifdef DBG_ANIM_LOG
2628 : : fprintf(mpFile, " attribute_%d=\"%#lx\"", nType, nUnknown );
2629 : : #endif
2630 : : }
2631 : 0 : break;
2632 : : }
2633 : :
2634 [ # # ]: 0 : pValueAtom = pAtom->findNextChildAtom( DFF_msofbtAnimValue, pValueAtom );
2635 : : }
2636 : : }
2637 : 0 : }
2638 : :
2639 : : // --------------------------------------------------------------------
2640 : :
2641 : 0 : void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
2642 : : {
2643 [ # # ]: 0 : Reference< XAnimate > xAnim( xNode, UNO_QUERY );
2644 : :
2645 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimKeyPoints && xAnim.is(), "invalid call to ppt::AnimationImporter::importAnimateKeyPoints()!" );
2646 : :
2647 [ # # ][ # # ]: 0 : if( pAtom && xAnim.is() )
[ # # ]
2648 : : {
2649 : : // first count keytimes
2650 : 0 : const Atom* pIter = NULL;
2651 : 0 : int nKeyTimes = 0;
2652 : :
2653 [ # # ][ # # ]: 0 : while( (pIter = pAtom->findNextChildAtom( DFF_msofbtAnimKeyTime, pIter )) != 0 )
2654 : 0 : nKeyTimes++;
2655 : :
2656 [ # # ]: 0 : Sequence< double > aKeyTimes( nKeyTimes );
2657 [ # # ]: 0 : Sequence< Any > aValues( nKeyTimes );
2658 : 0 : OUString aFormula;
2659 : :
2660 [ # # ]: 0 : pIter = pAtom->findFirstChildAtom(DFF_msofbtAnimKeyTime);
2661 : : int nKeyTime;
2662 : : sal_Int32 nTemp;
2663 [ # # ][ # # ]: 0 : for( nKeyTime = 0; (nKeyTime < nKeyTimes) && pIter; nKeyTime++ )
[ # # ]
2664 : : {
2665 [ # # ][ # # ]: 0 : if( pIter->seekToContent() )
2666 : : {
2667 [ # # ]: 0 : mrStCtrl >> nTemp;
2668 : 0 : double fTemp = (double)nTemp / 1000.0;
2669 [ # # ]: 0 : aKeyTimes[nKeyTime] = fTemp;
2670 : :
2671 : 0 : const Atom* pValue = pAtom->findNextChildAtom(pIter);
2672 [ # # ][ # # ]: 0 : if( pValue && pValue->getType() == DFF_msofbtAnimAttributeValue )
[ # # ]
2673 : : {
2674 : 0 : Any aValue1, aValue2;
2675 [ # # ][ # # ]: 0 : if( importAttributeValue( pValue, aValue1 ) )
2676 : : {
2677 : 0 : pValue = pAtom->findNextChildAtom(pValue);
2678 [ # # ][ # # ]: 0 : if( pValue && pValue->getType() == DFF_msofbtAnimAttributeValue )
[ # # ]
2679 [ # # ]: 0 : importAttributeValue( pValue, aValue2 );
2680 : :
2681 : 0 : bool bCouldBeFormula = false;
2682 : 0 : bool bHasValue = aValue2.hasValue();
2683 [ # # ]: 0 : if( bHasValue )
2684 : : {
2685 [ # # ][ # # ]: 0 : if( aValue2.getValueType() == ::getCppuType((const OUString*)0) )
2686 : : {
2687 : 0 : OUString aTest;
2688 : 0 : aValue2 >>= aTest;
2689 : 0 : bHasValue = !aTest.isEmpty();
2690 : 0 : bCouldBeFormula = true;
2691 : : }
2692 : : }
2693 : :
2694 [ # # ][ # # ]: 0 : if( bHasValue && bCouldBeFormula && (aValue1.getValueType() == ::getCppuType((const double*)0)) )
[ # # ][ # # ]
[ # # ]
2695 : : {
2696 : 0 : aValue2 >>= aFormula;
2697 : 0 : bHasValue = false;
2698 : : }
2699 : :
2700 [ # # ]: 0 : if( bHasValue )
2701 : : {
2702 [ # # ][ # # ]: 0 : aValues[nKeyTime] = makeAny( ValuePair( aValue1, aValue2 ) );
2703 : : }
2704 : : else
2705 : : {
2706 [ # # ]: 0 : aValues[nKeyTime] = aValue1;
2707 : : }
2708 : 0 : }
2709 : : }
2710 : : }
2711 [ # # ]: 0 : pIter = pAtom->findNextChildAtom(DFF_msofbtAnimKeyTime, pIter);
2712 : : }
2713 : :
2714 : : #ifdef DBG_ANIM_LOG
2715 : : dump( " keyTimes=\"" );
2716 : : for( int i=0; i<nKeyTimes; ++i )
2717 : : dump( "%f;", aKeyTimes[i] );
2718 : :
2719 : : if( !aFormula.isEmpty() )
2720 : : {
2721 : : dump( "formula=\"%s", aFormula );
2722 : : }
2723 : :
2724 : : dump( "\" values=\"" );
2725 : : double nVal;
2726 : : OUString aStr;
2727 : : for( int i=0; i<nKeyTimes; ++i )
2728 : : {
2729 : : if( i != 0 )
2730 : : dump( ";" );
2731 : :
2732 : : if( aValues[i] >>= aStr )
2733 : : dump( "%s",
2734 : : ::rtl::OUStringToOString( aStr,
2735 : : RTL_TEXTENCODING_ASCII_US ).getStr() );
2736 : : else if( aValues[i] >>= nVal )
2737 : : dump( "%f", nVal );
2738 : : else
2739 : : {
2740 : : ValuePair aValuePair;
2741 : :
2742 : : if( aValues[i] >>= aValuePair )
2743 : : {
2744 : : if( aValuePair.First >>= aStr )
2745 : : dump( "%s",
2746 : : ::rtl::OUStringToOString( aStr,
2747 : : RTL_TEXTENCODING_ASCII_US ).getStr() );
2748 : : else if( aValuePair.First >>= nVal )
2749 : : dump( "%f", nVal );
2750 : : else
2751 : : dump( "%X", (sal_Int32)&aValuePair.First );
2752 : :
2753 : : if( aValuePair.Second >>= aStr )
2754 : : dump( ",%s",
2755 : : ::rtl::OUStringToOString( aStr,
2756 : : RTL_TEXTENCODING_ASCII_US ).getStr() );
2757 : : else if( aValuePair.Second >>= nVal )
2758 : : dump( ",%f", nVal );
2759 : : else
2760 : : dump( ",%X", (sal_Int32)&aValuePair.Second );
2761 : : }
2762 : : }
2763 : : }
2764 : : dump( "\"" );
2765 : : #endif
2766 : :
2767 [ # # ][ # # ]: 0 : xAnim->setKeyTimes( aKeyTimes );
2768 [ # # ][ # # ]: 0 : xAnim->setValues( aValues );
2769 [ # # ][ # # ]: 0 : xAnim->setFormula( aFormula );
[ # # ][ # # ]
2770 : 0 : }
2771 : 0 : }
2772 : :
2773 : : // --------------------------------------------------------------------
2774 : :
2775 : 0 : bool AnimationImporter::importAttributeValue( const Atom* pAtom, Any& rAny )
2776 : : {
2777 : : DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimAttributeValue, "invalid call to ppt::AnimationImporter::importAttributeValue()!" );
2778 : :
2779 : 0 : bool bOk = false;
2780 : :
2781 [ # # ][ # # ]: 0 : if( pAtom && pAtom->seekToContent() )
[ # # ]
2782 : : {
2783 : 0 : sal_uInt32 nRecLen = pAtom->getLength();
2784 [ # # ]: 0 : if ( nRecLen >= 1 )
2785 : : {
2786 : : sal_Int8 nType;
2787 [ # # ]: 0 : mrStCtrl >> nType;
2788 [ # # # # : 0 : switch( nType )
# ]
2789 : : {
2790 : : case DFF_ANIM_PROP_TYPE_BYTE :
2791 : : {
2792 [ # # ]: 0 : if ( nRecLen == 2 )
2793 : : {
2794 : : sal_uInt8 nByte;
2795 [ # # ]: 0 : mrStCtrl >> nByte;
2796 [ # # ]: 0 : rAny <<= nByte;
2797 : :
2798 : 0 : bOk = true;
2799 : : }
2800 : : }
2801 : 0 : break;
2802 : :
2803 : : case DFF_ANIM_PROP_TYPE_INT32 :
2804 : : {
2805 [ # # ]: 0 : if ( nRecLen == 5 )
2806 : : {
2807 : : sal_uInt32 nInt32;
2808 [ # # ]: 0 : mrStCtrl >> nInt32;
2809 [ # # ]: 0 : rAny <<= nInt32;
2810 : :
2811 : 0 : bOk = true;
2812 : : }
2813 : : }
2814 : 0 : break;
2815 : :
2816 : : case DFF_ANIM_PROP_TYPE_FLOAT:
2817 : : {
2818 [ # # ]: 0 : if( nRecLen == 5 )
2819 : : {
2820 : : float fFloat;
2821 [ # # ]: 0 : mrStCtrl >> fFloat;
2822 [ # # ]: 0 : rAny <<= (double)fFloat;
2823 : :
2824 : 0 : bOk = true;
2825 : : }
2826 : : }
2827 : 0 : break;
2828 : :
2829 : : case DFF_ANIM_PROP_TYPE_UNISTRING :
2830 : : {
2831 [ # # ][ # # ]: 0 : if ( ( nRecLen & 1 ) && ( nRecLen > 1 ) )
2832 : : {
2833 [ # # ]: 0 : rtl::OUString aOUString = mpPPTImport->MSDFFReadZString( mrStCtrl, nRecLen - 1, sal_True );
2834 [ # # ]: 0 : rAny <<= aOUString;
2835 : :
2836 : 0 : bOk = true;
2837 : : }
2838 : : }
2839 : 0 : break;
2840 : : }
2841 : : }
2842 : : }
2843 : :
2844 : : DBG_ASSERT( bOk, "invalid value inside ppt::AnimationImporter::importAttributeValue()!" );
2845 : 0 : return bOk;
2846 : : }
2847 : :
2848 : : // --------------------------------------------------------------------
2849 : :
2850 : 0 : void AnimationImporter::importAnimationEvents( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
2851 : : {
2852 : : DBG_ASSERT( xNode.is() && pAtom, "invalid call to ppt::AnimationImporter::importAnimationEvents()!" );
2853 : :
2854 : 0 : Any aBegin, aEnd, aNext, aPrev;
2855 : :
2856 [ # # ]: 0 : const Atom* pEventAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimEvent );
2857 [ # # ]: 0 : while( pEventAtom )
2858 : : {
2859 : 0 : Any* pEvents = NULL;
2860 : :
2861 [ # # # # : 0 : switch( pEventAtom->getInstance() )
# ]
2862 : : {
2863 : 0 : case 1: pEvents = &aBegin; break;
2864 : 0 : case 2: pEvents = &aEnd; break;
2865 : 0 : case 3: pEvents = &aNext; break;
2866 : 0 : case 4: pEvents = &aPrev; break;
2867 : : }
2868 : :
2869 [ # # ]: 0 : if( pEvents )
2870 : : {
2871 : 0 : Event aEvent;
2872 : 0 : aEvent.Trigger = EventTrigger::NONE;
2873 : 0 : aEvent.Repeat = 0;
2874 : :
2875 : 0 : const Atom* pChildAtom = pEventAtom->findFirstChildAtom();
2876 : :
2877 [ # # ][ # # ]: 0 : while( pChildAtom && pChildAtom->seekToContent() )
[ # # ][ # # ]
2878 : : {
2879 [ # # # ]: 0 : switch( pChildAtom->getType() )
2880 : : {
2881 : : case DFF_msofbtAnimTrigger:
2882 : : {
2883 : : sal_Int32 nU1, nTrigger, nU3, nBegin;
2884 [ # # ]: 0 : mrStCtrl >> nU1;
2885 [ # # ]: 0 : mrStCtrl >> nTrigger;
2886 [ # # ]: 0 : mrStCtrl >> nU3;
2887 [ # # ]: 0 : mrStCtrl >> nBegin;
2888 : :
2889 [ # # # # : 0 : switch( nTrigger )
# # # # #
# # # # ]
2890 : : {
2891 : 0 : case 0: aEvent.Trigger = EventTrigger::NONE; break;
2892 : 0 : case 1: aEvent.Trigger = EventTrigger::ON_BEGIN; break;
2893 : 0 : case 2: aEvent.Trigger = EventTrigger::ON_END; break;
2894 : 0 : case 3: aEvent.Trigger = EventTrigger::BEGIN_EVENT; break;
2895 : 0 : case 4: aEvent.Trigger = EventTrigger::END_EVENT; break;
2896 : 0 : case 5: aEvent.Trigger = EventTrigger::ON_CLICK; break;
2897 : 0 : case 6: aEvent.Trigger = EventTrigger::ON_DBL_CLICK; break;
2898 : 0 : case 7: aEvent.Trigger = EventTrigger::ON_MOUSE_ENTER; break;
2899 : 0 : case 8: aEvent.Trigger = EventTrigger::ON_MOUSE_LEAVE; break;
2900 : 0 : case 9: aEvent.Trigger = EventTrigger::ON_NEXT; break;
2901 : 0 : case 10: aEvent.Trigger = EventTrigger::ON_PREV; break;
2902 : 0 : case 11: aEvent.Trigger = EventTrigger::ON_STOP_AUDIO; break;
2903 : : }
2904 : :
2905 [ # # ][ # # ]: 0 : if( (nBegin != 0) || (aEvent.Trigger == EventTrigger::NONE) )
2906 [ # # ][ # # ]: 0 : aEvent.Offset = (nBegin == -1) ? makeAny( Timing_INDEFINITE ) : makeAny( (double)(nBegin / 1000.0) );
[ # # ][ # # ]
[ # # ]
[ # # # # ]
2907 : : }
2908 : 0 : break;
2909 : : case DFF_msofbtAnimateTargetElement:
2910 : : {
2911 : : sal_Int16 nSubType;
2912 [ # # ]: 0 : importTargetElementContainer( pChildAtom, aEvent.Source, nSubType );
2913 : : }
2914 : 0 : break;
2915 : : default:
2916 : : {
2917 : : OSL_FAIL("unknown atom inside ppt::AnimationImporter::importAnimationEvents()!");
2918 : : }
2919 : : }
2920 : :
2921 : 0 : pChildAtom = pEventAtom->findNextChildAtom( pChildAtom );
2922 : : }
2923 : :
2924 [ # # ][ # # ]: 0 : *pEvents = addToSequence( *pEvents, (aEvent.Trigger == EventTrigger::NONE) ? aEvent.Offset : makeAny( aEvent ) );
[ # # ]
2925 : : }
2926 : :
2927 [ # # ]: 0 : pEventAtom = pAtom->findNextChildAtom( DFF_msofbtAnimEvent, pEventAtom );
2928 : : }
2929 : :
2930 [ # # ][ # # ]: 0 : xNode->setBegin( aBegin );
2931 [ # # ][ # # ]: 0 : xNode->setEnd( aEnd );
2932 : : // TODO: xNode->setNext( aNext );
2933 : : // TODO: xNode->setPrev( aNext );
2934 : :
2935 : : #ifdef DBG_ANIM_LOG
2936 : : if( aBegin.hasValue() )
2937 : : {
2938 : : dump( " begin=\"" );
2939 : : dump( aBegin );
2940 : : dump( "\"" );
2941 : : }
2942 : :
2943 : : if( aEnd.hasValue() )
2944 : : {
2945 : : dump( " end=\"" );
2946 : : dump( aEnd );
2947 : : dump( "\"" );
2948 : : }
2949 : :
2950 : : if( aNext.hasValue() )
2951 : : {
2952 : : dump( " next=\"" );
2953 : : dump( aNext );
2954 : : dump( "\"" );
2955 : : }
2956 : :
2957 : : if( aPrev.hasValue() )
2958 : : {
2959 : : dump( " prev=\"" );
2960 : : dump( aPrev );
2961 : : dump( "\"" );
2962 : : }
2963 : : #endif
2964 : 0 : }
2965 : :
2966 : : // --------------------------------------------------------------------
2967 : :
2968 : 0 : void AnimationImporter::importAnimationActions( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
2969 : : {
2970 : : DBG_ASSERT( pAtom && xNode.is(), "invalid call to ppt::AnimationImporter::importAnimationActions()!");
2971 : :
2972 [ # # ]: 0 : if( pAtom )
2973 : : {
2974 : 0 : const Atom* pActionAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimAction );
2975 : :
2976 [ # # ][ # # ]: 0 : if( pActionAtom && pActionAtom->seekToContent() )
[ # # ]
2977 : : {
2978 : : sal_Int32 nConcurrent, nNextAction, nEndSync, nU4, nU5;
2979 [ # # ]: 0 : mrStCtrl >> nConcurrent;
2980 [ # # ]: 0 : mrStCtrl >> nNextAction;
2981 [ # # ]: 0 : mrStCtrl >> nEndSync;
2982 [ # # ]: 0 : mrStCtrl >> nU4;
2983 [ # # ]: 0 : mrStCtrl >> nU5;
2984 : :
2985 [ # # ]: 0 : if( nEndSync == 1 )
2986 [ # # ][ # # ]: 0 : xNode->setEndSync( makeAny( AnimationEndSync::ALL ) );
[ # # ]
2987 : :
2988 : : #ifdef DBG_ANIM_LOG
2989 : : dump( " concurrent=\"%s\"", nConcurrent == 0 ? "disabled" : (nConcurrent == 1 ? "enabled" : "unknown") );
2990 : :
2991 : : dump( " nextAction=\"%s\"", nNextAction == 0 ? "none" : (nNextAction == 1 ? "seek" : "unknown") );
2992 : :
2993 : : if( nEndSync != 0 )
2994 : : {
2995 : : dump( " endSync=\"%s\"", nEndSync == 1 ? "all" : "unknown" );
2996 : : }
2997 : :
2998 : : dump( " action_4=\"%#lx\"", nU4 );
2999 : : dump( " action_5=\"%#lx\"", nU5 );
3000 : : #endif
3001 : : }
3002 : : }
3003 : 0 : }
3004 : :
3005 : : // --------------------------------------------------------------------
3006 : :
3007 : 0 : sal_Int32 AnimationImporter::importTargetElementContainer( const Atom* pAtom, Any& rTarget, sal_Int16& rSubType )
3008 : : {
3009 : 0 : rSubType = ShapeAnimationSubType::AS_WHOLE;
3010 : 0 : sal_Int32 nRefMode = -1;
3011 : :
3012 : : DBG_ASSERT( pAtom && (pAtom->getType() == DFF_msofbtAnimateTargetElement), "invalid call to ppt::AnimationImporter::importTargetElementContainer()!" );
3013 [ # # ]: 0 : if( pAtom )
3014 : : {
3015 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
3016 [ # # ][ # # ]: 0 : while( pChildAtom && pChildAtom->seekToContent() )
[ # # ][ # # ]
3017 : : {
3018 [ # # # ]: 0 : switch( pChildAtom->getType() )
3019 : : {
3020 : : case DFF_msofbtAnimReference:
3021 : : {
3022 : : sal_Int32 nRefType,nRefId;
3023 : : sal_Int32 begin,end;
3024 [ # # ]: 0 : mrStCtrl >> nRefMode;
3025 [ # # ]: 0 : mrStCtrl >> nRefType;
3026 [ # # ]: 0 : mrStCtrl >> nRefId;
3027 [ # # ]: 0 : mrStCtrl >> begin;
3028 [ # # ]: 0 : mrStCtrl >> end;
3029 : :
3030 [ # # # # ]: 0 : switch( nRefType )
3031 : : {
3032 : : case 1: // shape
3033 : : {
3034 [ # # ]: 0 : SdrObject* pSdrObject = mpPPTImport->getShapeForId( nRefId );
3035 [ # # ]: 0 : if( pSdrObject == NULL )
3036 : 0 : break;
3037 : :
3038 [ # # ][ # # ]: 0 : rTarget <<= pSdrObject->getUnoShape();
3039 : :
3040 [ # # # # ]: 0 : switch( nRefMode )
3041 : : {
3042 : 0 : case 6: rSubType = ShapeAnimationSubType::ONLY_BACKGROUND; break;
3043 : 0 : case 8: rSubType = ShapeAnimationSubType::ONLY_TEXT; break;
3044 : : case 2: // one paragraph
3045 : : {
3046 [ # # ][ # # ]: 0 : if( ((begin == -1) && (end == -1)) || !pSdrObject->ISA( SdrTextObj ) )
[ # # ][ # # ]
[ # # ][ # # ]
3047 : 0 : break;
3048 : :
3049 : 0 : SdrTextObj* pTextObj = static_cast< SdrTextObj* >( pSdrObject );
3050 : :
3051 [ # # ]: 0 : const OutlinerParaObject* pOPO = pTextObj->GetOutlinerParaObject();
3052 [ # # ]: 0 : if( pOPO == NULL )
3053 : 0 : break;
3054 : :
3055 [ # # ]: 0 : const EditTextObject& rEditTextObject = pOPO->GetTextObject();
3056 : :
3057 [ # # ]: 0 : const sal_uInt16 nParaCount = rEditTextObject.GetParagraphCount();
3058 : :
3059 : 0 : sal_uInt16 nPara = 0;
3060 : :
3061 [ # # ][ # # ]: 0 : while( (nPara < nParaCount) && (begin > 0) )
[ # # ]
3062 : : {
3063 [ # # ][ # # ]: 0 : sal_Int32 nParaLength = rEditTextObject.GetText( nPara ).Len() + 1;
3064 : 0 : begin -= nParaLength;
3065 : 0 : end -= nParaLength;
3066 : 0 : nPara++;
3067 : : }
3068 : :
3069 [ # # ]: 0 : if( nPara < nParaCount )
3070 : : {
3071 [ # # ]: 0 : ParagraphTarget aParaTarget;
3072 [ # # ]: 0 : rTarget >>= aParaTarget.Shape;
3073 : 0 : aParaTarget.Paragraph = nPara;
3074 [ # # ]: 0 : rTarget = makeAny( aParaTarget );
3075 : :
3076 : 0 : rSubType = ShapeAnimationSubType::ONLY_TEXT;
3077 : 0 : dump( " paragraph %d,", (sal_Int32)nPara);
3078 [ # # ]: 0 : dump( " %d characters", (sal_Int32)end );
3079 : : }
3080 : : }
3081 : : }
3082 : : }
3083 : 0 : break;
3084 : :
3085 : : case 2: // sound
3086 : : {
3087 [ # # ][ # # ]: 0 : OUString aSoundURL( ((ImplSdPPTImport*)mpPPTImport)->ReadSound( nRefId ) );
[ # # ]
3088 [ # # ]: 0 : rTarget <<= aSoundURL;
3089 : 0 : dump( " srcRef=\"%s\"", aSoundURL );
3090 : : }
3091 : 0 : break;
3092 : : case 3: // audio object
3093 : : case 4: // video object
3094 : : {
3095 [ # # ]: 0 : SdrObject* pSdrObject = mpPPTImport->getShapeForId( nRefId );
3096 [ # # ]: 0 : if( pSdrObject == NULL )
3097 : 0 : break;
3098 : :
3099 [ # # ][ # # ]: 0 : rTarget <<= pSdrObject->getUnoShape();
3100 : : }
3101 : 0 : break;
3102 : : default:
3103 : : OSL_FAIL("unknown reference type");
3104 : : }
3105 : :
3106 : : }
3107 : 0 : break;
3108 : : case 0x2b01:
3109 : : {
3110 : : sal_Int32 nU1;
3111 [ # # ]: 0 : mrStCtrl >> nU1;
3112 : : }
3113 : 0 : break;
3114 : : default:
3115 : : OSL_FAIL("unknown atom inside ppt::AnimationImporter::importTargetElementContainer()!");
3116 : 0 : break;
3117 : : }
3118 : :
3119 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
3120 : :
3121 : : }
3122 : : }
3123 : :
3124 : 0 : return nRefMode;
3125 : : }
3126 : :
3127 : : // --------------------------------------------------------------------
3128 : :
3129 : 0 : void AnimationImporter::importPropertySetContainer( const Atom* pAtom, PropertySet& rSet )
3130 : : {
3131 : : DBG_ASSERT( pAtom && (pAtom->getType() == DFF_msofbtAnimPropertySet), "invalid call to ppt::AnimationImporter::importPropertySetContainer()!" );
3132 : :
3133 [ # # ]: 0 : if( pAtom )
3134 : : {
3135 : 0 : const Atom* pChildAtom = pAtom->findFirstChildAtom();
3136 [ # # ]: 0 : while( pChildAtom )
3137 : : {
3138 [ # # ]: 0 : if( pChildAtom->getType() == DFF_msofbtAnimAttributeValue )
3139 : : {
3140 : 0 : Any aAny;
3141 [ # # ]: 0 : importAttributeValue( pChildAtom, aAny );
3142 [ # # ]: 0 : rSet.maProperties[ pChildAtom->getInstance() ] = aAny;
3143 : : }
3144 : : else
3145 : : {
3146 : : OSL_FAIL("unknown atom inside ppt::AnimationImporter::importPropertySetContainer()!");
3147 : : }
3148 : :
3149 : 0 : pChildAtom = pAtom->findNextChildAtom( pChildAtom );
3150 : : }
3151 : : }
3152 : 0 : }
3153 : :
3154 : : // ====================================================================
3155 : :
3156 : : #ifdef DBG_ANIM_LOG
3157 : : void AnimationImporter::dump_atom_header( const Atom* pAtom, bool bOpen, bool bAppend )
3158 : : {
3159 : : if( pAtom )
3160 : : {
3161 : : const char* pTitle;
3162 : :
3163 : : switch( pAtom->getType() )
3164 : : {
3165 : : case DFF_msofbtAnimEvent: pTitle = "AnimEvent"; break;
3166 : : case DFF_msofbtAnimTrigger: pTitle = "AnimTrigger"; break;
3167 : : case DFF_msofbtAnimateMotion: pTitle = "AnimateMotion"; break;
3168 : : case DFF_msofbtAnimPropertySet: pTitle = "AnimPropertySet"; break;
3169 : : case DFF_msofbtAnimateAttributeNames: pTitle = "AnimAttributeName"; break;
3170 : : case DFF_msofbtAnimAttributeValue: pTitle = "AnimAttributeValue"; break;
3171 : : case DFF_msofbtAnimGroup: pTitle = "AnimGroup"; break;
3172 : : case DFF_msofbtAnimNode: pTitle = "AnimNode"; break;
3173 : : case DFF_msofbtAnimValue: pTitle = "AnimValue"; break;
3174 : : case DFF_msofbtAnimateFilter: pTitle = "animateFilter"; break;
3175 : : case DFF_msofbtAnimate: pTitle = "animate"; break;
3176 : : case DFF_msofbtAnimateSet: pTitle = "set"; break;
3177 : : case DFF_msofbtAnimKeyTime: pTitle = "AnimKeyTime"; break;
3178 : : case DFF_msofbtAnimKeyPoints: pTitle = "AnimKeyPoints"; break;
3179 : : case DFF_msofbtAnimReference: pTitle = "AnimReference"; break;
3180 : : case DFF_msofbtAnimateTargetElement: pTitle = "AnimTargetElementContainer"; break;
3181 : : case DFF_msofbtAnimAction: pTitle = "AnimAction"; break;
3182 : : case DFF_msofbtAnimCommand: pTitle = "AnimCommand"; break;
3183 : : case DFF_msofbtAnimateTarget: pTitle = "TransformationTarget"; break;
3184 : : case DFF_msofbtAnimateTargetSettings: pTitle = "TransformationTargetSettings"; break;
3185 : : case DFF_msofbtAnimIteration: pTitle = "iterate"; break;
3186 : : case DFF_msofbtAnimateColorData: pTitle = "colorData"; break;
3187 : : case DFF_msofbtAnimateScaleData: pTitle = "scaleData"; break;
3188 : : case DFF_msofbtAnimateSetData: pTitle = "setData"; break;
3189 : :
3190 : : default:
3191 : : {
3192 : : static char buffer[128];
3193 : : sprintf( buffer, "unknown_%#x", pAtom->getType() );
3194 : : pTitle = buffer;
3195 : : }
3196 : : }
3197 : :
3198 : : if( bOpen )
3199 : : {
3200 : : fprintf(mpFile, "<%s", pTitle );
3201 : :
3202 : : fprintf(mpFile, " instance=\"%hu\"%s",
3203 : : pAtom->getInstance(),
3204 : : bAppend ? "" : ">\n");
3205 : : }
3206 : : else
3207 : : {
3208 : : if( bAppend )
3209 : : fprintf(mpFile,"/>\n");
3210 : : else
3211 : : fprintf(mpFile, "</%s>\n", pTitle );
3212 : : }
3213 : : }
3214 : : }
3215 : :
3216 : : // --------------------------------------------------------------------
3217 : :
3218 : : void AnimationImporter::dump( sal_uInt32 nLen, bool bNewLine )
3219 : : {
3220 : : char * faul = "0123456789abcdef";
3221 : :
3222 : : sal_uInt32 i = 0;
3223 : : int b = 0;
3224 : : sal_Int8 nData;
3225 : :
3226 : : for( i = 0; i < nLen; i++ )
3227 : : {
3228 : : mrStCtrl >> nData;
3229 : :
3230 : : fprintf( mpFile, "%c%c ", faul[ (nData >> 4) & 0x0f ], faul[ nData & 0x0f ] );
3231 : :
3232 : : b++;
3233 : : if( bNewLine && (b == 32) )
3234 : : {
3235 : : fprintf(mpFile,"\n");
3236 : : b = 0;
3237 : : }
3238 : : }
3239 : : if( (b != 0) && bNewLine )
3240 : : fprintf(mpFile,"\n");
3241 : : }
3242 : :
3243 : : // --------------------------------------------------------------------
3244 : :
3245 : : void AnimationImporter::dump_atom( const Atom* pAtom, bool bNewLine )
3246 : : {
3247 : : if( pAtom )
3248 : : {
3249 : : if( pAtom->isContainer() )
3250 : : {
3251 : : const Atom* pChildAtom = pAtom->findFirstChildAtom();
3252 : : while( pChildAtom )
3253 : : {
3254 : : if( pChildAtom->getType() == DFF_msofbtAnimAttributeValue )
3255 : : {
3256 : : fprintf(mpFile, "<attributeValue instance=\"%hu\"", pChildAtom->getInstance() );
3257 : :
3258 : : Any aValue;
3259 : : if( importAttributeValue( pChildAtom, aValue ) )
3260 : : {
3261 : : sal_Int32 nInt;
3262 : : rtl::OUString aString;
3263 : : double fDouble;
3264 : :
3265 : : if( aValue >>= nInt )
3266 : : {
3267 : : fprintf(mpFile, " value=\"%ld\"", nInt );
3268 : : }
3269 : : else if( aValue >>= aString )
3270 : : {
3271 : : fprintf(mpFile, " value=\"%s\"",
3272 : : rtl::OUStringToOString(aString,
3273 : : RTL_TEXTENCODING_UTF8).getStr());
3274 : : }
3275 : : else if( aValue >>= fDouble )
3276 : : {
3277 : : fprintf(mpFile, " value=\"%g\"", fDouble );
3278 : : }
3279 : : }
3280 : : else
3281 : : {
3282 : : if( pChildAtom->seekToContent() )
3283 : : {
3284 : : fprintf(mpFile, " value=\"" );
3285 : : dump_atom( pChildAtom, false );
3286 : : fprintf(mpFile, "\"");
3287 : : }
3288 : : }
3289 : :
3290 : : fprintf(mpFile, "/>\n" );
3291 : : }
3292 : : else
3293 : : {
3294 : : dump_atom_header( pChildAtom, true, pChildAtom->getType() == DFF_msofbtAnimAttributeValue );
3295 : : dump_atom( pChildAtom );
3296 : : dump_atom_header( pChildAtom, false, pChildAtom->getType() == DFF_msofbtAnimAttributeValue );
3297 : : }
3298 : :
3299 : : pChildAtom = pAtom->findNextChildAtom(pChildAtom);
3300 : : }
3301 : : }
3302 : : else if( pAtom->seekToContent() )
3303 : : {
3304 : : dump( pAtom->getLength(), bNewLine );
3305 : : }
3306 : : }
3307 : : }
3308 : :
3309 : : // --------------------------------------------------------------------
3310 : :
3311 : : void AnimationImporter::dump_anim_group( const Atom* pAtom, const AnimationNode& rNode, const PropertySet& rSet, bool bOpen )
3312 : : {
3313 : : fprintf( mpFile, bOpen ? "<" : "</" );
3314 : :
3315 : : switch( rNode.mnGroupType )
3316 : : {
3317 : : case mso_Anim_GroupType_PAR:
3318 : : fprintf( mpFile, "par" );
3319 : : break;
3320 : : case mso_Anim_GroupType_SEQ:
3321 : : fprintf( mpFile, "seq" );
3322 : : break;
3323 : : case mso_Anim_GroupType_NODE:
3324 : : switch( rNode.mnNodeType )
3325 : : {
3326 : : case mso_Anim_Behaviour_FILTER:
3327 : : fprintf( mpFile, "animateFilter" );
3328 : : break;
3329 : : case mso_Anim_Behaviour_ANIMATION:
3330 : : if( pAtom->hasChildAtom( DFF_msofbtAnimateSet ) )
3331 : : fprintf( mpFile, "set" );
3332 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimateColor ) )
3333 : : fprintf( mpFile, "animateColor" );
3334 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimateScale ) )
3335 : : fprintf( mpFile, "animateScale" );
3336 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimateRotation ) )
3337 : : fprintf( mpFile, "animateRotation" );
3338 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimateMotion ) )
3339 : : fprintf( mpFile, "animateMotion" );
3340 : : else if( pAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
3341 : : fprintf( mpFile, "command" );
3342 : : else
3343 : : fprintf( mpFile, "animation" );
3344 : : break;
3345 : : default:
3346 : : {
3347 : : fprintf( mpFile, "unknown_node_%#lx", rNode.mnNodeType );
3348 : : }
3349 : : break;
3350 : : }
3351 : : break;
3352 : : case mso_Anim_GroupType_MEDIA:
3353 : : fprintf( mpFile, "media" );
3354 : : break;
3355 : : default:
3356 : : fprintf( mpFile, "unknown_group_%#lx", rNode.mnGroupType );
3357 : : break;
3358 : : }
3359 : :
3360 : : if( bOpen )
3361 : : {
3362 : : dump( rNode );
3363 : : dump( rSet );
3364 : : }
3365 : :
3366 : : fprintf(mpFile,">\n");
3367 : : }
3368 : :
3369 : : void AnimationImporter::dump( const AnimationNode& rNode )
3370 : : {
3371 : : // dump animation node
3372 : : if( rNode.mnRestart != 0 )
3373 : : {
3374 : : fprintf(mpFile," restart=\"%s\"",
3375 : : rNode.mnRestart == 1 ? "always" : (rNode.mnRestart == 2 ? "whenOff" : (rNode.mnRestart == 3 ? "never" : "unknown")) );
3376 : : }
3377 : :
3378 : : if( rNode.mnFill )
3379 : : {
3380 : : fprintf(mpFile," fill=\"%s\"",
3381 : : rNode.mnFill == 1 ? "remove" : (rNode.mnFill == 3 ? "hold" : (rNode.mnFill == 2 ? "freeze" : "unknown")) );
3382 : : }
3383 : :
3384 : : if( rNode.mnDuration > 0 )
3385 : : {
3386 : : double fSeconds = rNode.mnDuration;
3387 : : fSeconds /= 1000.0;
3388 : : fprintf(mpFile, " dur=\"%g\"", fSeconds);
3389 : : }
3390 : : else if( rNode.mnDuration < 0 )
3391 : : {
3392 : : fprintf(mpFile, " dur=\"indefinite\"" );
3393 : : }
3394 : :
3395 : : if( rNode.mnU1 ) fprintf(mpFile," u1=\"%#lx\"", rNode.mnU1);
3396 : : if( rNode.mnU3 ) fprintf(mpFile," u3=\"%#lx\"", rNode.mnU3);
3397 : : if( rNode.mnU4 ) fprintf(mpFile," u4=\"%#lx\"", rNode.mnU4);
3398 : : }
3399 : :
3400 : : void AnimationImporter::dump( Any& rAny )
3401 : : {
3402 : : Sequence< Any > aSeq;
3403 : : sal_Int32 nInt;
3404 : : double fDouble;
3405 : : OUString aString;
3406 : : sal_Bool bBool;
3407 : : Event aEvent;
3408 : : Timing aTiming;
3409 : :
3410 : : if( rAny >>= aSeq )
3411 : : {
3412 : : const sal_Int32 nSize = aSeq.getLength();
3413 : : sal_Int32 nIndex = 0;
3414 : : while( nIndex < nSize )
3415 : : {
3416 : : dump( aSeq[nIndex++] );
3417 : : if(nIndex < nSize)
3418 : : fprintf( mpFile, "," );
3419 : : }
3420 : : }
3421 : : else if( rAny >>= aString )
3422 : : {
3423 : : fprintf( mpFile, "%s", rtl::OUStringToOString(aString,
3424 : : RTL_TEXTENCODING_UTF8).getStr() );
3425 : : }
3426 : : else if( rAny >>= nInt )
3427 : : {
3428 : : fprintf( mpFile, "%ld", nInt );
3429 : : }
3430 : : else if( rAny >>= bBool )
3431 : : {
3432 : : fprintf( mpFile, "%s", bBool ? "true" : "false" );
3433 : : }
3434 : : else if( rAny >>= fDouble )
3435 : : {
3436 : : fprintf( mpFile, "%g", fDouble );
3437 : : }
3438 : : else if( rAny >>= aTiming )
3439 : : {
3440 : : fprintf( mpFile, "%s", aTiming == (Timing_INDEFINITE) ? "indefinite" : "media" );
3441 : : }
3442 : : else if( rAny >>= aEvent )
3443 : : {
3444 : : static const char* triggers[] =
3445 : : {
3446 : : "none","onbegin","onend","begin",
3447 : : "end","onclick","ondoubleclick","onmouseenter",
3448 : : "onmouseleave","onpptnext","onpptprev","onstopaudio"
3449 : : };
3450 : :
3451 : : if( aEvent.Trigger != EventTrigger::NONE )
3452 : : {
3453 : : if( aEvent.Source.hasValue() )
3454 : : {
3455 : : dump_target( aEvent.Source );
3456 : : dump( "." );
3457 : : }
3458 : :
3459 : : dump( triggers[ aEvent.Trigger ] );
3460 : : }
3461 : :
3462 : : if( aEvent.Offset.hasValue() )
3463 : : {
3464 : : double fOffset;
3465 : : if( aEvent.Offset >>= fOffset )
3466 : : fprintf( mpFile, "%g", fOffset );
3467 : : else
3468 : : dump( "indefinite" );
3469 : : }
3470 : : }
3471 : : }
3472 : :
3473 : : void AnimationImporter::dump( const PropertySet& rSet )
3474 : : {
3475 : : // dump property set
3476 : :
3477 : : map< sal_Int32, Any >::const_iterator aIter( rSet.maProperties.begin() );
3478 : : const map< sal_Int32, Any >::const_iterator aEnd( rSet.maProperties.end() );
3479 : : while( aIter != aEnd )
3480 : : {
3481 : : bool bKnown = false;
3482 : :
3483 : : const sal_Int32 nInstance = (*aIter).first;
3484 : : Any aAny( (*aIter).second );
3485 : :
3486 : : switch ( nInstance )
3487 : : {
3488 : : case DFF_ANIM_COLORSPACE:
3489 : : {
3490 : : sal_Int32 nColorSpace;
3491 : : if( aAny >>= nColorSpace )
3492 : : {
3493 : : fprintf( mpFile, " colorSpace=\"%s\"", (nColorSpace == 0) ? "rgb" : (nColorSpace == 1) ? "hsl" : "unknown" );
3494 : : bKnown = true;
3495 : : }
3496 : : }
3497 : : break;
3498 : :
3499 : : case DFF_ANIM_DIRECTION:
3500 : : {
3501 : : sal_Bool bDirection;
3502 : : if( aAny >>= bDirection )
3503 : : {
3504 : : fprintf( mpFile, " direction=\"%s\"", bDirection ? "cclockwise" : "clockwise" );
3505 : : bKnown = true;
3506 : : }
3507 : : else
3508 : : {
3509 : : sal_Int32 nMasterRel;
3510 : : if( aAny >>= nMasterRel )
3511 : : {
3512 : : fprintf( mpFile, " direction=\"%s\"", nMasterRel == 0 ? "sameClick" : ( nMasterRel == 2 ? "nextClick" : "lastClick" ) );
3513 : : bKnown = true;
3514 : : }
3515 : : }
3516 : : }
3517 : : break;
3518 : :
3519 : : case DFF_ANIM_OVERRIDE: // TODO
3520 : : {
3521 : : sal_Int32 nOverride;
3522 : : if( aAny >>= nOverride )
3523 : : {
3524 : : fprintf( mpFile, " override=\"%s\"", (nOverride == 1) ? "childStyle" : (nOverride == 0) ? "normal" : "unknown" );
3525 : : bKnown = true;
3526 : : }
3527 : : }
3528 : : break;
3529 : :
3530 : : case DFF_ANIM_PATH_EDIT_MODE:
3531 : : {
3532 : : sal_Bool bPathEditMode;
3533 : : if( aAny >>= bPathEditMode )
3534 : : {
3535 : : fprintf( mpFile, " pptPathEditMode=\"%s\"", bPathEditMode ? "relative" : "fixed" );
3536 : : bKnown = true;
3537 : : }
3538 : : }
3539 : : break;
3540 : :
3541 : : case DFF_ANIM_PRESET_ID :
3542 : : {
3543 : : sal_Int32 nPresetId ;
3544 : : if( aAny >>= nPresetId )
3545 : : {
3546 : : fprintf(mpFile, " presetid=\"%ld\"", nPresetId );
3547 : : bKnown = true;
3548 : : }
3549 : : }
3550 : : break;
3551 : :
3552 : : case DFF_ANIM_PRESET_SUB_TYPE :
3553 : : {
3554 : : sal_Int32 nPointsType ;
3555 : : if( aAny >>= nPointsType )
3556 : : {
3557 : : fprintf(mpFile, " presetSubType=\"%ld\"", nPointsType );
3558 : : bKnown = true;
3559 : : }
3560 : : }
3561 : : break;
3562 : :
3563 : : case DFF_ANIM_PRESET_CLASS :
3564 : : {
3565 : : sal_Int32 nPresetClass;
3566 : : if ( aAny >>= nPresetClass )
3567 : : {
3568 : : const char* pMode;
3569 : : switch( nPresetClass )
3570 : : {
3571 : : case DFF_ANIM_PRESS_CLASS_USER_DEFINED: pMode = "userdefined"; break;
3572 : : case DFF_ANIM_PRESS_CLASS_ENTRANCE: pMode = "entrance"; break;
3573 : : case DFF_ANIM_PRESS_CLASS_EXIT: pMode = "exit"; break;
3574 : : case DFF_ANIM_PRESS_CLASS_EMPHASIS: pMode = "emphasis"; break;
3575 : : case DFF_ANIM_PRESS_CLASS_MOTIONPATH: pMode = "motionpath"; break;
3576 : : case DFF_ANIM_PRESS_CLASS_OLE_ACTION: pMode = "oleaction"; break;
3577 : : case DFF_ANIM_PRESS_CLASS_MEDIACALL: pMode = "mediacall"; break;
3578 : : default:
3579 : : {
3580 : : static char buffer[128];
3581 : : sprintf( buffer, "%ld", nPresetClass );
3582 : : pMode = buffer;
3583 : : }
3584 : : break;
3585 : : }
3586 : :
3587 : : fprintf(mpFile, " class=\"%s\"", pMode);
3588 : : bKnown = true;
3589 : : }
3590 : : }
3591 : : break;
3592 : :
3593 : : case DFF_ANIM_NODE_TYPE :
3594 : : {
3595 : : sal_Int32 nNodeType;
3596 : : if ( aAny >>= nNodeType )
3597 : : {
3598 : : const char* pNode;
3599 : : switch( nNodeType )
3600 : : {
3601 : : case DFF_ANIM_NODE_TYPE_ON_CLICK: pNode = "onclick"; break;
3602 : : case DFF_ANIM_NODE_TYPE_WITH_PREVIOUS: pNode = "withprevious"; break;
3603 : : case DFF_ANIM_NODE_TYPE_AFTER_PREVIOUS: pNode = "afterprevious"; break;
3604 : : case DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE: pNode = "mainsequence"; break;
3605 : : case DFF_ANIM_NODE_TYPE_TIMING_ROOT: pNode = "timingroot"; break;
3606 : : case DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ:pNode = "interactivesequence"; break;
3607 : : default :
3608 : : {
3609 : : static char buffer[128];
3610 : : sprintf( buffer, "%ld", nNodeType );
3611 : : pNode = buffer;
3612 : : }
3613 : : break;
3614 : : }
3615 : :
3616 : : fprintf(mpFile, " nodeType=\"%s\"", pNode);
3617 : : bKnown = true;
3618 : : }
3619 : : }
3620 : : break;
3621 : :
3622 : : case DFF_ANIM_GROUP_ID:
3623 : : {
3624 : : sal_Int32 nGroupId;
3625 : : if ( aAny >>= nGroupId )
3626 : : {
3627 : : fprintf( mpFile, " groupId=\"%ld\"", nGroupId );
3628 : : bKnown = true;
3629 : : }
3630 : : }
3631 : : break;
3632 : :
3633 : : case DFF_ANIM_ID:
3634 : : {
3635 : : rtl::OUString aString;
3636 : : if( aAny >>= aString )
3637 : : {
3638 : : fprintf( mpFile, " id=\"%s\"",
3639 : : rtl::OUStringToOString(aString,
3640 : : RTL_TEXTENCODING_UTF8).getStr() );
3641 : : bKnown = true;
3642 : : }
3643 : : }
3644 : : break;
3645 : :
3646 : : case DFF_ANIM_EVENT_FILTER:
3647 : : {
3648 : : rtl::OUString aString;
3649 : : if( aAny >>= aString )
3650 : : {
3651 : : fprintf( mpFile, " eventFilter=\"%s\"",
3652 : : rtl::OUStringToOString(aString,
3653 : : RTL_TEXTENCODING_UTF8).getStr() );
3654 : : bKnown = true;
3655 : : }
3656 : : }
3657 : : break;
3658 : :
3659 : : case DFF_ANIM_ENDAFTERSLIDE:
3660 : : {
3661 : : sal_Int32 nEndAfterSlide;
3662 : : if( aAny >>= nEndAfterSlide )
3663 : : {
3664 : : fprintf(mpFile, " endAfterSlide=\"%ld\"", nEndAfterSlide );
3665 : : bKnown = true;
3666 : : }
3667 : : }
3668 : :
3669 : : case DFF_ANIM_TIMEFILTER:
3670 : : {
3671 : : rtl::OUString aString;
3672 : : if( aAny >>= aString )
3673 : : {
3674 : : fprintf( mpFile, " timeFilter=\"%s\"",
3675 : : rtl::OUStringToOString(aString,
3676 : : RTL_TEXTENCODING_UTF8).getStr() );
3677 : : bKnown = true;
3678 : : }
3679 : : }
3680 : : break;
3681 : :
3682 : : case DFF_ANIM_RUNTIMECONTEXT:
3683 : : {
3684 : : rtl::OUString aString;
3685 : : if( aAny >>= aString )
3686 : : {
3687 : : fprintf( mpFile, " runtimeContext=\"%s\"",
3688 : : rtl::OUStringToOString(aString,
3689 : : RTL_TEXTENCODING_UTF8).getStr() );
3690 : : bKnown = true;
3691 : : }
3692 : : }
3693 : : break;
3694 : :
3695 : : case DFF_ANIM_VOLUME:
3696 : : {
3697 : : double fVolume(0.0);
3698 : : if( aAny >>= fVolume )
3699 : : {
3700 : : fprintf( mpFile, " volume=\"%g%%\"", (double)(fVolume * 100.0) );
3701 : : bKnown = true;
3702 : : }
3703 : : }
3704 : : break;
3705 : :
3706 : : case DFF_ANIM_AFTEREFFECT:
3707 : : {
3708 : : sal_Bool bAfterEffect;
3709 : : if( aAny >>= bAfterEffect )
3710 : : {
3711 : : fprintf( mpFile, "afterEffect=\"%s\"", bAfterEffect ? "true" : "false" );
3712 : : bKnown = true;
3713 : : }
3714 : : }
3715 : : break;
3716 : :
3717 : : }
3718 : :
3719 : :
3720 : : if( !bKnown )
3721 : : {
3722 : : fprintf( mpFile, " unknown_%lu=\"", nInstance );
3723 : : dump( aAny );
3724 : : fprintf( mpFile, "\"" );
3725 : : }
3726 : :
3727 : : ++aIter;
3728 : : }
3729 : : }
3730 : :
3731 : : void AnimationImporter::dump_target( Any& rAny )
3732 : : {
3733 : : Any aSource, aSourceData;
3734 : : Sequence< Any > aSeq;
3735 : : if( rAny >>= aSeq )
3736 : : {
3737 : : if( aSeq.getLength() >= 1 ) aSource = aSeq[0];
3738 : : if( aSeq.getLength() >= 2 ) aSourceData = aSeq[1];
3739 : : }
3740 : : else
3741 : : {
3742 : : aSource = rAny;
3743 : : }
3744 : :
3745 : : Reference< XShape > xShape;
3746 : : aSource >>= xShape;
3747 : : if( xShape.is() )
3748 : : {
3749 : : OUString aStr( xShape->getShapeType() );
3750 : : dump( aStr );
3751 : :
3752 : : if( aSourceData.hasValue() )
3753 : : {
3754 : : dump( "(" );
3755 : : dump( aSourceData );
3756 : : dump( ")" );
3757 : : }
3758 : : }
3759 : : }
3760 : :
3761 : : void AnimationImporter::dump( const char * pText )
3762 : : {
3763 : : fprintf( mpFile, "%s", pText );
3764 : : }
3765 : :
3766 : : void AnimationImporter::dump( const rtl::OUString& rString )
3767 : : {
3768 : : fprintf( mpFile, rtl::OUStringToOString(rString,
3769 : : RTL_TEXTENCODING_UTF8).getStr() );
3770 : : }
3771 : :
3772 : : void AnimationImporter::dump( const char * pText, sal_Int32 nInt )
3773 : : {
3774 : : fprintf( mpFile, pText, nInt );
3775 : : }
3776 : :
3777 : : void AnimationImporter::dump( const char * pText, double fDouble )
3778 : : {
3779 : : fprintf( mpFile, pText, fDouble );
3780 : : }
3781 : :
3782 : : void AnimationImporter::dump( const char * pText, const char * pText2 )
3783 : : {
3784 : : fprintf( mpFile, pText, pText2 );
3785 : : }
3786 : :
3787 : : void AnimationImporter::dump( const char * pText, const OUString& rString )
3788 : : {
3789 : : fprintf( mpFile, pText, rtl::OUStringToOString(rString,
3790 : : RTL_TEXTENCODING_UTF8).getStr() );
3791 : : }
3792 : :
3793 : : #else
3794 : :
3795 : 0 : void AnimationImporter::dump_atom_header( const Atom* , bool , bool )
3796 : : {
3797 : 0 : }
3798 : :
3799 : 0 : void AnimationImporter::dump_atom( const Atom* , bool )
3800 : : {
3801 : 0 : }
3802 : :
3803 : 0 : void AnimationImporter::dump_target( ::com::sun::star::uno::Any& )
3804 : : {
3805 : 0 : }
3806 : :
3807 : 0 : void AnimationImporter::dump( ::com::sun::star::uno::Any& )
3808 : : {
3809 : 0 : }
3810 : :
3811 : 0 : void AnimationImporter::dump( const PropertySet& )
3812 : : {
3813 : 0 : }
3814 : :
3815 : 0 : void AnimationImporter::dump( const AnimationNode& )
3816 : : {
3817 : 0 : }
3818 : :
3819 : 12 : void AnimationImporter::dump( const char * )
3820 : : {
3821 : 12 : }
3822 : :
3823 : 0 : void AnimationImporter::dump( const char * , sal_Int32 )
3824 : : {
3825 : 0 : }
3826 : :
3827 : 0 : void AnimationImporter::dump( const char * , double )
3828 : : {
3829 : 0 : }
3830 : :
3831 : 0 : void AnimationImporter::dump( const char * , const char * )
3832 : : {
3833 : 0 : }
3834 : :
3835 : 0 : void AnimationImporter::dump( const char * , const rtl::OUString& )
3836 : : {
3837 : 0 : }
3838 : :
3839 : : #endif
3840 : :
3841 : : } // namespace ppt;
3842 : :
3843 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|