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/util/XCloneable.hpp>
43 : : #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
44 : : #include <com/sun/star/animations/XAnimateSet.hpp>
45 : : #include <com/sun/star/animations/XAudio.hpp>
46 : : #include <com/sun/star/animations/XTransitionFilter.hpp>
47 : : #include <com/sun/star/animations/XAnimateColor.hpp>
48 : : #include <com/sun/star/animations/XAnimateMotion.hpp>
49 : : #include <com/sun/star/animations/XAnimateTransform.hpp>
50 : : #include <com/sun/star/animations/TransitionType.hpp>
51 : : #include <com/sun/star/animations/TransitionSubType.hpp>
52 : : #include <com/sun/star/animations/ValuePair.hpp>
53 : : #include <com/sun/star/animations/AnimationColorSpace.hpp>
54 : : #include <com/sun/star/drawing/FillStyle.hpp>
55 : : #include <com/sun/star/drawing/LineStyle.hpp>
56 : : #include <com/sun/star/awt/FontWeight.hpp>
57 : : #include <com/sun/star/awt/FontUnderline.hpp>
58 : : #include <com/sun/star/awt/FontSlant.hpp>
59 : : #include <com/sun/star/container/XEnumerationAccess.hpp>
60 : : #include <com/sun/star/presentation/ParagraphTarget.hpp>
61 : : #include <com/sun/star/text/XSimpleText.hpp>
62 : : #include <com/sun/star/animations/XIterateContainer.hpp>
63 : : #include <com/sun/star/presentation/TextAnimationType.hpp>
64 : : #include <com/sun/star/container/XChild.hpp>
65 : : #include <comphelper/processfactory.hxx>
66 : : #include <rtl/ustrbuf.hxx>
67 : :
68 : : #include <vcl/vclenum.hxx>
69 : : #include <svx/svdotext.hxx>
70 : : #include <editeng/outlobj.hxx>
71 : : #include <editeng/editobj.hxx>
72 : : #include <pptexanimations.hxx>
73 : : #include <osl/endian.h>
74 : :
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::container::XChild;
82 : : using ::com::sun::star::util::XCloneable;
83 : : using ::com::sun::star::uno::Reference;
84 : : using ::com::sun::star::uno::UNO_QUERY;
85 : : using ::com::sun::star::uno::UNO_QUERY_THROW;
86 : : using ::com::sun::star::uno::Sequence;
87 : : using ::com::sun::star::uno::makeAny;
88 : : using ::com::sun::star::uno::Exception;
89 : : using ::com::sun::star::uno::XInterface;
90 : : using ::com::sun::star::beans::NamedValue;
91 : : using ::com::sun::star::container::XEnumerationAccess;
92 : : using ::com::sun::star::container::XEnumeration;
93 : : using ::com::sun::star::lang::XMultiServiceFactory;
94 : :
95 : : using namespace ::com::sun::star::text;
96 : : using namespace ::com::sun::star::drawing;
97 : : using namespace ::com::sun::star::animations;
98 : : using namespace ::com::sun::star::presentation;
99 : :
100 : : namespace ppt
101 : : {
102 : :
103 : 0 : void ImplTranslateAttribute( rtl::OUString& rString, const TranslateMode eTranslateMode )
104 : : {
105 [ # # ]: 0 : if ( eTranslateMode != TRANSLATE_NONE )
106 : : {
107 [ # # ][ # # ]: 0 : if ( ( eTranslateMode & TRANSLATE_VALUE ) || ( eTranslateMode & TRANSLATE_ATTRIBUTE ) )
108 : : {
109 : 0 : const ImplAttributeNameConversion* p = gImplConversionList;
110 [ # # ]: 0 : while( p->mpAPIName )
111 : : {
112 [ # # ]: 0 : if( rString.compareToAscii( p->mpAPIName ) == 0 )
113 : 0 : break;
114 : 0 : p++;
115 : : }
116 [ # # ]: 0 : if( p->mpMSName )
117 : : {
118 [ # # ]: 0 : if ( eTranslateMode & TRANSLATE_VALUE )
119 : : {
120 : 0 : rString = rtl::OUString( (sal_Unicode)'#' );
121 : 0 : rString += OUString::createFromAscii( p->mpMSName );
122 : : }
123 : : else
124 : 0 : rString = OUString::createFromAscii( p->mpMSName );
125 : 0 : }
126 : : }
127 [ # # ]: 0 : else if ( eTranslateMode & TRANSLATE_MEASURE )
128 : : {
129 : 0 : const sal_Char* pDest[] = { "#ppt_x", "#ppt_y", "#ppt_w", "#ppt_h", NULL };
130 : 0 : const sal_Char* pSource[] = { "x", "y", "width", "height", NULL };
131 : 0 : sal_Int32 nIndex = 0;
132 : :
133 : 0 : const sal_Char** ps = pSource;
134 : 0 : const sal_Char** pd = pDest;
135 : :
136 [ # # ]: 0 : while( *ps )
137 : : {
138 : 0 : const OUString aSearch( OUString::createFromAscii( *ps ) );
139 [ # # ]: 0 : while( (nIndex = rString.indexOf( aSearch, nIndex )) != -1 )
140 : : {
141 : 0 : sal_Int32 nLength = aSearch.getLength();
142 [ # # ][ # # ]: 0 : if( nIndex && (rString.getStr()[nIndex-1] == '#' ) )
[ # # ]
143 : : {
144 : 0 : nIndex--;
145 : 0 : nLength++;
146 : : }
147 : :
148 : 0 : const OUString aNew( OUString::createFromAscii( *pd ) );
149 : 0 : rString = rString.replaceAt( nIndex, nLength, aNew );
150 : 0 : nIndex += aNew.getLength();
151 : 0 : }
152 : 0 : ps++;
153 : 0 : pd++;
154 : 0 : }
155 : : }
156 : : }
157 : 0 : }
158 : :
159 : 0 : sal_uInt32 AnimationExporter::TranslatePresetSubType( const sal_uInt32 nPresetClass, const sal_uInt32 nPresetId, const rtl::OUString& rPresetSubType )
160 : : {
161 : 0 : sal_uInt32 nPresetSubType = 0;
162 : 0 : sal_Bool bTranslated = sal_False;
163 : :
164 [ # # ][ # # ]: 0 : if ( ( nPresetClass == (sal_uInt32)EffectPresetClass::ENTRANCE ) || ( nPresetClass == (sal_uInt32)EffectPresetClass::EXIT ) )
165 : : {
166 [ # # ]: 0 : if ( nPresetId != 21 )
167 : : {
168 [ # # # # ]: 0 : switch( nPresetId )
169 : : {
170 : : case 5 :
171 : : {
172 [ # # ]: 0 : if ( rPresetSubType == "downward" )
173 : : {
174 : 0 : nPresetSubType = 5;
175 : 0 : bTranslated = sal_True;
176 : : }
177 [ # # ]: 0 : else if ( rPresetSubType == "across" )
178 : : {
179 : 0 : nPresetSubType = 10;
180 : 0 : bTranslated = sal_True;
181 : : }
182 : : }
183 : 0 : break;
184 : : case 17 :
185 : : {
186 [ # # ]: 0 : if ( rPresetSubType == "across" )
187 : : {
188 : 0 : nPresetSubType = 10;
189 : 0 : bTranslated = sal_True;
190 : : }
191 : : }
192 : 0 : break;
193 : : case 18 :
194 : : {
195 [ # # ]: 0 : if ( rPresetSubType == "right-to-top" )
196 : : {
197 : 0 : nPresetSubType = 3;
198 : 0 : bTranslated = sal_True;
199 : : }
200 [ # # ]: 0 : else if ( rPresetSubType == "right-to-bottom" )
201 : : {
202 : 0 : nPresetSubType = 6;
203 : 0 : bTranslated = sal_True;
204 : : }
205 [ # # ]: 0 : else if ( rPresetSubType == "left-to-top" )
206 : : {
207 : 0 : nPresetSubType = 9;
208 : 0 : bTranslated = sal_True;
209 : : }
210 [ # # ]: 0 : else if ( rPresetSubType == "left-to-bottom" )
211 : : {
212 : 0 : nPresetSubType = 12;
213 : 0 : bTranslated = sal_True;
214 : : }
215 : : }
216 : 0 : break;
217 : : }
218 : : }
219 [ # # ]: 0 : if ( !bTranslated )
220 : : {
221 : 0 : const convert_subtype* p = gConvertArray;
222 [ # # ]: 0 : while( p->mpStrSubType )
223 : : {
224 [ # # ]: 0 : if ( rPresetSubType.equalsAscii( p->mpStrSubType ) )
225 : : {
226 : 0 : nPresetSubType = p->mnID;
227 : 0 : bTranslated = sal_True;
228 : 0 : break;
229 : : }
230 : 0 : p++;
231 : : }
232 : : }
233 : : }
234 [ # # ]: 0 : if ( !bTranslated )
235 : 0 : nPresetSubType = (sal_uInt32)rPresetSubType.toInt32();
236 : 0 : return nPresetSubType;
237 : : }
238 : :
239 : 0 : const sal_Char* AnimationExporter::FindTransitionName( const sal_Int16 nType, const sal_Int16 nSubType, const sal_Bool bDirection )
240 : : {
241 : 0 : const sal_Char* pRet = NULL;
242 : 0 : int nFit = 0;
243 : :
244 : 0 : const transition* p = gTransitions;
245 [ # # ]: 0 : while( p->mpName )
246 : : {
247 : 0 : int nF = 0;
248 [ # # ]: 0 : if ( nType == p->mnType )
249 : 0 : nF += 4;
250 [ # # ]: 0 : if ( nSubType == p->mnSubType )
251 : 0 : nF += 2;
252 [ # # ]: 0 : if ( bDirection == p->mbDirection )
253 : 0 : nF += 1;
254 [ # # ]: 0 : if ( nF > nFit )
255 : : {
256 : 0 : pRet = p->mpName;
257 : 0 : nFit = nF;
258 : : }
259 [ # # ]: 0 : if ( nFit == 7 ) // maximum
260 : 0 : break;
261 : 0 : p++;
262 : : }
263 : 0 : return pRet;
264 : : }
265 : :
266 : 0 : SvStream& operator<<(SvStream& rOut, AnimationNode& rNode )
267 : : {
268 : 0 : rOut << rNode.mnU1;
269 : 0 : rOut << rNode.mnRestart;
270 : 0 : rOut << rNode.mnGroupType;
271 : 0 : rOut << rNode.mnFill;
272 : 0 : rOut << rNode.mnU3;
273 : 0 : rOut << rNode.mnU4;
274 : 0 : rOut << rNode.mnDuration;
275 : 0 : rOut << rNode.mnNodeType;
276 : :
277 : 0 : return rOut;
278 : : }
279 : :
280 : 0 : AnimationExporter::AnimationExporter( const EscherSolverContainer& rSolverContainer, ppt::ExSoundCollection& rExSoundCollection ) :
281 : : mrSolverContainer ( rSolverContainer ),
282 : : mrExSoundCollection ( rExSoundCollection ),
283 [ # # ]: 0 : mnCurrentGroup(0)
284 : : {
285 : 0 : }
286 : :
287 : : // --------------------------------------------------------------------
288 : :
289 : 0 : sal_Int16 AnimationExporter::GetFillMode( const Reference< XAnimationNode >& xNode, const sal_Int16 nFillDefault )
290 : : {
291 : 0 : sal_Int16 nFill = xNode->getFill();
292 [ # # ][ # # ]: 0 : if ( ( nFill == AnimationFill::DEFAULT ) ||
293 : : ( nFill == AnimationFill::INHERIT ) )
294 : : {
295 [ # # ]: 0 : if ( nFill != AnimationFill::AUTO )
296 : 0 : nFill = nFillDefault;
297 : : }
298 [ # # ]: 0 : if( nFill == AnimationFill::AUTO )
299 : : {
300 : 0 : nFill = AnimationFill::REMOVE;
301 : 0 : sal_Bool bIsIndefiniteTiming = sal_True;
302 [ # # ][ # # ]: 0 : Any aAny = xNode->getDuration();
303 [ # # ]: 0 : if( aAny.hasValue() )
304 : : {
305 : : Timing eTiming;
306 [ # # ][ # # ]: 0 : if( aAny >>= eTiming )
307 : 0 : bIsIndefiniteTiming = eTiming == Timing_INDEFINITE;
308 : : }
309 [ # # ]: 0 : if ( bIsIndefiniteTiming )
310 : : {
311 [ # # ][ # # ]: 0 : aAny = xNode->getEnd();
312 [ # # ]: 0 : if( aAny.hasValue() )
313 : : {
314 : : Timing eTiming;
315 [ # # ][ # # ]: 0 : if( aAny >>= eTiming )
316 : 0 : bIsIndefiniteTiming = eTiming == Timing_INDEFINITE;
317 : : }
318 [ # # ]: 0 : if ( bIsIndefiniteTiming )
319 : : {
320 [ # # ][ # # ]: 0 : if ( !xNode->getRepeatCount().hasValue() )
[ # # ]
321 : : {
322 [ # # ][ # # ]: 0 : aAny = xNode->getRepeatDuration();
323 [ # # ]: 0 : if( aAny.hasValue() )
324 : : {
325 : : Timing eTiming;
326 [ # # ][ # # ]: 0 : if( aAny >>= eTiming )
327 : 0 : bIsIndefiniteTiming = eTiming == Timing_INDEFINITE;
328 : : }
329 [ # # ]: 0 : if ( bIsIndefiniteTiming )
330 : 0 : nFill = AnimationFill::FREEZE;
331 : : }
332 : : }
333 : 0 : }
334 : : }
335 : 0 : return nFill;
336 : : }
337 : :
338 : 0 : void AnimationExporter::doexport( const Reference< XDrawPage >& xPage, SvStream& rStrm )
339 : : {
340 [ # # ]: 0 : Reference< XAnimationNodeSupplier > xNodeSupplier( xPage, UNO_QUERY );
341 [ # # ]: 0 : if( xNodeSupplier.is() )
342 : : {
343 [ # # ][ # # ]: 0 : const Reference< XAnimationNode > xRootNode( xNodeSupplier->getAnimationNode() );
344 [ # # ]: 0 : if( xRootNode.is() )
345 : : {
346 [ # # ]: 0 : processAfterEffectNodes( xRootNode );
347 [ # # ]: 0 : exportNode( rStrm, xRootNode, NULL, DFF_msofbtAnimGroup, 1, 0, sal_False, AnimationFill::AUTO );
348 : 0 : }
349 : 0 : }
350 : 0 : }
351 : :
352 : 0 : void AnimationExporter::processAfterEffectNodes( const Reference< XAnimationNode >& xRootNode )
353 : : {
354 : : try
355 : : {
356 [ # # ]: 0 : Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW );
357 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
[ # # ]
358 [ # # ][ # # ]: 0 : while( xEnumeration->hasMoreElements() )
[ # # ]
359 : : {
360 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
[ # # ]
361 : :
362 [ # # ]: 0 : Reference< XEnumerationAccess > xEnumerationAccess2( xNode, UNO_QUERY );
363 [ # # ]: 0 : if ( xEnumerationAccess2.is() )
364 : : {
365 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration2( xEnumerationAccess2->createEnumeration(), UNO_QUERY_THROW );
[ # # ]
366 [ # # ][ # # ]: 0 : while( xEnumeration2->hasMoreElements() )
[ # # ]
367 : : {
368 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xChildNode( xEnumeration2->nextElement(), UNO_QUERY_THROW );
[ # # ]
369 : :
370 [ # # ]: 0 : Reference< XEnumerationAccess > xEnumerationAccess3( xChildNode, UNO_QUERY_THROW );
371 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration3( xEnumerationAccess3->createEnumeration(), UNO_QUERY_THROW );
[ # # ]
372 [ # # ][ # # ]: 0 : while( xEnumeration3->hasMoreElements() )
[ # # ]
373 : : {
374 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xChildNode2( xEnumeration3->nextElement(), UNO_QUERY_THROW );
[ # # ]
375 : :
376 [ # # ]: 0 : Reference< XEnumerationAccess > xEnumerationAccess4( xChildNode2, UNO_QUERY_THROW );
377 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration4( xEnumerationAccess4->createEnumeration(), UNO_QUERY_THROW );
[ # # ]
378 [ # # ][ # # ]: 0 : while( xEnumeration4->hasMoreElements() )
[ # # ]
379 : : {
380 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xChildNode3( xEnumeration4->nextElement(), UNO_QUERY_THROW );
[ # # ]
381 : :
382 [ # # ][ # # ]: 0 : switch( xChildNode3->getType() )
[ # # ]
383 : : {
384 : : // found an after effect
385 : : case AnimationNodeType::SET:
386 : : case AnimationNodeType::ANIMATECOLOR:
387 : : {
388 : 0 : Reference< XAnimationNode > xMaster;
389 : :
390 [ # # ][ # # ]: 0 : Sequence< NamedValue > aUserData( xChildNode3->getUserData() );
391 : 0 : sal_Int32 nLength = aUserData.getLength();
392 : 0 : const NamedValue* p = aUserData.getConstArray();
393 : :
394 [ # # ]: 0 : while( nLength-- )
395 : : {
396 [ # # ]: 0 : if ( p->Name == "master-element" )
397 : : {
398 [ # # ]: 0 : p->Value >>= xMaster;
399 : 0 : break;
400 : : }
401 : 0 : p++;
402 : : }
403 : :
404 [ # # ][ # # ]: 0 : AfterEffectNodePtr pAfterEffectNode( new AfterEffectNode( xChildNode3, xMaster ) );
[ # # ]
405 [ # # ][ # # ]: 0 : maAfterEffectNodes.push_back( pAfterEffectNode );
[ # # ]
406 : : }
407 : 0 : break;
408 : : }
409 : 0 : }
410 : 0 : }
411 : 0 : }
412 : : }
413 [ # # ]: 0 : }
414 : : }
415 : 0 : catch( Exception& )
416 : : {
417 : : OSL_FAIL( "(@CL)AnimationExporter::processAfterEffectNodes(), exception cought!" );
418 : : }
419 : 0 : }
420 : :
421 : 0 : bool AnimationExporter::isAfterEffectNode( const Reference< XAnimationNode >& xNode ) const
422 : : {
423 : 0 : std::list< AfterEffectNodePtr >::const_iterator aIter( maAfterEffectNodes.begin() );
424 : 0 : const std::list< AfterEffectNodePtr >::const_iterator aEnd( maAfterEffectNodes.end() );
425 [ # # ]: 0 : while( aIter != aEnd )
426 : : {
427 [ # # ][ # # ]: 0 : if( (*aIter)->mxNode == xNode )
428 : 0 : return true;
429 : 0 : aIter++;
430 : : }
431 : :
432 : 0 : return false;
433 : : }
434 : :
435 : 0 : bool AnimationExporter::hasAfterEffectNode( const Reference< XAnimationNode >& xNode, Reference< XAnimationNode >& xAfterEffectNode ) const
436 : : {
437 : 0 : std::list< AfterEffectNodePtr >::const_iterator aIter( maAfterEffectNodes.begin() );
438 : 0 : const std::list< AfterEffectNodePtr >::const_iterator aEnd( maAfterEffectNodes.end() );
439 [ # # ]: 0 : while( aIter != aEnd )
440 : : {
441 [ # # ][ # # ]: 0 : if( (*aIter)->mxMaster == xNode )
442 : : {
443 [ # # ]: 0 : xAfterEffectNode = (*aIter)->mxNode;
444 : 0 : return true;
445 : : }
446 : 0 : aIter++;
447 : : }
448 : :
449 : 0 : return false;
450 : : }
451 : :
452 : : // check if this group only contain empty groups. this may happen when
453 : : // after effect nodes are not exported at theire original position
454 : 0 : bool AnimationExporter::isEmptyNode( const Reference< XAnimationNode >& xNode ) const
455 : : {
456 [ # # ]: 0 : if( xNode.is() ) switch( xNode->getType() )
[ # # # ]
457 : : {
458 : : case AnimationNodeType::PAR :
459 : : case AnimationNodeType::SEQ :
460 : : case AnimationNodeType::ITERATE :
461 : : {
462 [ # # ]: 0 : Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
463 [ # # ]: 0 : if( xEnumerationAccess.is() )
464 : : {
465 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
[ # # ]
466 [ # # ]: 0 : if( xEnumeration.is() )
467 : : {
468 [ # # ][ # # ]: 0 : while( xEnumeration->hasMoreElements() )
[ # # ]
469 : : {
470 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
[ # # ]
471 [ # # ][ # # ]: 0 : if( xChildNode.is() && !isEmptyNode( xChildNode ) )
[ # # ][ # # ]
472 : 0 : return false;
473 [ # # ]: 0 : }
474 [ # # ]: 0 : }
475 [ # # ]: 0 : }
476 : : }
477 : 0 : break;
478 : :
479 : : case AnimationNodeType::SET :
480 : : case AnimationNodeType::ANIMATECOLOR :
481 : 0 : return isAfterEffectNode( xNode );
482 : : default:
483 : 0 : return false;
484 : : }
485 : :
486 : 0 : return true;
487 : : }
488 : :
489 : 0 : void AnimationExporter::exportNode( SvStream& rStrm, Reference< XAnimationNode > xNode, const Reference< XAnimationNode >* pParent, const sal_uInt16 nContainerRecType,
490 : : const sal_uInt16 nInstance, const sal_Int32 nGroupLevel, const sal_Bool bTakeBackInteractiveSequenceTiming, const sal_Int16 nFDef )
491 : : {
492 [ # # ][ # # ]: 0 : if( (nGroupLevel == 4) && isEmptyNode( xNode ) )
[ # # ][ # # ]
493 : : return;
494 : :
495 [ # # ][ # # ]: 0 : if ( ( nContainerRecType == DFF_msofbtAnimGroup ) && ( nGroupLevel == 2 ) && isEmptyNode( xNode ) )
[ # # ][ # # ]
[ # # ]
496 : : return;
497 : :
498 [ # # ]: 0 : if( nContainerRecType == DFF_msofbtAnimGroup )
499 : 0 : mnCurrentGroup++;
500 : :
501 : 0 : sal_Bool bTakeBackInteractiveSequenceTimingForChild = sal_False;
502 [ # # ]: 0 : sal_Int16 nFillDefault = GetFillMode( xNode, nFDef );
503 : :
504 : 0 : bool bSkipChildren = false;
505 : :
506 : 0 : Reference< XAnimationNode > xAudioNode;
507 : : static sal_uInt32 nAudioGroup;
508 : :
509 : : {
510 [ # # ]: 0 : EscherExContainer aContainer( rStrm, nContainerRecType, nInstance );
511 [ # # ][ # # ]: 0 : switch( xNode->getType() )
[ # # # #
# # # # #
# # # ]
512 : : {
513 : : case AnimationNodeType::CUSTOM :
514 : : {
515 [ # # ]: 0 : exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
516 [ # # ]: 0 : exportAnimPropertySet( rStrm, xNode );
517 [ # # ]: 0 : exportAnimEvent( rStrm, xNode, 0 );
518 [ # # ]: 0 : exportAnimValue( rStrm, xNode, sal_False );
519 : : }
520 : 0 : break;
521 : :
522 : : case AnimationNodeType::PAR :
523 : : {
524 [ # # ]: 0 : exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
525 [ # # ]: 0 : exportAnimPropertySet( rStrm, xNode );
526 [ # # ]: 0 : sal_Int32 nFlags = nGroupLevel == 2 ? 0x10 : 0;
527 [ # # ]: 0 : if ( bTakeBackInteractiveSequenceTiming )
528 : 0 : nFlags |= 0x40;
529 [ # # ]: 0 : exportAnimEvent( rStrm, xNode, nFlags );
530 [ # # ]: 0 : exportAnimValue( rStrm, xNode, nGroupLevel == 4 );
531 : : }
532 : 0 : break;
533 : :
534 : : case AnimationNodeType::SEQ :
535 : : {
536 [ # # ]: 0 : exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
537 [ # # ]: 0 : sal_Int16 nNodeType = exportAnimPropertySet( rStrm, xNode );
538 : 0 : sal_Int32 nFlags = 12;
539 [ # # ][ # # ]: 0 : if ( ( nGroupLevel == 1 ) && ( nNodeType == ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE ) )
540 : : {
541 : 0 : nFlags |= 0x20;
542 : 0 : bTakeBackInteractiveSequenceTimingForChild = sal_True;
543 : : }
544 [ # # ]: 0 : exportAnimAction( rStrm, xNode );
545 [ # # ]: 0 : exportAnimEvent( rStrm, xNode, nFlags );
546 [ # # ]: 0 : exportAnimValue( rStrm, xNode, sal_False );
547 : : }
548 : 0 : break;
549 : :
550 : : case AnimationNodeType::ITERATE :
551 : : {
552 : : {
553 [ # # ]: 0 : EscherExAtom aAnimNodeExAtom( rStrm, DFF_msofbtAnimNode );
554 : : AnimationNode aAnim;
555 : 0 : memset( &aAnim, 0, sizeof( aAnim ) );
556 : 0 : aAnim.mnGroupType = mso_Anim_GroupType_PAR;
557 : 0 : aAnim.mnNodeType = 1;
558 : : // attribute Restart
559 [ # # ][ # # ]: 0 : switch( xNode->getRestart() )
[ # # # # ]
560 : : {
561 : : default:
562 : 0 : case AnimationRestart::DEFAULT : aAnim.mnRestart = 0; break;
563 : 0 : case AnimationRestart::ALWAYS : aAnim.mnRestart = 1; break;
564 : 0 : case AnimationRestart::WHEN_NOT_ACTIVE : aAnim.mnRestart = 2; break;
565 : 0 : case AnimationRestart::NEVER : aAnim.mnRestart = 3; break;
566 : : }
567 : : // attribute Fill
568 [ # # ][ # # ]: 0 : switch( xNode->getFill() )
[ # # # #
# ]
569 : : {
570 : : default:
571 : 0 : case AnimationFill::DEFAULT : aAnim.mnFill = 0; break;
572 : 0 : case AnimationFill::REMOVE : aAnim.mnFill = 1; break;
573 : 0 : case AnimationFill::FREEZE : aAnim.mnFill = 2; break;
574 : 0 : case AnimationFill::HOLD : aAnim.mnFill = 3; break;
575 : 0 : case AnimationFill::TRANSITION : aAnim.mnFill = 4; break;
576 : : }
577 [ # # ][ # # ]: 0 : rStrm << aAnim;
578 : : }
579 [ # # ]: 0 : exportIterate( rStrm, xNode );
580 [ # # ]: 0 : exportAnimPropertySet( rStrm, xNode );
581 [ # # ]: 0 : exportAnimEvent( rStrm, xNode, 0 );
582 [ # # ]: 0 : exportAnimValue( rStrm, xNode, sal_False );
583 : : }
584 : 0 : break;
585 : :
586 : : case AnimationNodeType::ANIMATE :
587 : : {
588 [ # # ]: 0 : exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
589 [ # # ]: 0 : exportAnimPropertySet( rStrm, xNode );
590 [ # # ]: 0 : exportAnimEvent( rStrm, xNode, 0 );
591 [ # # ]: 0 : exportAnimValue( rStrm, xNode, sal_False );
592 [ # # ]: 0 : exportAnimate( rStrm, xNode );
593 : : }
594 : 0 : break;
595 : :
596 : : case AnimationNodeType::SET :
597 : : {
598 [ # # ]: 0 : bool bIsAfterEffectNode( isAfterEffectNode( xNode ) );
599 [ # # ][ # # ]: 0 : if( (nGroupLevel != 4) || !bIsAfterEffectNode )
600 : : {
601 [ # # ]: 0 : exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
602 [ # # ]: 0 : exportAnimPropertySet( rStrm, xNode );
603 [ # # ][ # # ]: 0 : exportAnimateSet( rStrm, xNode, bIsAfterEffectNode ? AFTEREFFECT_SET : AFTEREFFECT_NONE );
604 [ # # ]: 0 : exportAnimEvent( rStrm, xNode, 0 );
605 [ # # ]: 0 : exportAnimValue( rStrm, xNode, sal_False );
606 : : }
607 : : else
608 : : {
609 : 0 : bSkipChildren = true;
610 : : }
611 : : }
612 : 0 : break;
613 : :
614 : : case AnimationNodeType::ANIMATEMOTION :
615 : : {
616 [ # # ]: 0 : exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
617 [ # # ]: 0 : exportAnimPropertySet( rStrm, xNode );
618 [ # # ]: 0 : exportAnimateMotion( rStrm, xNode );
619 [ # # ]: 0 : exportAnimEvent( rStrm, xNode, 0 );
620 [ # # ]: 0 : exportAnimValue( rStrm, xNode, sal_False );
621 : : }
622 : 0 : break;
623 : :
624 : : case AnimationNodeType::ANIMATECOLOR :
625 : : {
626 [ # # ]: 0 : bool bIsAfterEffectNode( isAfterEffectNode( xNode ) );
627 [ # # ][ # # ]: 0 : if( (nGroupLevel != 4) || !bIsAfterEffectNode )
628 : : {
629 [ # # ]: 0 : if( bIsAfterEffectNode )
630 [ # # ][ # # ]: 0 : xNode = createAfterEffectNodeClone( xNode );
631 : :
632 [ # # ]: 0 : exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
633 [ # # ]: 0 : exportAnimPropertySet( rStrm, xNode );
634 [ # # ][ # # ]: 0 : exportAnimateColor( rStrm, xNode, bIsAfterEffectNode ? AFTEREFFECT_COLOR : AFTEREFFECT_NONE );
635 [ # # ]: 0 : exportAnimEvent( rStrm, xNode, 0 );
636 [ # # ]: 0 : exportAnimValue( rStrm, xNode, sal_False );
637 : : }
638 : : else
639 : : {
640 : 0 : bSkipChildren = true;
641 : : }
642 : : }
643 : 0 : break;
644 : :
645 : : case AnimationNodeType::ANIMATETRANSFORM :
646 : : {
647 [ # # ]: 0 : exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
648 [ # # ]: 0 : exportAnimPropertySet( rStrm, xNode );
649 [ # # ]: 0 : exportAnimateTransform( rStrm, xNode );
650 [ # # ]: 0 : exportAnimEvent( rStrm, xNode, 0 );
651 [ # # ]: 0 : exportAnimValue( rStrm, xNode, sal_False );
652 : : }
653 : 0 : break;
654 : :
655 : : case AnimationNodeType::TRANSITIONFILTER :
656 : : {
657 [ # # ]: 0 : exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
658 [ # # ]: 0 : exportAnimPropertySet( rStrm, xNode );
659 [ # # ]: 0 : exportAnimEvent( rStrm, xNode, 0 );
660 [ # # ]: 0 : exportAnimValue( rStrm, xNode, sal_False );
661 [ # # ]: 0 : exportTransitionFilter( rStrm, xNode );
662 : : }
663 : 0 : break;
664 : :
665 : : case AnimationNodeType::AUDIO : // #i58428#
666 : : {
667 [ # # ]: 0 : exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
668 [ # # ]: 0 : exportAnimPropertySet( rStrm, xNode );
669 : :
670 [ # # ]: 0 : Reference< XAudio > xAudio( xNode, UNO_QUERY );
671 [ # # ]: 0 : if( xAudio.is() )
672 : : {
673 [ # # ][ # # ]: 0 : Any aAny( xAudio->getSource() );
674 : 0 : rtl::OUString aURL;
675 : :
676 [ # # ][ # # ]: 0 : if ( ( aAny >>= aURL) && !aURL.isEmpty() )
[ # # ]
677 : : {
678 : 0 : sal_Int32 nU1 = 2;
679 : 0 : sal_Int32 nTrigger = 3;
680 : 0 : sal_Int32 nU3 = nAudioGroup;
681 : 0 : sal_Int32 nBegin = 0;
682 : : {
683 [ # # ]: 0 : EscherExContainer aAnimEvent( rStrm, DFF_msofbtAnimEvent, 1 );
684 : : {
685 [ # # ]: 0 : EscherExAtom aAnimTrigger( rStrm, DFF_msofbtAnimTrigger );
686 [ # # ][ # # ]: 0 : rStrm << nU1 << nTrigger << nU3 << nBegin;
[ # # ][ # # ]
[ # # ]
687 [ # # ]: 0 : }
688 : : }
689 : 0 : nU1 = 1;
690 : 0 : nTrigger = 0xb;
691 : 0 : nU3 = 0;
692 : : {
693 [ # # ]: 0 : EscherExContainer aAnimEvent( rStrm, DFF_msofbtAnimEvent, 2 );
694 : : {
695 [ # # ]: 0 : EscherExAtom aAnimTrigger( rStrm, DFF_msofbtAnimTrigger );
696 [ # # ][ # # ]: 0 : rStrm << nU1 << nTrigger << nU3 << nBegin;
[ # # ][ # # ]
[ # # ]
697 [ # # ]: 0 : }
698 : : }
699 [ # # ]: 0 : EscherExContainer aAnimateTargetElement( rStrm, DFF_msofbtAnimateTargetElement );
700 : : {
701 : 0 : sal_uInt32 nRefMode = 3;
702 : 0 : sal_uInt32 nRefType = 2;
703 [ # # ]: 0 : sal_uInt32 nRefId = mrExSoundCollection.GetId( aURL );
704 : 0 : sal_Int32 begin = -1;
705 : 0 : sal_Int32 end = -1;
706 : :
707 [ # # ]: 0 : EscherExAtom aAnimReference( rStrm, DFF_msofbtAnimReference );
708 [ # # ][ # # ]: 0 : rStrm << nRefMode << nRefType << nRefId << begin << end;
[ # # ][ # # ]
[ # # ][ # # ]
709 [ # # ]: 0 : }
710 : 0 : }
711 : : }
712 [ # # ]: 0 : exportAnimValue( rStrm, xNode, sal_False );
713 : : }
714 : 0 : break;
715 : : }
716 [ # # ]: 0 : if( !bSkipChildren )
717 : : {
718 : : // export after effect node if one exists for this node
719 : 0 : Reference< XAnimationNode > xAfterEffectNode;
720 [ # # ][ # # ]: 0 : if( hasAfterEffectNode( xNode, xAfterEffectNode ) )
721 : : {
722 [ # # ]: 0 : exportNode( rStrm, xAfterEffectNode, &xNode, DFF_msofbtAnimSubGoup, 1, nGroupLevel + 1, bTakeBackInteractiveSequenceTimingForChild, nFillDefault );
723 : : }
724 : :
725 [ # # ]: 0 : Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
726 [ # # ]: 0 : if( xEnumerationAccess.is() )
727 : : {
728 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
[ # # ]
729 [ # # ]: 0 : if( xEnumeration.is() )
730 : : {
731 [ # # ][ # # ]: 0 : while( xEnumeration->hasMoreElements() )
[ # # ]
732 : : {
733 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
[ # # ]
734 [ # # ]: 0 : if( xChildNode.is() )
735 : : {
736 [ # # ][ # # ]: 0 : if ( xChildNode->getType() == AnimationNodeType::AUDIO )
[ # # ]
737 : : {
738 [ # # ]: 0 : xAudioNode = xChildNode;
739 : 0 : nAudioGroup = mnCurrentGroup;
740 : : }
741 : : else
742 [ # # ]: 0 : exportNode( rStrm, xChildNode, &xNode, DFF_msofbtAnimGroup, 1, nGroupLevel + 1, bTakeBackInteractiveSequenceTimingForChild, nFillDefault );
743 : : }
744 : 0 : }
745 : 0 : }
746 : 0 : }
747 [ # # ]: 0 : }
748 : : }
749 [ # # ]: 0 : if ( xAudioNode.is() )
750 [ # # ]: 0 : exportNode( rStrm, xAudioNode, &xNode, DFF_msofbtAnimGroup, 1, nGroupLevel, bTakeBackInteractiveSequenceTimingForChild, nFillDefault );
751 : :
752 [ # # ][ # # ]: 0 : if( xNode->getType() == AnimationNodeType::ITERATE )
[ # # ]
753 : 0 : aTarget = Any();
754 : : }
755 : :
756 : 0 : Reference< XAnimationNode > AnimationExporter::createAfterEffectNodeClone( const Reference< XAnimationNode >& xNode ) const
757 : : {
758 : : try
759 : : {
760 [ # # ]: 0 : Reference< ::com::sun::star::util::XCloneable > xClonable( xNode, UNO_QUERY_THROW );
761 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xCloneNode( xClonable->createClone(), UNO_QUERY_THROW );
[ # # ]
762 : :
763 : 0 : Any aEmpty;
764 [ # # ][ # # ]: 0 : xCloneNode->setBegin( aEmpty );
765 : :
766 [ # # ]: 0 : return xCloneNode;
767 : : }
768 : 0 : catch( Exception& )
769 : : {
770 : : OSL_FAIL("(@CL)sd::ppt::AnimationExporter::createAfterEffectNodeClone(), could not create clone!" );
771 : : }
772 : 0 : return xNode;
773 : : }
774 : :
775 : 0 : sal_Bool AnimationExporter::GetNodeType( const Reference< XAnimationNode >& xNode, sal_Int16& nType )
776 : : {
777 : : // trying to get the nodetype
778 [ # # ][ # # ]: 0 : Sequence< NamedValue > aUserData = xNode->getUserData();
779 [ # # ]: 0 : if ( aUserData.getLength() )
780 : : {
781 : 0 : const NamedValue* p = aUserData.getConstArray();
782 : 0 : sal_Int32 nLength = aUserData.getLength();
783 [ # # ]: 0 : while( nLength-- )
784 : : {
785 [ # # ]: 0 : if ( p->Name == "node-type" )
786 : : {
787 [ # # ]: 0 : if ( p->Value >>= nType )
788 : 0 : return sal_True;
789 : : }
790 : : }
791 : : }
792 : :
793 [ # # ]: 0 : return sal_False;
794 : : }
795 : :
796 : 0 : void AnimationExporter::exportAnimNode( SvStream& rStrm, const Reference< XAnimationNode >& xNode,
797 : : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >*, const sal_Int32, const sal_Int16 nFillDefault )
798 : : {
799 [ # # ]: 0 : EscherExAtom aAnimNodeExAtom( rStrm, DFF_msofbtAnimNode );
800 : : AnimationNode aAnim;
801 : 0 : memset( &aAnim, 0, sizeof( aAnim ) );
802 : :
803 : : // attribute Restart
804 [ # # ][ # # ]: 0 : switch( xNode->getRestart() )
[ # # # # ]
805 : : {
806 : : default:
807 : 0 : case AnimationRestart::DEFAULT : aAnim.mnRestart = 0; break;
808 : 0 : case AnimationRestart::ALWAYS : aAnim.mnRestart = 1; break;
809 : 0 : case AnimationRestart::WHEN_NOT_ACTIVE : aAnim.mnRestart = 2; break;
810 : 0 : case AnimationRestart::NEVER : aAnim.mnRestart = 3; break;
811 : : }
812 : :
813 [ # # # # ]: 0 : switch( nFillDefault )
814 : : {
815 : : default:
816 : 0 : case AnimationFill::DEFAULT : aAnim.mnFill = 0; break;
817 : 0 : case AnimationFill::REMOVE : aAnim.mnFill = 1; break;
818 : : case AnimationFill::FREEZE :
819 : 0 : case AnimationFill::HOLD : aAnim.mnFill = 3; break;
820 : 0 : case AnimationFill::TRANSITION : aAnim.mnFill = 4; break;
821 : : }
822 : : // attribute Duration
823 : 0 : double fDuration = 0.0;
824 : : com::sun::star::animations::Timing eTiming;
825 [ # # ][ # # ]: 0 : if ( xNode->getDuration() >>= eTiming )
[ # # ][ # # ]
826 : : {
827 [ # # ]: 0 : if ( eTiming == Timing_INDEFINITE )
828 : 0 : aAnim.mnDuration = -1;
829 : : }
830 [ # # ][ # # ]: 0 : else if ( xNode->getDuration() >>= fDuration )
[ # # ]
831 : : {
832 : 0 : aAnim.mnDuration = (sal_Int32)( fDuration * 1000.0 );
833 : : }
834 : : else
835 : 0 : aAnim.mnDuration = -1;
836 : :
837 : : // NodeType, NodeGroup
838 : 0 : aAnim.mnNodeType = 1;
839 : 0 : aAnim.mnGroupType = mso_Anim_GroupType_SEQ;
840 [ # # ][ # # ]: 0 : switch( xNode->getType() )
[ # # # #
# # ]
841 : : {
842 : : case AnimationNodeType::PAR : // PASSTROUGH!!! (as it was intended)
843 : 0 : aAnim.mnGroupType = mso_Anim_GroupType_PAR;
844 : : case AnimationNodeType::SEQ :
845 : : {
846 : 0 : sal_Int16 nType = 0;
847 [ # # ][ # # ]: 0 : if( GetNodeType( xNode, nType ) )
848 [ # # # ]: 0 : switch( nType )
849 : : {
850 : 0 : case ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT : aAnim.mnNodeType = 0x12; break;
851 : 0 : case ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE : aAnim.mnNodeType = 0x18; break;
852 : : }
853 : : }
854 : 0 : break;
855 : :
856 : : case AnimationNodeType::ANIMATE :
857 : : case AnimationNodeType::SET :
858 : :
859 : : case AnimationNodeType::CUSTOM :
860 : : case AnimationNodeType::ITERATE :
861 : : case AnimationNodeType::ANIMATEMOTION :
862 : : case AnimationNodeType::ANIMATECOLOR :
863 : : case AnimationNodeType::ANIMATETRANSFORM :
864 : : {
865 : 0 : aAnim.mnGroupType = mso_Anim_GroupType_NODE;
866 : 0 : aAnim.mnNodeType = mso_Anim_Behaviour_ANIMATION;
867 : : }
868 : 0 : break;
869 : :
870 : : case AnimationNodeType::AUDIO :
871 : : {
872 : 0 : aAnim.mnGroupType = mso_Anim_GroupType_MEDIA;
873 : 0 : aAnim.mnNodeType = mso_Anim_Behaviour_ANIMATION;
874 : : }
875 : 0 : break;
876 : :
877 : : case AnimationNodeType::TRANSITIONFILTER :
878 : : {
879 : 0 : aAnim.mnGroupType = mso_Anim_GroupType_NODE;
880 : 0 : aAnim.mnNodeType = mso_Anim_Behaviour_FILTER;
881 : : }
882 : 0 : break;
883 : : }
884 : :
885 [ # # ][ # # ]: 0 : rStrm << aAnim;
886 : 0 : }
887 : :
888 : 0 : void AnimationExporter::GetUserData( const Sequence< NamedValue >& rUserData, const Any ** pAny, sal_Size nLen )
889 : : {
890 : : // storing user data into pAny, to allow direct access later
891 : 0 : memset( pAny, 0, nLen );
892 [ # # ]: 0 : if ( rUserData.getLength() )
893 : : {
894 : 0 : const NamedValue* p = rUserData.getConstArray();
895 : 0 : sal_Int32 nLength = rUserData.getLength();
896 [ # # ]: 0 : while( nLength-- )
897 : : {
898 [ # # ]: 0 : if ( p->Name == "node-type" )
899 : : {
900 : 0 : pAny[ DFF_ANIM_NODE_TYPE ] = &(p->Value);
901 : : }
902 [ # # ]: 0 : else if ( p->Name == "preset-class" )
903 : : {
904 : 0 : pAny[ DFF_ANIM_PRESET_CLASS ] = &(p->Value);
905 : : }
906 [ # # ]: 0 : else if ( p->Name == "preset-id" )
907 : : {
908 : 0 : pAny[ DFF_ANIM_PRESET_ID ] = &(p->Value);
909 : : }
910 [ # # ]: 0 : else if ( p->Name == "preset-sub-type" )
911 : : {
912 : 0 : pAny[ DFF_ANIM_PRESET_SUB_TYPE ] = &(p->Value);
913 : : }
914 [ # # ]: 0 : else if ( p->Name == "master-element" )
915 : : {
916 : 0 : pAny[ DFF_ANIM_AFTEREFFECT ] = &(p->Value);;
917 : : }
918 : 0 : p++;
919 : : }
920 : : }
921 : 0 : }
922 : :
923 : 0 : sal_uInt32 AnimationExporter::GetPresetID( const rtl::OUString& rPreset, sal_uInt32 nAPIPresetClass, sal_Bool& bPresetId )
924 : : {
925 : 0 : sal_uInt32 nPresetId = 0;
926 : 0 : bPresetId = sal_False;
927 : :
928 [ # # ]: 0 : if ( rPreset.match( rtl::OUString( "ppt_" ), 0 ) )
929 : : {
930 : 0 : sal_Int32 nLast = rPreset.lastIndexOf( '_' );
931 [ # # ][ # # ]: 0 : if ( ( nLast != -1 ) && ( ( nLast + 1 ) < rPreset.getLength() ) )
[ # # ]
932 : : {
933 : 0 : rtl::OUString aNumber( rPreset.copy( nLast + 1 ) );
934 : 0 : nPresetId = aNumber.toInt32();
935 : 0 : bPresetId = sal_True;
936 : : }
937 : : }
938 : : else
939 : : {
940 : 0 : const preset_maping* p = gPresetMaping;
941 [ # # ][ # # ]: 0 : while( p->mpStrPresetId && ((p->mnPresetClass != (sal_Int32)nAPIPresetClass) || !rPreset.equalsAscii( p->mpStrPresetId )) )
[ # # ][ # # ]
942 : 0 : p++;
943 : :
944 [ # # ]: 0 : if( p->mpStrPresetId )
945 : : {
946 : 0 : nPresetId = p->mnPresetId;
947 : 0 : bPresetId = sal_True;
948 : : }
949 : : }
950 : :
951 : 0 : return nPresetId;
952 : : }
953 : :
954 : 0 : sal_Int16 AnimationExporter::exportAnimPropertySet( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
955 : : {
956 : 0 : sal_Int16 nNodeType = ::com::sun::star::presentation::EffectNodeType::DEFAULT;
957 : :
958 [ # # ]: 0 : EscherExContainer aAnimPropertySet( rStrm, DFF_msofbtAnimPropertySet );
959 : :
960 : 0 : Reference< XAnimationNode > xMaster;
961 : :
962 : 0 : Any aMasterRel, aOverride, aRunTimeContext;
963 : :
964 : : // storing user data into pAny, to allow direct access later
965 [ # # ][ # # ]: 0 : const Sequence< NamedValue > aUserData = xNode->getUserData();
966 : : const ::com::sun::star::uno::Any* pAny[ DFF_ANIM_PROPERTY_ID_COUNT ];
967 [ # # ]: 0 : GetUserData( aUserData, pAny, sizeof( pAny ) );
968 : :
969 [ # # ]: 0 : if( pAny[ DFF_ANIM_AFTEREFFECT ] )
970 [ # # ]: 0 : ( *pAny[ DFF_ANIM_AFTEREFFECT ] ) >>= xMaster;
971 : :
972 : : // calculate master-rel
973 [ # # ]: 0 : if( xMaster.is() )
974 : : {
975 : 0 : sal_Int32 nMasterRel = 2;
976 [ # # ]: 0 : Reference< XChild > xNodeChild( xNode, UNO_QUERY );
977 [ # # ]: 0 : Reference< XChild > xMasterChild( xMaster, UNO_QUERY );
978 [ # # ][ # # ]: 0 : if( xNodeChild.is() && xMasterChild.is() && (xNodeChild->getParent() == xMasterChild->getParent() ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # ]
979 : 0 : nMasterRel = 0;
980 : :
981 [ # # ]: 0 : aMasterRel <<= nMasterRel;
982 : :
983 : 0 : pAny[ DFF_ANIM_MASTERREL ] = &aMasterRel;
984 : :
985 [ # # ]: 0 : aOverride <<= (sal_Int32)1;
986 : 0 : pAny[ DFF_ANIM_OVERRIDE ] = &aOverride;
987 : :
988 [ # # ]: 0 : aRunTimeContext <<= (sal_Int32)1;
989 : 0 : pAny[ DFF_ANIM_RUNTIMECONTEXT ] = &aRunTimeContext;
990 : : }
991 : :
992 : : // the order is important
993 [ # # ]: 0 : if ( pAny[ DFF_ANIM_NODE_TYPE ] )
994 : : {
995 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_NODE_TYPE ] >>= nNodeType )
996 : : {
997 : 0 : sal_uInt32 nPPTNodeType = DFF_ANIM_NODE_TYPE_ON_CLICK;
998 [ # # # # : 0 : switch( nNodeType )
# # # ]
999 : : {
1000 : 0 : case ::com::sun::star::presentation::EffectNodeType::ON_CLICK : nPPTNodeType = DFF_ANIM_NODE_TYPE_ON_CLICK; break;
1001 : 0 : case ::com::sun::star::presentation::EffectNodeType::WITH_PREVIOUS : nPPTNodeType = DFF_ANIM_NODE_TYPE_WITH_PREVIOUS; break;
1002 : 0 : case ::com::sun::star::presentation::EffectNodeType::AFTER_PREVIOUS : nPPTNodeType = DFF_ANIM_NODE_TYPE_AFTER_PREVIOUS; break;
1003 : 0 : case ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE : nPPTNodeType = DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE; break;
1004 : 0 : case ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT : nPPTNodeType = DFF_ANIM_NODE_TYPE_TIMING_ROOT; break;
1005 : 0 : case ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE: nPPTNodeType = DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ; break;
1006 : : }
1007 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, DFF_ANIM_NODE_TYPE, nPPTNodeType, TRANSLATE_NONE );
1008 : : }
1009 : : }
1010 : 0 : sal_uInt32 nPresetId = 0;
1011 : 0 : sal_uInt32 nPresetSubType = 0;
1012 : 0 : sal_uInt32 nAPIPresetClass = EffectPresetClass::CUSTOM;
1013 : 0 : sal_uInt32 nPresetClass = DFF_ANIM_PRESS_CLASS_USER_DEFINED;
1014 : : sal_Bool bPresetClass, bPresetId, bPresetSubType;
1015 : 0 : bPresetId = bPresetClass = bPresetSubType = sal_False;
1016 : :
1017 [ # # ]: 0 : if ( pAny[ DFF_ANIM_PRESET_CLASS ] )
1018 : : {
1019 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_PRESET_CLASS ] >>= nAPIPresetClass )
1020 : : {
1021 : : sal_uInt8 nPPTPresetClass;
1022 [ # # # # : 0 : switch( nAPIPresetClass )
# # # ]
1023 : : {
1024 : 0 : case EffectPresetClass::ENTRANCE : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_ENTRANCE; break;
1025 : 0 : case EffectPresetClass::EXIT : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_EXIT; break;
1026 : 0 : case EffectPresetClass::EMPHASIS : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_EMPHASIS; break;
1027 : 0 : case EffectPresetClass::MOTIONPATH : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_MOTIONPATH; break;
1028 : 0 : case EffectPresetClass::OLEACTION : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_OLE_ACTION; break;
1029 : 0 : case EffectPresetClass::MEDIACALL : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_MEDIACALL; break;
1030 : : default :
1031 : 0 : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_USER_DEFINED;
1032 : : }
1033 : 0 : nPresetClass = nPPTPresetClass;
1034 : 0 : bPresetClass = sal_True;
1035 : : }
1036 : : }
1037 [ # # ]: 0 : if ( pAny[ DFF_ANIM_PRESET_ID ] )
1038 : : {
1039 : 0 : rtl::OUString sPreset;
1040 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_PRESET_ID ] >>= sPreset )
1041 [ # # ]: 0 : nPresetId = GetPresetID( sPreset, nAPIPresetClass, bPresetId );
1042 : : }
1043 : :
1044 [ # # ]: 0 : if ( pAny[ DFF_ANIM_PRESET_SUB_TYPE ] )
1045 : : {
1046 : 0 : rtl::OUString sPresetSubType;
1047 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_PRESET_SUB_TYPE ] >>= sPresetSubType )
1048 : : {
1049 [ # # ]: 0 : nPresetSubType = TranslatePresetSubType( nPresetClass, nPresetId, sPresetSubType );
1050 : 0 : bPresetSubType = sal_True;
1051 : 0 : }
1052 : : }
1053 [ # # ]: 0 : if ( bPresetId )
1054 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, DFF_ANIM_PRESET_ID, nPresetId, TRANSLATE_NONE );
1055 [ # # ]: 0 : if ( bPresetSubType )
1056 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, DFF_ANIM_PRESET_SUB_TYPE, nPresetSubType, TRANSLATE_NONE );
1057 [ # # ]: 0 : if ( bPresetClass )
1058 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, DFF_ANIM_PRESET_CLASS, nPresetClass, TRANSLATE_NONE );
1059 : :
1060 : 0 : if ( pAny[ DFF_ANIM_ID ] )
1061 : : {
1062 : : // TODO DFF_ANIM_ID
1063 : : }
1064 : :
1065 [ # # ]: 0 : if ( pAny[ DFF_ANIM_AFTEREFFECT ] )
1066 : : {
1067 : 0 : sal_Bool bAfterEffect = sal_False;
1068 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_AFTEREFFECT ] >>= bAfterEffect )
1069 [ # # ]: 0 : exportAnimPropertyByte( rStrm, DFF_ANIM_AFTEREFFECT, bAfterEffect, TRANSLATE_NONE );
1070 : : }
1071 : :
1072 [ # # ]: 0 : if ( pAny[ DFF_ANIM_RUNTIMECONTEXT ] )
1073 : : {
1074 : 0 : sal_Int32 nRunTimeContext = 0;
1075 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_RUNTIMECONTEXT ] >>= nRunTimeContext )
1076 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, DFF_ANIM_RUNTIMECONTEXT, nRunTimeContext, TRANSLATE_NONE );
1077 : : }
1078 : 0 : if ( pAny[ DFF_ANIM_PATH_EDIT_MODE ] )
1079 : : {
1080 : : // TODO DFF_ANIM_ID
1081 : : }
1082 : :
1083 [ # # ]: 0 : if( !xMaster.is() )
1084 : : {
1085 [ # # ]: 0 : Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
1086 [ # # ]: 0 : if( xColor.is() )
1087 : : {
1088 : :
1089 [ # # ][ # # ]: 0 : sal_Bool bDirection = !xColor->getDirection();
1090 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, DFF_ANIM_DIRECTION, bDirection, TRANSLATE_NONE );
1091 : 0 : }
1092 : : }
1093 : :
1094 [ # # ]: 0 : if ( pAny[ DFF_ANIM_OVERRIDE ] )
1095 : : {
1096 : 0 : sal_Int32 nOverride = 0;
1097 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_OVERRIDE ] >>= nOverride )
1098 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, DFF_ANIM_OVERRIDE, nOverride, TRANSLATE_NONE );
1099 : : }
1100 : :
1101 [ # # ]: 0 : if ( pAny[ DFF_ANIM_MASTERREL ] )
1102 : : {
1103 : 0 : sal_Int32 nMasterRel = 0;
1104 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_MASTERREL ] >>= nMasterRel )
1105 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, DFF_ANIM_MASTERREL, nMasterRel, TRANSLATE_NONE );
1106 : : }
1107 : :
1108 : : /* todo
1109 : : Reference< XAudio > xAudio( xNode, UNO_QUERY );
1110 : : if( xAudio.is() )
1111 : : {
1112 : : sal_Int16 nEndAfterSlide = 0;
1113 : : nEndAfterSlide = xAudio->getEndAfterSlide();
1114 : : exportAnimPropertyuInt32( rStrm, DFF_ANIM_ENDAFTERSLIDE, nEndAfterSlide, TRANSLATE_NONE );
1115 : : }
1116 : : */
1117 [ # # ]: 0 : Reference< XAnimate > xAnim( xNode, UNO_QUERY );
1118 : 0 : if( xAnim.is() )
1119 : : {
1120 : : // TODO: DFF_ANIM_TIMEFILTER
1121 : : }
1122 : 0 : if ( pAny[ DFF_ANIM_EVENT_FILTER ] )
1123 : : {
1124 : : // TODO DFF_ANIM_EVENT_FILTER
1125 : : }
1126 : 0 : if ( pAny[ DFF_ANIM_VOLUME ] )
1127 : : {
1128 : : // TODO DFF_ANIM_VOLUME
1129 : : }
1130 [ # # ][ # # ]: 0 : return nNodeType;
1131 : : }
1132 : :
1133 : 0 : sal_Bool AnimationExporter::exportAnimProperty( SvStream& rStrm, const sal_uInt16 nPropertyId, const ::com::sun::star::uno::Any& rAny, const TranslateMode eTranslateMode )
1134 : : {
1135 : 0 : sal_Bool bRet = sal_False;
1136 [ # # ]: 0 : if ( rAny.hasValue() )
1137 : : {
1138 [ # # # # : 0 : switch( rAny.getValueType().getTypeClass() )
# ]
1139 : : {
1140 : : case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT :
1141 : : case ::com::sun::star::uno::TypeClass_SHORT :
1142 : : case ::com::sun::star::uno::TypeClass_UNSIGNED_LONG :
1143 : : case ::com::sun::star::uno::TypeClass_LONG :
1144 : : {
1145 : 0 : sal_Int32 nVal = 0;
1146 [ # # ]: 0 : if ( rAny >>= nVal )
1147 : : {
1148 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, nPropertyId, nVal, eTranslateMode );
1149 : 0 : bRet = sal_True;
1150 : : }
1151 : : }
1152 : 0 : break;
1153 : :
1154 : : case ::com::sun::star::uno::TypeClass_DOUBLE :
1155 : : {
1156 : 0 : double fVal = 0.0;
1157 [ # # ]: 0 : if ( rAny >>= fVal )
1158 : : {
1159 [ # # ]: 0 : exportAnimPropertyFloat( rStrm, nPropertyId, fVal, eTranslateMode );
1160 : 0 : bRet = sal_True;
1161 : : }
1162 : : }
1163 : 0 : break;
1164 : : case ::com::sun::star::uno::TypeClass_FLOAT :
1165 : : {
1166 : 0 : float fVal = 0.0;
1167 [ # # ]: 0 : if ( rAny >>= fVal )
1168 : : {
1169 [ # # ]: 0 : if ( eTranslateMode & TRANSLATE_NUMBER_TO_STRING )
1170 : : {
1171 : 0 : Any aAny;
1172 : 0 : rtl::OUString aNumber( rtl::OUString::valueOf( fVal ) );
1173 [ # # ]: 0 : aAny <<= aNumber;
1174 [ # # ]: 0 : exportAnimPropertyString( rStrm, nPropertyId, aNumber, eTranslateMode );
1175 : : }
1176 : : else
1177 : : {
1178 [ # # ]: 0 : exportAnimPropertyFloat( rStrm, nPropertyId, fVal, eTranslateMode );
1179 : 0 : bRet = sal_True;
1180 : : }
1181 : : }
1182 : : }
1183 : 0 : break;
1184 : : case ::com::sun::star::uno::TypeClass_STRING :
1185 : : {
1186 : 0 : rtl::OUString aStr;
1187 [ # # ]: 0 : if ( rAny >>= aStr )
1188 : : {
1189 [ # # ]: 0 : exportAnimPropertyString( rStrm, nPropertyId, aStr, eTranslateMode );
1190 : 0 : bRet = sal_True;
1191 : 0 : }
1192 : : }
1193 : 0 : break;
1194 : : default:
1195 : 0 : break;
1196 : : }
1197 : : }
1198 : 0 : return bRet;
1199 : : }
1200 : 0 : void AnimationExporter::exportAnimPropertyString( SvStream& rStrm, const sal_uInt16 nPropertyId, const rtl::OUString& rVal, const TranslateMode eTranslateMode )
1201 : : {
1202 [ # # ]: 0 : EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
1203 : 0 : sal_uInt8 nType = DFF_ANIM_PROP_TYPE_UNISTRING;
1204 [ # # ]: 0 : rStrm << nType;
1205 : 0 : rtl::OUString aStr( rVal );
1206 [ # # ]: 0 : if ( eTranslateMode != TRANSLATE_NONE )
1207 : 0 : ImplTranslateAttribute( aStr, eTranslateMode );
1208 [ # # ][ # # ]: 0 : writeZString( rStrm, aStr );
1209 : 0 : }
1210 : :
1211 : 0 : void AnimationExporter::exportAnimPropertyFloat( SvStream& rStrm, const sal_uInt16 nPropertyId, const double& rVal, const TranslateMode )
1212 : : {
1213 [ # # ]: 0 : EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
1214 : 0 : sal_uInt8 nType = DFF_ANIM_PROP_TYPE_FLOAT;
1215 : 0 : float fFloat = (float)rVal;
1216 [ # # ]: 0 : rStrm << nType
1217 [ # # ][ # # ]: 0 : << fFloat;
1218 : 0 : }
1219 : :
1220 : 0 : void AnimationExporter::exportAnimPropertyuInt32( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt32 nVal, const TranslateMode )
1221 : : {
1222 [ # # ]: 0 : EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
1223 : 0 : sal_uInt8 nType = DFF_ANIM_PROP_TYPE_INT32 ;
1224 [ # # ]: 0 : rStrm << nType
1225 [ # # ][ # # ]: 0 : << nVal;
1226 : 0 : }
1227 : :
1228 : 0 : void AnimationExporter::exportAnimPropertyByte( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt8 nVal, const TranslateMode )
1229 : : {
1230 [ # # ]: 0 : EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
1231 : 0 : sal_uInt8 nType = DFF_ANIM_PROP_TYPE_BYTE;
1232 [ # # ]: 0 : rStrm << nType
1233 [ # # ][ # # ]: 0 : << nVal;
1234 : 0 : }
1235 : :
1236 : 0 : void AnimationExporter::writeZString( SvStream& rStrm, const rtl::OUString& rVal )
1237 : : {
1238 : : sal_Int32 i;
1239 [ # # ]: 0 : for ( i = 0; i < rVal.getLength(); i++ )
1240 : 0 : rStrm << rVal[ i ];
1241 : 0 : rStrm << (sal_Unicode)0;
1242 : 0 : }
1243 : :
1244 : 0 : void AnimationExporter::exportAnimAction( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
1245 : : {
1246 [ # # ]: 0 : EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAction );
1247 : :
1248 : 0 : sal_Int32 nConcurrent = 1;
1249 : 0 : sal_Int32 nNextAction = 1;
1250 : 0 : sal_Int32 nEndSync = 0;
1251 : 0 : sal_Int32 nU4 = 0;
1252 : 0 : sal_Int32 nU5 = 3;
1253 : :
1254 : 0 : sal_Int16 nAnimationEndSync = 0;
1255 [ # # ][ # # ]: 0 : if ( xNode->getEndSync() >>= nAnimationEndSync )
[ # # ]
1256 : : {
1257 [ # # ]: 0 : if ( nAnimationEndSync == AnimationEndSync::ALL )
1258 : 0 : nEndSync = 1;
1259 : : }
1260 [ # # ]: 0 : rStrm << nConcurrent
1261 [ # # ]: 0 : << nNextAction
1262 [ # # ]: 0 : << nEndSync
1263 [ # # ]: 0 : << nU4
1264 [ # # ][ # # ]: 0 : << nU5;
1265 : :
1266 : 0 : }
1267 : :
1268 : : // nFlags Bit 6 = fixInteractiveSequenceTiming (for child)
1269 : : // nFlags Bit 5 = fixInteractiveSequenceTiming (for root)
1270 : : // nFlags Bit 4 = first node of main sequence -> begin event next has to be replaced to indefinite
1271 : 0 : void AnimationExporter::exportAnimEvent( SvStream& rStrm, const Reference< XAnimationNode >& xNode, const sal_Int32 nFlags )
1272 : : {
1273 : : sal_uInt16 i;
1274 [ # # ]: 0 : for ( i = 0; i < 4; i++ )
1275 : : {
1276 : 0 : sal_Int32 nU1 = 0;
1277 : 0 : sal_Int32 nTrigger = 0;
1278 : 0 : sal_Int32 nU3 = 0;
1279 : 0 : sal_Int32 nBegin = 0;
1280 : :
1281 : 0 : sal_Bool bCreateEvent = sal_False;
1282 : 0 : Any aSource;
1283 : :
1284 [ # # # # ]: 0 : switch( i )
1285 : : {
1286 : : case 0 :
1287 : : case 1 :
1288 : : {
1289 : 0 : Any aAny;
1290 : 0 : Event aEvent;
1291 : : com::sun::star::animations::Timing eTiming;
1292 [ # # ]: 0 : if ( i == 0 )
1293 : : {
1294 [ # # ]: 0 : if ( nFlags & 0x20 )
1295 : : {
1296 : : // taking the first child
1297 [ # # ]: 0 : Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW );
1298 [ # # ][ # # ]: 0 : Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW );
[ # # ]
1299 [ # # ][ # # ]: 0 : if ( xE.is() && xE->hasMoreElements() )
[ # # ][ # # ]
[ # # ]
1300 : : {
1301 : : {
1302 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY );
[ # # ]
1303 [ # # ][ # # ]: 0 : aAny = xClickNode->getBegin();
1304 : : }
1305 : 0 : }
1306 : : }
1307 [ # # ]: 0 : else if ( nFlags & 0x40 )
1308 : : {
1309 : : // begin has to be replaced with void, so don't do anything
1310 : : }
1311 : : else
1312 : : {
1313 [ # # ][ # # ]: 0 : aAny = xNode->getBegin();
1314 [ # # ]: 0 : if ( nFlags & 0x10 ) // replace ON_NEXT with IDEFINITE
1315 : : {
1316 [ # # ][ # # ]: 0 : if ( ( aAny >>= aEvent ) && ( aEvent.Trigger == EventTrigger::ON_NEXT ) )
[ # # ][ # # ]
1317 : : {
1318 : 0 : eTiming = Timing_INDEFINITE;
1319 [ # # ]: 0 : aAny <<= eTiming;
1320 : : }
1321 : : }
1322 : : }
1323 : : }
1324 : : else
1325 [ # # ][ # # ]: 0 : aAny = xNode->getEnd();
1326 : :
1327 : 0 : double fTiming = 0.0;
1328 [ # # ][ # # ]: 0 : if ( aAny >>= aEvent )
1329 : : {
1330 : 0 : bCreateEvent = sal_True;
1331 [ # # # # : 0 : switch( aEvent.Trigger )
# # # # #
# # # # ]
1332 : : {
1333 : 0 : case EventTrigger::NONE : nTrigger = 0; break;
1334 : 0 : case EventTrigger::ON_BEGIN : nTrigger = 1; break;
1335 : 0 : case EventTrigger::ON_END : nTrigger = 2; break;
1336 : 0 : case EventTrigger::BEGIN_EVENT : nTrigger = 3; break;
1337 : 0 : case EventTrigger::END_EVENT : nTrigger = 4; nU1 = 2; nU3 = mnCurrentGroup; break;
1338 : 0 : case EventTrigger::ON_CLICK : nTrigger = 5; break;
1339 : 0 : case EventTrigger::ON_DBL_CLICK : nTrigger = 6; break;
1340 : 0 : case EventTrigger::ON_MOUSE_ENTER : nTrigger = 7; break;
1341 : 0 : case EventTrigger::ON_MOUSE_LEAVE : nTrigger = 8; break;
1342 : 0 : case EventTrigger::ON_NEXT : nTrigger = 9; break;
1343 : 0 : case EventTrigger::ON_PREV : nTrigger = 10; break;
1344 : 0 : case EventTrigger::ON_STOP_AUDIO : nTrigger = 11; break;
1345 : : }
1346 [ # # ]: 0 : if ( aEvent.Offset.hasValue() )
1347 : : {
1348 [ # # ][ # # ]: 0 : if ( aEvent.Offset >>= eTiming )
1349 : : {
1350 [ # # ]: 0 : if ( eTiming == Timing_INDEFINITE )
1351 : 0 : nBegin = -1;
1352 : : }
1353 [ # # ]: 0 : else if ( aEvent.Offset >>= fTiming )
1354 : 0 : nBegin = (sal_Int32)( fTiming * 1000.0 );
1355 : : }
1356 : 0 : aSource = aEvent.Source;
1357 : : }
1358 [ # # ][ # # ]: 0 : else if ( aAny >>= eTiming )
1359 : : {
1360 : 0 : bCreateEvent = sal_True;
1361 [ # # ]: 0 : if ( eTiming == Timing_INDEFINITE )
1362 : 0 : nBegin = -1;
1363 : : }
1364 [ # # ]: 0 : else if ( aAny >>= fTiming )
1365 : : {
1366 : 0 : bCreateEvent = sal_True;
1367 [ # # ]: 0 : if ( eTiming == Timing_INDEFINITE )
1368 : 0 : nBegin = (sal_Int32)( fTiming * 1000.0 );
1369 : 0 : }
1370 : : }
1371 : 0 : break;
1372 : :
1373 : : case 2 :
1374 : : {
1375 [ # # ]: 0 : if ( nFlags & ( 1 << i ) )
1376 : : {
1377 : 0 : bCreateEvent = sal_True;
1378 : 0 : nU1 = 1;
1379 : 0 : nTrigger = 9;
1380 : : }
1381 : : }
1382 : 0 : break;
1383 : : case 3 :
1384 : : {
1385 [ # # ]: 0 : if ( nFlags & ( 1 << i ) )
1386 : : {
1387 : 0 : bCreateEvent = sal_True;
1388 : 0 : nU1 = 1;
1389 : 0 : nTrigger = 10;
1390 : : }
1391 : : }
1392 : 0 : break;
1393 : : };
1394 [ # # ]: 0 : if ( bCreateEvent )
1395 : : {
1396 [ # # ]: 0 : EscherExContainer aAnimEvent( rStrm, DFF_msofbtAnimEvent, i + 1 );
1397 : : {
1398 [ # # ]: 0 : EscherExAtom aAnimTrigger( rStrm, DFF_msofbtAnimTrigger );
1399 [ # # ]: 0 : rStrm << nU1
1400 [ # # ]: 0 : << nTrigger
1401 [ # # ]: 0 : << nU3
1402 [ # # ][ # # ]: 0 : << nBegin;
1403 : : }
1404 [ # # ][ # # ]: 0 : exportAnimateTargetElement( rStrm, aSource, ( nFlags & ( 1 << i ) ) != 0 );
1405 : : }
1406 : 0 : }
1407 : 0 : }
1408 : :
1409 : 0 : Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const rtl::OUString& rAttributeName )
1410 : : {
1411 : 0 : rtl::OUString aDest;
1412 [ # # ][ # # : 0 : if ( rAttributeName == "X"
# # # # #
# ]
1413 : 0 : || rAttributeName == "Y"
1414 : 0 : || rAttributeName == "Width"
1415 : 0 : || rAttributeName == "Height"
1416 : : )
1417 : : {
1418 : 0 : rtl::OUString aStr;
1419 [ # # ]: 0 : if ( rSourceValue >>= aStr )
1420 : : {
1421 : 0 : ImplTranslateAttribute( aStr, TRANSLATE_MEASURE );
1422 : 0 : aDest += aStr;
1423 : 0 : }
1424 : : }
1425 [ # # # # : 0 : else if ( rAttributeName == "Rotate" // "r" or "style.rotation" ?
# # # # ]
[ # # ]
1426 : 0 : || rAttributeName == "SkewX"
1427 : 0 : || rAttributeName == "Opacity"
1428 : 0 : || rAttributeName == "CharHeight"
1429 : : )
1430 : : {
1431 : 0 : double fNumber = 0.0;
1432 [ # # ]: 0 : if ( rSourceValue >>= fNumber )
1433 : 0 : aDest += rtl::OUString::valueOf( fNumber );
1434 : : }
1435 [ # # # # : 0 : else if ( rAttributeName == "Color"
# # # # ]
[ # # ]
1436 : 0 : || rAttributeName == "FillColor" // "Fillcolor" or "FillColor" ?
1437 : 0 : || rAttributeName == "LineColor"
1438 : 0 : || rAttributeName == "CharColor"
1439 : : )
1440 : : {
1441 : 0 : sal_Int32 nColor = 0;
1442 [ # # ]: 0 : Sequence< double > aHSL( 3 );
1443 : 0 : rtl::OUString aP( "," );
1444 [ # # ][ # # ]: 0 : if ( rSourceValue >>= aHSL )
1445 : : {
1446 : 0 : aDest += "hsl(";
1447 [ # # ]: 0 : aDest += rtl::OUString::valueOf( (sal_Int32)( aHSL[ 0 ] / ( 360.0 / 255 ) ) );
1448 : 0 : aDest += aP;
1449 [ # # ]: 0 : aDest += rtl::OUString::valueOf( (sal_Int32)( aHSL[ 1 ] * 255.0 ) );
1450 : 0 : aDest += aP;
1451 [ # # ]: 0 : aDest += rtl::OUString::valueOf( (sal_Int32)( aHSL[ 2 ] * 255.0 ) );
1452 : 0 : aDest += ")";
1453 : : }
1454 [ # # ]: 0 : else if ( rSourceValue >>= nColor )
1455 : : {
1456 : 0 : aDest += "rgb(";
1457 : 0 : aDest += rtl::OUString::valueOf( (sal_Int32)( (sal_Int8)nColor ) );
1458 : 0 : aDest += aP;
1459 : 0 : aDest += rtl::OUString::valueOf( (sal_Int32)( (sal_Int8)( nColor >> 8 ) ) );
1460 : 0 : aDest += aP;
1461 : 0 : aDest += rtl::OUString::valueOf( (sal_Int32)( (sal_Int8)( nColor >> 16 ) ) );
1462 : 0 : aDest += ")";
1463 [ # # ]: 0 : }
1464 : : }
1465 [ # # ]: 0 : else if ( rAttributeName == "FillStyle" )
1466 : : {
1467 : : ::com::sun::star::drawing::FillStyle eFillStyle;
1468 [ # # ][ # # ]: 0 : if ( rSourceValue >>= eFillStyle )
1469 : : {
1470 [ # # ]: 0 : if ( eFillStyle == ::com::sun::star::drawing::FillStyle_NONE )
1471 : 0 : aDest += "none"; // ?
1472 : : else
1473 : 0 : aDest += "solid";
1474 : : }
1475 : : }
1476 [ # # ]: 0 : else if ( rAttributeName == "LineStyle" )
1477 : : {
1478 : : ::com::sun::star::drawing::LineStyle eLineStyle;
1479 [ # # ][ # # ]: 0 : if ( rSourceValue >>= eLineStyle )
1480 : : {
1481 [ # # ]: 0 : if ( eLineStyle == ::com::sun::star::drawing::LineStyle_NONE )
1482 : 0 : aDest += "false";
1483 : : else
1484 : 0 : aDest += "true";
1485 : : }
1486 : : }
1487 [ # # ]: 0 : else if ( rAttributeName == "CharWeight" )
1488 : : {
1489 : 0 : float fFontWeight = 0.0;
1490 [ # # ]: 0 : if ( rSourceValue >>= fFontWeight )
1491 : : {
1492 [ # # ]: 0 : if ( fFontWeight == com::sun::star::awt::FontWeight::BOLD )
1493 : 0 : aDest += "bold";
1494 : : else
1495 : 0 : aDest += "normal";
1496 : : }
1497 : : }
1498 [ # # ]: 0 : else if ( rAttributeName == "CharUnderline" )
1499 : : {
1500 : 0 : sal_Int16 nFontUnderline = 0;
1501 [ # # ]: 0 : if ( rSourceValue >>= nFontUnderline )
1502 : : {
1503 [ # # ]: 0 : if ( nFontUnderline == com::sun::star::awt::FontUnderline::NONE )
1504 : 0 : aDest += "false";
1505 : : else
1506 : 0 : aDest += "true";
1507 : : }
1508 : : }
1509 [ # # ]: 0 : else if ( rAttributeName == "CharPosture" )
1510 : : {
1511 : : ::com::sun::star::awt::FontSlant eFontSlant;
1512 [ # # ][ # # ]: 0 : if ( rSourceValue >>= eFontSlant )
1513 : : {
1514 [ # # ]: 0 : if ( eFontSlant == com::sun::star::awt::FontSlant_ITALIC )
1515 : 0 : aDest += "italic";
1516 : : else
1517 : 0 : aDest += "normal"; // ?
1518 : : }
1519 : : }
1520 [ # # ]: 0 : else if ( rAttributeName == "Visibility" )
1521 : : {
1522 : 0 : sal_Bool bVisible = sal_True;
1523 [ # # ]: 0 : if ( rSourceValue >>= bVisible )
1524 : : {
1525 [ # # ]: 0 : if ( bVisible )
1526 : 0 : aDest += "visible";
1527 : : else
1528 : 0 : aDest += "hidden";
1529 : : }
1530 : : }
1531 : 0 : Any aRet;
1532 [ # # ]: 0 : if ( !aDest.isEmpty() )
1533 [ # # ]: 0 : aRet <<= aDest;
1534 : : else
1535 : 0 : aRet = rSourceValue;
1536 : 0 : return aRet;
1537 : : }
1538 : :
1539 : 0 : void AnimationExporter::exportAnimateSet( SvStream& rStrm, const Reference< XAnimationNode >& xNode, int nAfterEffectType )
1540 : : {
1541 [ # # ]: 0 : Reference< XAnimateSet > xSet( xNode, UNO_QUERY );
1542 [ # # ]: 0 : if( xSet.is() )
1543 : : {
1544 [ # # ]: 0 : EscherExContainer aAnimateSet( rStrm, DFF_msofbtAnimateSet, 0 );
1545 : : {
1546 [ # # ]: 0 : EscherExAtom aAnimateSetData( rStrm, DFF_msofbtAnimateSetData );
1547 : 0 : sal_uInt32 nId1 = 1; // ??
1548 : 0 : sal_uInt32 nId2 = 1; // ??
1549 [ # # ][ # # ]: 0 : rStrm << nId1 << nId2;
[ # # ]
1550 : : }
1551 [ # # ][ # # ]: 0 : Any aConvertedValue( convertAnimateValue( xSet->getTo(), xSet->getAttributeName() ) );
[ # # ][ # # ]
[ # # ]
1552 [ # # ]: 0 : if ( aConvertedValue.hasValue() )
1553 [ # # ]: 0 : exportAnimProperty( rStrm, 1, aConvertedValue, TRANSLATE_NONE );
1554 [ # # ][ # # ]: 0 : exportAnimateTarget( rStrm, xNode, 0, nAfterEffectType );
1555 : 0 : }
1556 : 0 : }
1557 : :
1558 : 0 : sal_uInt32 AnimationExporter::GetValueTypeForAttributeName( const rtl::OUString& rAttributeName )
1559 : : {
1560 : 0 : sal_uInt32 nValueType = 0;
1561 : :
1562 : : struct Entry
1563 : : {
1564 : : const sal_Char* pName;
1565 : : sal_uInt8 nType;
1566 : : };
1567 : : static const Entry lcl_attributeMap[] =
1568 : : {
1569 : : { "charcolor", 2 },
1570 : : { "charfontname", 0 },
1571 : : { "charheight", 1 },
1572 : : { "charposture", 0 },
1573 : : // TODO(Q1): This should prolly be changed in PPT import
1574 : : // { "charrotation", ATTRIBUTE_CHAR_ROTATION },
1575 : : { "charrotation", 1 },
1576 : : { "charunderline", 0 },
1577 : : { "charweight", 0 },
1578 : : { "color", 2 },
1579 : : { "dimcolor", 2 },
1580 : : { "fillcolor", 2 },
1581 : : { "fillstyle", 0 },
1582 : : { "height", 1 },
1583 : : { "linecolor", 2 },
1584 : : { "linestyle", 0 },
1585 : : { "opacity", 0 },
1586 : : { "rotate", 1 },
1587 : : { "skewx", 1 },
1588 : : { "skewy", 1 },
1589 : : { "visibility", 1 },
1590 : : { "width", 1 },
1591 : : { "x", 1 },
1592 : : { "y", 1 },
1593 : : { NULL, 0 }
1594 : : };
1595 : 0 : const Entry* pPtr = &lcl_attributeMap[ 0 ];
1596 [ # # ]: 0 : while( pPtr->pName )
1597 : : {
1598 [ # # ]: 0 : if ( rAttributeName.equalsIgnoreAsciiCaseAscii( pPtr->pName ) )
1599 : : {
1600 : 0 : nValueType = pPtr->nType;
1601 : 0 : break;
1602 : : }
1603 : 0 : pPtr++;
1604 : : }
1605 : : DBG_ASSERT( pPtr->pName, "GetValueTypeForAttributeName, unknown property value!" );
1606 : 0 : return nValueType;
1607 : : }
1608 : :
1609 : 0 : void AnimationExporter::exportAnimate( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
1610 : : {
1611 [ # # ]: 0 : Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
1612 [ # # ]: 0 : if ( xAnimate.is() )
1613 : : {
1614 [ # # ][ # # ]: 0 : Any aBy ( xAnimate->getBy() );
1615 [ # # ][ # # ]: 0 : Any aFrom( xAnimate->getFrom() );
1616 [ # # ][ # # ]: 0 : Any aTo ( xAnimate->getTo() );
1617 : :
1618 [ # # ]: 0 : EscherExContainer aContainer( rStrm, DFF_msofbtAnimate, 0 );
1619 : : {
1620 [ # # ]: 0 : EscherExAtom aAnimateData( rStrm, DFF_msofbtAnimateData );
1621 : 0 : sal_uInt32 nBits = 0x38;
1622 [ # # ][ # # ]: 0 : sal_Int16 nTmp = xAnimate->getCalcMode();
1623 [ # # ]: 0 : sal_uInt32 nCalcMode = /* (nTmp == AnimationCalcMode::FORMULA) ? 2 : */ (nTmp == AnimationCalcMode::LINEAR) ? 1 : 0;
1624 [ # # ][ # # ]: 0 : nTmp = xAnimate->getValueType();
1625 [ # # ][ # # ]: 0 : sal_uInt32 nValueType = GetValueTypeForAttributeName( xAnimate->getAttributeName() );
1626 : :
1627 [ # # ]: 0 : if ( aBy.hasValue() )
1628 : 0 : nBits |= 1;
1629 [ # # ]: 0 : if ( aFrom.hasValue() )
1630 : 0 : nBits |= 2;
1631 [ # # ]: 0 : if ( aTo.hasValue() )
1632 : 0 : nBits |= 4;
1633 : :
1634 [ # # ]: 0 : rStrm << nCalcMode
1635 [ # # ]: 0 : << nBits
1636 [ # # ][ # # ]: 0 : << nValueType;
1637 : : }
1638 [ # # ]: 0 : if ( aBy.hasValue() )
1639 [ # # ]: 0 : exportAnimProperty( rStrm, 1, aBy, TRANSLATE_NUMBER_TO_STRING | TRANSLATE_MEASURE );
1640 [ # # ]: 0 : if ( aFrom.hasValue() )
1641 [ # # ]: 0 : exportAnimProperty( rStrm, 2, aFrom, TRANSLATE_NUMBER_TO_STRING | TRANSLATE_MEASURE );
1642 [ # # ]: 0 : if ( aTo.hasValue() )
1643 [ # # ]: 0 : exportAnimProperty( rStrm, 3, aTo, TRANSLATE_NUMBER_TO_STRING | TRANSLATE_MEASURE );
1644 : :
1645 [ # # ]: 0 : exportAnimateKeyPoints( rStrm, xAnimate );
1646 [ # # ][ # # ]: 0 : exportAnimateTarget( rStrm, xNode );
1647 : 0 : }
1648 : 0 : }
1649 : :
1650 : 0 : void AnimationExporter::exportAnimateTarget( SvStream& rStrm, const Reference< XAnimationNode >& xNode, const sal_uInt32 nForceAttributeNames, int nAfterEffectType )
1651 : : {
1652 [ # # ]: 0 : EscherExContainer aAnimateTarget( rStrm, DFF_msofbtAnimateTarget, 0 );
1653 [ # # ]: 0 : Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
1654 [ # # ]: 0 : if ( xAnimate.is() )
1655 : : {
1656 : : {
1657 [ # # ]: 0 : EscherExAtom aAnimateTargetSettings( rStrm, DFF_msofbtAnimateTargetSettings, 0 );
1658 : : // nBits %0001: additive, %0010: accumulate, %0100: attributeName, %1000: transformtype
1659 : : // nAdditive 0 = base, 1 = sum, 2 = replace, 3 = multiply, 4 = none
1660 : : // nAccumulate 0 = none, 1 = always
1661 : : // nTransformType 0: "property" else "image"
1662 : 0 : sal_uInt32 nBits = 0;
1663 : 0 : sal_uInt32 nAdditive = 0;
1664 : 0 : sal_uInt32 nAccumulate = 0;
1665 : 0 : sal_uInt32 nTransformType = 0;
1666 [ # # ]: 0 : if ( xAnimate.is() )
1667 : : {
1668 [ # # ][ # # ]: 0 : if ( !xAnimate->getAttributeName().isEmpty() )
[ # # ]
1669 : 0 : nBits |= 4; // what is attributeName ?, maybe this is set if a DFF_msofbtAnimateAttributeNames is written
1670 [ # # ][ # # ]: 0 : sal_Int16 nAdditiveMode = xAnimate->getAdditive();
1671 [ # # ]: 0 : if ( nAdditiveMode != AnimationAdditiveMode::BASE )
1672 : : {
1673 : 0 : nBits |= 1;
1674 [ # # # # : 0 : switch( nAdditiveMode )
# ]
1675 : : {
1676 : 0 : case AnimationAdditiveMode::SUM : nAdditive = 1; break;
1677 : 0 : case AnimationAdditiveMode::REPLACE : nAdditive = 2; break;
1678 : 0 : case AnimationAdditiveMode::MULTIPLY : nAdditive = 3; break;
1679 : 0 : case AnimationAdditiveMode::NONE : nAdditive = 4; break;
1680 : : }
1681 : : }
1682 [ # # ][ # # ]: 0 : if ( xAnimate->getAccumulate() )
[ # # ]
1683 : : {
1684 : 0 : nBits |= 2;
1685 : 0 : nAccumulate = 1;
1686 : : }
1687 : : }
1688 [ # # ]: 0 : rStrm << nBits
1689 [ # # ]: 0 : << nAdditive
1690 [ # # ]: 0 : << nAccumulate
1691 [ # # ][ # # ]: 0 : << nTransformType;
1692 : : }
1693 [ # # ][ # # ]: 0 : if ( !xAnimate->getAttributeName().isEmpty() || nForceAttributeNames )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
1694 : : {
1695 [ # # ]: 0 : EscherExContainer aAnimateAttributeNames( rStrm, DFF_msofbtAnimateAttributeNames, 1 );
1696 [ # # ][ # # ]: 0 : rtl::OUString aAttributeName( xAnimate->getAttributeName() );
1697 [ # # ]: 0 : if ( nForceAttributeNames )
1698 : : {
1699 [ # # ]: 0 : if( nForceAttributeNames == 1 )
1700 : : {
1701 : 0 : aAttributeName = "r";
1702 : : }
1703 : : }
1704 : 0 : sal_Int32 nIndex = 0;
1705 [ # # ]: 0 : do
1706 : : {
1707 : 0 : OUString aToken( aAttributeName.getToken( 0, ';', nIndex ) );
1708 [ # # ]: 0 : exportAnimPropertyString( rStrm, 0, aToken, TRANSLATE_ATTRIBUTE );
1709 : : }
1710 [ # # ]: 0 : while ( nIndex >= 0 );
1711 : : }
1712 : :
1713 [ # # ]: 0 : if( nAfterEffectType != AFTEREFFECT_NONE )
1714 : : {
1715 [ # # ]: 0 : EscherExContainer aAnimPropertySet( rStrm, DFF_msofbtAnimPropertySet );
1716 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, 6, 1, TRANSLATE_NONE );
1717 [ # # ]: 0 : if( nAfterEffectType == AFTEREFFECT_COLOR )
1718 : : {
1719 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, 4, 0, TRANSLATE_NONE );
1720 [ # # ]: 0 : exportAnimPropertyuInt32( rStrm, 5, 0, TRANSLATE_NONE );
1721 [ # # ]: 0 : }
1722 : : }
1723 [ # # ][ # # ]: 0 : exportAnimateTargetElement( rStrm, aTarget.hasValue() ? aTarget : xAnimate->getTarget(), sal_False );
[ # # ][ # # ]
1724 [ # # ]: 0 : }
1725 : 0 : }
1726 : :
1727 : 0 : Reference< XShape > AnimationExporter::getTargetElementShape( const Any& rAny, sal_Int32& rBegin, sal_Int32& rEnd, sal_Bool& rParagraphTarget )
1728 : : {
1729 : 0 : Reference< XShape > xShape;
1730 [ # # ]: 0 : rAny >>= xShape;
1731 : :
1732 : 0 : rParagraphTarget = sal_False;
1733 : :
1734 [ # # ]: 0 : if( !xShape.is() )
1735 : : {
1736 [ # # ]: 0 : ParagraphTarget aParaTarget;
1737 [ # # ][ # # ]: 0 : if( rAny >>= aParaTarget )
1738 [ # # ]: 0 : xShape = aParaTarget.Shape;
1739 [ # # ]: 0 : if ( xShape.is() )
1740 : : {
1741 : : // now calculating the character range for the paragraph
1742 : 0 : sal_Int16 nParagraph = aParaTarget.Paragraph;
1743 [ # # ]: 0 : Reference< XSimpleText > xText( xShape, UNO_QUERY );
1744 [ # # ]: 0 : if ( xText.is() )
1745 : : {
1746 : 0 : rParagraphTarget = sal_True;
1747 [ # # ]: 0 : Reference< XEnumerationAccess > xTextParagraphEnumerationAccess( xText, UNO_QUERY );
1748 [ # # ]: 0 : if ( xTextParagraphEnumerationAccess.is() )
1749 : : {
1750 [ # # ][ # # ]: 0 : Reference< XEnumeration > xTextParagraphEnumeration( xTextParagraphEnumerationAccess->createEnumeration() );
1751 [ # # ]: 0 : if ( xTextParagraphEnumeration.is() )
1752 : : {
1753 : : sal_Int16 nCurrentParagraph;
1754 : 0 : rBegin = rEnd = nCurrentParagraph = 0;
1755 [ # # ][ # # ]: 0 : while ( xTextParagraphEnumeration->hasMoreElements() )
[ # # ]
1756 : : {
1757 [ # # ][ # # ]: 0 : Reference< XTextRange > xTextRange( xTextParagraphEnumeration->nextElement(), UNO_QUERY );
[ # # ]
1758 [ # # ]: 0 : if ( xTextRange.is() )
1759 : : {
1760 [ # # ][ # # ]: 0 : rtl::OUString aParaText( xTextRange->getString() );
1761 : 0 : sal_Int32 nLength = aParaText.getLength() + 1;
1762 : 0 : rEnd += nLength;
1763 [ # # ]: 0 : if ( nCurrentParagraph == nParagraph )
1764 : : break;
1765 : 0 : nCurrentParagraph++;
1766 [ # # ]: 0 : rBegin += nLength;
1767 : : }
1768 [ # # ]: 0 : }
1769 : 0 : }
1770 : 0 : }
1771 : 0 : }
1772 [ # # ]: 0 : }
1773 : : }
1774 : :
1775 : 0 : return xShape;
1776 : : }
1777 : :
1778 : 0 : void AnimationExporter::exportAnimateTargetElement( SvStream& rStrm, const Any aAny, const sal_Bool bCreate2b01Atom )
1779 : : {
1780 : 0 : sal_uInt32 nRefMode = 0; // nRefMode == 2 -> Paragraph
1781 : 0 : sal_Int32 begin = -1;
1782 : 0 : sal_Int32 end = -1;
1783 : : sal_Bool bParagraphTarget;
1784 : :
1785 [ # # ]: 0 : Reference< XShape > xShape = getTargetElementShape( aAny, begin, end, bParagraphTarget );
1786 : :
1787 [ # # ]: 0 : if( bParagraphTarget )
1788 : 0 : nRefMode = 2;
1789 : :
1790 [ # # ][ # # ]: 0 : if ( xShape.is() || bCreate2b01Atom )
[ # # ]
1791 : : {
1792 [ # # ]: 0 : EscherExContainer aAnimateTargetElement( rStrm, DFF_msofbtAnimateTargetElement );
1793 [ # # ]: 0 : if ( xShape.is() )
1794 : : {
1795 [ # # ]: 0 : EscherExAtom aAnimReference( rStrm, DFF_msofbtAnimReference );
1796 : :
1797 : 0 : sal_uInt32 nRefType = 1; // TODO: nRefType == 2 -> Sound;
1798 [ # # ]: 0 : sal_uInt32 nRefId = ((EscherSolverContainer&)mrSolverContainer).GetShapeId( xShape );
1799 : :
1800 [ # # ]: 0 : rStrm << nRefMode
1801 [ # # ]: 0 : << nRefType
1802 [ # # ]: 0 : << nRefId
1803 [ # # ]: 0 : << begin
1804 [ # # ][ # # ]: 0 : << end;
1805 : : }
1806 [ # # ]: 0 : if ( bCreate2b01Atom )
1807 : : {
1808 [ # # ]: 0 : EscherExAtom a2b01Atom( rStrm, 0x2b01 );
1809 [ # # ][ # # ]: 0 : rStrm << (sal_uInt32)1; // ?
1810 [ # # ]: 0 : }
1811 : 0 : }
1812 : 0 : }
1813 : :
1814 : 0 : void AnimationExporter::exportAnimateKeyPoints( SvStream& rStrm, const Reference< XAnimate >& xAnimate )
1815 : : {
1816 [ # # ][ # # ]: 0 : Sequence< double > aKeyTimes( xAnimate->getKeyTimes() );
1817 [ # # ][ # # ]: 0 : Sequence< Any > aValues( xAnimate->getValues() );
1818 [ # # ][ # # ]: 0 : OUString aFormula( xAnimate->getFormula() );
1819 [ # # ]: 0 : if ( aKeyTimes.getLength() )
1820 : : {
1821 [ # # ]: 0 : EscherExContainer aAnimKeyPoints( rStrm, DFF_msofbtAnimKeyPoints );
1822 : : sal_Int32 i;
1823 [ # # ]: 0 : for ( i = 0; i < aKeyTimes.getLength(); i++ )
1824 : : {
1825 : : {
1826 [ # # ]: 0 : EscherExAtom aAnimKeyTime( rStrm, DFF_msofbtAnimKeyTime );
1827 [ # # ]: 0 : sal_Int32 nKeyTime = (sal_Int32)( aKeyTimes[ i ] * 1000.0 );
1828 [ # # ][ # # ]: 0 : rStrm << nKeyTime;
1829 : : }
1830 [ # # ]: 0 : Any aAny[ 2 ];
1831 [ # # ][ # # ]: 0 : if ( aValues[ i ].hasValue() )
1832 : : {
1833 : 0 : ValuePair aPair;
1834 [ # # ][ # # ]: 0 : if ( aValues[ i ] >>= aPair )
[ # # ]
1835 : : {
1836 [ # # ][ # # ]: 0 : aAny[ 0 ] = convertAnimateValue( aPair.First, xAnimate->getAttributeName() );
[ # # ]
1837 [ # # ][ # # ]: 0 : aAny[ 1 ] = convertAnimateValue( aPair.Second, xAnimate->getAttributeName() );
[ # # ]
1838 : : }
1839 : : else
1840 : : {
1841 [ # # ][ # # ]: 0 : aAny[ 0 ] = convertAnimateValue( aValues[ i ], xAnimate->getAttributeName() );
[ # # ][ # # ]
1842 : : }
1843 [ # # ][ # # ]: 0 : if ( !i && !aFormula.isEmpty() )
[ # # ]
1844 : : {
1845 : 0 : ImplTranslateAttribute( aFormula, TRANSLATE_MEASURE );
1846 [ # # ]: 0 : aAny[ 1 ] <<= aFormula;
1847 : : }
1848 [ # # ]: 0 : exportAnimProperty( rStrm, 0, aAny[ 0 ], TRANSLATE_NONE );
1849 [ # # ]: 0 : exportAnimProperty( rStrm, 1, aAny[ 1 ], TRANSLATE_NONE );
1850 : : }
1851 [ # # ][ # # ]: 0 : }
[ # # ]
1852 [ # # ][ # # ]: 0 : }
1853 : 0 : }
1854 : :
1855 : 0 : void AnimationExporter::exportAnimValue( SvStream& rStrm, const Reference< XAnimationNode >& xNode, const sal_Bool bExportAlways )
1856 : : {
1857 : 0 : Any aAny;
1858 : : // repeat count (0)
1859 : 0 : double fRepeat = 0.0;
1860 : 0 : float fRepeatCount = 0.0;
1861 : : com::sun::star::animations::Timing eTiming;
1862 [ # # ][ # # ]: 0 : aAny = xNode->getRepeatCount();
1863 [ # # ][ # # ]: 0 : if ( aAny >>= eTiming )
1864 : : {
1865 [ # # ]: 0 : if ( eTiming == Timing_INDEFINITE )
1866 : 0 : fRepeatCount = ((float)3.40282346638528860e+38);
1867 : : }
1868 [ # # ]: 0 : else if ( aAny >>= fRepeat )
1869 : 0 : fRepeatCount = (float)fRepeat;
1870 [ # # ]: 0 : if ( fRepeatCount != 0.0 )
1871 : : {
1872 [ # # ]: 0 : EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
1873 : 0 : sal_uInt32 nType = 0;
1874 [ # # ]: 0 : rStrm << nType
1875 [ # # ][ # # ]: 0 : << fRepeatCount;
1876 : : }
1877 : : // accelerate (3)
1878 [ # # ][ # # ]: 0 : float fAccelerate = (float)xNode->getAcceleration();
1879 [ # # ][ # # ]: 0 : if ( bExportAlways || ( fAccelerate != 0.0 ) )
1880 : : {
1881 [ # # ]: 0 : EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
1882 : 0 : sal_uInt32 nType = 3;
1883 [ # # ]: 0 : rStrm << nType
1884 [ # # ][ # # ]: 0 : << fAccelerate;
1885 : : }
1886 : :
1887 : : // decelerate (4)
1888 [ # # ][ # # ]: 0 : float fDecelerate = (float)xNode->getDecelerate();
1889 [ # # ][ # # ]: 0 : if ( bExportAlways || ( fDecelerate != 0.0 ) )
1890 : : {
1891 [ # # ]: 0 : EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
1892 : 0 : sal_uInt32 nType = 4;
1893 [ # # ]: 0 : rStrm << nType
1894 [ # # ][ # # ]: 0 : << fDecelerate;
1895 : : }
1896 : :
1897 : : // autoreverse (5)
1898 [ # # ][ # # ]: 0 : sal_Bool bAutoReverse = xNode->getAutoReverse();
1899 [ # # ][ # # ]: 0 : if ( bExportAlways || bAutoReverse )
1900 : : {
1901 [ # # ]: 0 : EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
1902 : 0 : sal_uInt32 nType = 5;
1903 [ # # ]: 0 : sal_uInt32 nVal = bAutoReverse ? 1 : 0;
1904 [ # # ]: 0 : rStrm << nType
1905 [ # # ][ # # ]: 0 : << nVal;
1906 : 0 : }
1907 : 0 : }
1908 : :
1909 : 0 : void AnimationExporter::exportTransitionFilter( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
1910 : : {
1911 [ # # ]: 0 : Reference< XTransitionFilter > xFilter( xNode, UNO_QUERY );
1912 [ # # ]: 0 : if ( xFilter.is() )
1913 : : {
1914 [ # # ]: 0 : EscherExContainer aAnimateFilter( rStrm, DFF_msofbtAnimateFilter );
1915 : : {
1916 [ # # ]: 0 : EscherExAtom aAnimateFilterData( rStrm, DFF_msofbtAnimateFilterData );
1917 : 0 : sal_uInt32 nBits = 3; // bit 0 -> use AnimAttributeValue
1918 : : // bit 1 -> use nTransition
1919 : :
1920 [ # # ][ # # ]: 0 : sal_uInt32 nTransition = xFilter->getMode() ? 0 : 1;
1921 [ # # ]: 0 : rStrm << nBits
1922 [ # # ][ # # ]: 0 : << nTransition;
1923 : : }
1924 [ # # ][ # # ]: 0 : const sal_Char* pFilter = FindTransitionName( xFilter->getTransition(), xFilter->getSubtype(), xFilter->getDirection() );
[ # # ][ # # ]
[ # # ][ # # ]
1925 [ # # ]: 0 : if ( pFilter )
1926 : : {
1927 : 0 : const OUString aStr( OUString::createFromAscii( pFilter ) );
1928 [ # # ]: 0 : exportAnimPropertyString( rStrm, 1, aStr, TRANSLATE_NONE );
1929 : : }
1930 [ # # ][ # # ]: 0 : exportAnimateTarget( rStrm, xNode );
1931 : 0 : }
1932 : 0 : }
1933 : :
1934 : 0 : void AnimationExporter::exportAnimateMotion( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
1935 : : {
1936 [ # # ]: 0 : Reference< XAnimateMotion > xMotion( xNode, UNO_QUERY );
1937 [ # # ]: 0 : if ( xMotion.is() )
1938 : : {
1939 [ # # ]: 0 : EscherExContainer aAnimateMotion( rStrm, DFF_msofbtAnimateMotion );
1940 : : {
1941 : : { //SJ: Ignored from import filter
1942 [ # # ]: 0 : EscherExAtom aAnimateMotionData( rStrm, DFF_msofbtAnimateMotionData );
1943 : 0 : sal_uInt32 nBits = 0x98;
1944 : 0 : sal_uInt32 nOrigin = 0x2;
1945 : 0 : float fByX = 100.0; // nBits&1
1946 : 0 : float fByY = 100.0; // nBits&1
1947 : 0 : float fFromX = 0.0; // nBits&2
1948 : 0 : float fFromY = 0.0; // nBits&2
1949 : 0 : float fToX = 100.0; // nBits&4
1950 : 0 : float fToY = 100.0; // nBits&4
1951 [ # # ][ # # ]: 0 : rStrm << nBits << fByX << fByY << fFromX << fFromY << fToX << fToY << nOrigin;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1952 : : }
1953 : :
1954 : 0 : OUString aStr;
1955 [ # # ][ # # ]: 0 : if ( xMotion->getPath() >>= aStr )
[ # # ]
1956 : : {
1957 [ # # ]: 0 : if ( !aStr.isEmpty() )
1958 [ # # ]: 0 : exportAnimPropertyString( rStrm, 1, aStr, TRANSLATE_NONE );
1959 : : }
1960 [ # # ]: 0 : exportAnimateTarget( rStrm, xNode );
1961 [ # # ]: 0 : }
1962 : 0 : }
1963 : 0 : }
1964 : :
1965 : 0 : void AnimationExporter::exportAnimateTransform( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
1966 : : {
1967 [ # # ]: 0 : Reference< XAnimateTransform > xTransform( xNode, UNO_QUERY );
1968 [ # # ]: 0 : if ( xTransform.is() )
1969 : : {
1970 [ # # ][ # # ]: 0 : if ( xTransform->getTransformType() == AnimationTransformType::SCALE )
[ # # ]
1971 : : {
1972 [ # # ]: 0 : EscherExContainer aAnimateScale( rStrm, DFF_msofbtAnimateScale );
1973 : : {
1974 [ # # ]: 0 : EscherExAtom aAnimateScaleData( rStrm, DFF_msofbtAnimateScaleData );
1975 : 0 : sal_uInt32 nBits = 0;
1976 : 0 : sal_uInt32 nZoomContents = 1;
1977 : 0 : float fByX = 100.0;
1978 : 0 : float fByY = 100.0;
1979 : 0 : float fFromX = 0.0;
1980 : 0 : float fFromY = 0.0;
1981 : 0 : float fToX = 100.0;
1982 : 0 : float fToY = 100.0;
1983 : :
1984 : 0 : double fX = 0.0, fY = 0.0;
1985 : 0 : ValuePair aPair;
1986 [ # # ][ # # ]: 0 : if ( xTransform->getBy() >>= aPair )
[ # # ][ # # ]
1987 : : {
1988 [ # # ][ # # ]: 0 : if ( ( aPair.First >>= fX ) && ( aPair.Second >>= fY ) )
[ # # ]
1989 : : {
1990 : 0 : nBits |= 1;
1991 : 0 : fByX = (float)( fX * 100 );
1992 : 0 : fByY = (float)( fY * 100 );
1993 : : }
1994 : : }
1995 [ # # ][ # # ]: 0 : if ( xTransform->getFrom() >>= aPair )
[ # # ][ # # ]
1996 : : {
1997 [ # # ][ # # ]: 0 : if ( ( aPair.First >>= fX ) && ( aPair.Second >>= fY ) )
[ # # ]
1998 : : {
1999 : 0 : nBits |= 2;
2000 : 0 : fFromX = (float)( fX * 100 );
2001 : 0 : fFromY = (float)( fY * 100 );
2002 : : }
2003 : : }
2004 [ # # ][ # # ]: 0 : if( xTransform->getTo() >>= aPair )
[ # # ][ # # ]
2005 : : {
2006 [ # # ][ # # ]: 0 : if ( ( aPair.First >>= fX ) && ( aPair.Second >>= fY ) )
[ # # ]
2007 : : {
2008 : 0 : nBits |= 4;
2009 : 0 : fToX = (float)( fX * 100 );
2010 : 0 : fToY = (float)( fY * 100 );
2011 : : }
2012 : : }
2013 : :
2014 : : // TODO: ZoomContents:
2015 : : //if( nBits & 8 )
2016 : : //( fprintf( mpFile, " zoomContents=\"%s\"", nZoomContents ? "true" : "false" );
2017 : :
2018 [ # # ][ # # ]: 0 : rStrm << nBits << fByX << fByY << fFromX << fFromY << fToX << fToY << nZoomContents;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2019 : : }
2020 [ # # ][ # # ]: 0 : exportAnimateTarget( rStrm, xNode );
2021 : : }
2022 [ # # ][ # # ]: 0 : else if ( xTransform->getTransformType() == AnimationTransformType::ROTATE )
[ # # ]
2023 : : {
2024 [ # # ]: 0 : EscherExContainer aAnimateRotation( rStrm, DFF_msofbtAnimateRotation );
2025 : : {
2026 [ # # ]: 0 : EscherExAtom aAnimateRotationData( rStrm, DFF_msofbtAnimateRotationData );
2027 : 0 : sal_uInt32 nBits = 0;
2028 : 0 : sal_uInt32 nU1 = 0;
2029 : 0 : float fBy = 360.0;
2030 : 0 : float fFrom = 0.0;
2031 : 0 : float fTo = 360.0;
2032 : :
2033 : 0 : double fVal = 0.0;
2034 [ # # ][ # # ]: 0 : if ( xTransform->getBy() >>= fVal )
[ # # ]
2035 : : {
2036 : 0 : nBits |= 1;
2037 : 0 : fBy = (float)fVal;
2038 : : }
2039 [ # # ][ # # ]: 0 : if ( xTransform->getFrom() >>= fVal )
[ # # ]
2040 : : {
2041 : 0 : nBits |= 2;
2042 : 0 : fFrom = (float)fVal;
2043 : : }
2044 [ # # ][ # # ]: 0 : if ( xTransform->getTo() >>= fVal )
[ # # ]
2045 : : {
2046 : 0 : nBits |= 4;
2047 : 0 : fTo = (float)fVal;
2048 : : }
2049 [ # # ][ # # ]: 0 : rStrm << nBits << fBy << fFrom << fTo << nU1;
[ # # ][ # # ]
[ # # ][ # # ]
2050 : : }
2051 [ # # ][ # # ]: 0 : exportAnimateTarget( rStrm, xNode, 1 );
2052 : : }
2053 : 0 : }
2054 : 0 : }
2055 : :
2056 : 0 : sal_Bool AnimationExporter::getColorAny( const Any& rAny, const sal_Int16 nColorSpace, sal_Int32& rMode, sal_Int32& rA, sal_Int32& rB, sal_Int32& rC ) const
2057 : : {
2058 : 0 : sal_Bool bIsColor = sal_True;
2059 : :
2060 : 0 : rMode = 0;
2061 [ # # ]: 0 : if ( nColorSpace == AnimationColorSpace::HSL )
2062 : 0 : rMode = 1;
2063 : :
2064 : 0 : sal_Int32 nColor = 0;
2065 [ # # ]: 0 : Sequence< double > aHSL( 3 );
2066 [ # # ]: 0 : if ( rAny >>= nColor ) // RGB color
2067 : : {
2068 : 0 : rA = (sal_uInt8)( nColor >> 24 );
2069 : 0 : rB = (sal_uInt8)( nColor >> 8 );
2070 : 0 : rC = (sal_uInt8)( nColor );
2071 : : }
2072 [ # # ][ # # ]: 0 : else if ( rAny >>= aHSL ) // HSL
2073 : : {
2074 [ # # ]: 0 : rA = (sal_Int32) ( aHSL[ 0 ] * 255.0 / 360.0 );
2075 [ # # ]: 0 : rB = (sal_Int32) ( aHSL[ 1 ] * 255.0 );
2076 [ # # ]: 0 : rC = (sal_Int32) ( aHSL[ 2 ] * 255.0 );
2077 : : }
2078 : : else
2079 : 0 : bIsColor = sal_False;
2080 [ # # ]: 0 : return bIsColor;
2081 : : }
2082 : :
2083 : 0 : void AnimationExporter::exportAnimateColor( SvStream& rStrm, const Reference< XAnimationNode >& xNode, int nAfterEffectType )
2084 : : {
2085 [ # # ]: 0 : Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
2086 [ # # ]: 0 : if ( xColor.is() )
2087 : : {
2088 [ # # ]: 0 : EscherExContainer aAnimateColor( rStrm, DFF_msofbtAnimateColor );
2089 : : {
2090 [ # # ]: 0 : EscherExAtom aAnimateColorData( rStrm, DFF_msofbtAnimateColorData );
2091 : 0 : sal_uInt32 nBits = 8;
2092 : :
2093 : : sal_Int32 nByMode, nByA, nByB, nByC;
2094 : 0 : nByMode = nByA = nByB = nByC = 0;
2095 : :
2096 : : sal_Int32 nFromMode, nFromA, nFromB, nFromC;
2097 : 0 : nFromMode = nFromA = nFromB = nFromC = 0;
2098 : :
2099 : : sal_Int32 nToMode, nToA, nToB, nToC;
2100 : 0 : nToMode = nToA = nToB = nToC = 0;
2101 : :
2102 [ # # ][ # # ]: 0 : sal_Int16 nColorSpace = xColor->getColorInterpolation();
2103 : :
2104 [ # # ][ # # ]: 0 : Any aAny( xColor->getBy() );
2105 [ # # ]: 0 : if ( aAny.hasValue() )
2106 : : {
2107 [ # # ][ # # ]: 0 : if ( getColorAny( aAny, nColorSpace, nByMode, nByA, nByB, nByC ) )
2108 : 0 : nBits |= 0x11;
2109 : : }
2110 [ # # ][ # # ]: 0 : aAny = xColor->getFrom();
2111 [ # # ]: 0 : if ( aAny.hasValue() )
2112 : : {
2113 [ # # ][ # # ]: 0 : if ( getColorAny( aAny, nColorSpace, nFromMode, nFromA, nFromB, nFromC ) )
2114 : 0 : nBits |= 0x12;
2115 : : }
2116 [ # # ][ # # ]: 0 : aAny = xColor->getTo();
2117 [ # # ]: 0 : if ( aAny.hasValue() )
2118 : : {
2119 [ # # ][ # # ]: 0 : if ( getColorAny( aAny, nColorSpace, nToMode, nToA, nToB, nToC ) )
2120 : 0 : nBits |= 0x14;
2121 : : }
2122 [ # # ]: 0 : rStrm << nBits
2123 [ # # ][ # # ]: 0 : << nByMode << nByA << nByB << nByC
[ # # ][ # # ]
2124 [ # # ][ # # ]: 0 : << nFromMode << nFromA << nFromB << nFromC
[ # # ][ # # ]
2125 [ # # ][ # # ]: 0 : << nToMode << nToA << nToB << nToC;
[ # # ][ # # ]
[ # # ]
2126 : : }
2127 [ # # ][ # # ]: 0 : exportAnimateTarget( rStrm, xNode, 0, nAfterEffectType );
2128 : 0 : }
2129 : 0 : }
2130 : :
2131 : 0 : void AnimationExporter::exportIterate( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
2132 : : {
2133 [ # # ]: 0 : Reference< XIterateContainer > xIterate( xNode, UNO_QUERY );
2134 [ # # ]: 0 : if ( xIterate.is() )
2135 : : {
2136 [ # # ]: 0 : EscherExAtom aAnimIteration( rStrm, DFF_msofbtAnimIteration );
2137 : :
2138 : 0 : float fInterval = 10.0;
2139 : 0 : sal_Int32 nTextUnitEffect = 0;
2140 : 0 : sal_Int32 nU1 = 1;
2141 : 0 : sal_Int32 nU2 = 1;
2142 : 0 : sal_Int32 nU3 = 0xe;
2143 : :
2144 [ # # ][ # # ]: 0 : sal_Int16 nIterateType = xIterate->getIterateType();
2145 [ # # # ]: 0 : switch( nIterateType )
2146 : : {
2147 : 0 : case TextAnimationType::BY_WORD : nTextUnitEffect = 1; break;
2148 : 0 : case TextAnimationType::BY_LETTER : nTextUnitEffect = 2; break;
2149 : : }
2150 : :
2151 [ # # ][ # # ]: 0 : fInterval = (float)xIterate->getIterateInterval();
2152 : :
2153 : : // convert interval from absolute to percentage
2154 : 0 : double fDuration = 0.0;
2155 : :
2156 [ # # ]: 0 : Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
2157 [ # # ]: 0 : if( xEnumerationAccess.is() )
2158 : : {
2159 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
[ # # ]
2160 [ # # ]: 0 : if( xEnumeration.is() )
2161 : : {
2162 [ # # ][ # # ]: 0 : while( xEnumeration->hasMoreElements() )
[ # # ]
2163 : : {
2164 [ # # ][ # # ]: 0 : Reference< XAnimate > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
[ # # ]
2165 [ # # ]: 0 : if( xChildNode.is() )
2166 : : {
2167 : 0 : double fChildBegin = 0.0;
2168 : 0 : double fChildDuration = 0.0;
2169 [ # # ][ # # ]: 0 : xChildNode->getBegin() >>= fChildBegin;
2170 [ # # ][ # # ]: 0 : xChildNode->getDuration() >>= fChildDuration;
2171 : :
2172 : 0 : fChildDuration += fChildBegin;
2173 [ # # ]: 0 : if( fChildDuration > fDuration )
2174 : 0 : fDuration = fChildDuration;
2175 : : }
2176 : 0 : }
2177 : 0 : }
2178 : : }
2179 : :
2180 [ # # ]: 0 : if( fDuration )
2181 : 0 : fInterval = (float)(100.0 * fInterval / fDuration);
2182 : :
2183 [ # # ][ # # ]: 0 : rStrm << fInterval << nTextUnitEffect << nU1 << nU2 << nU3;
[ # # ][ # # ]
[ # # ]
2184 [ # # ][ # # ]: 0 : aTarget = xIterate->getTarget();
[ # # ]
2185 : 0 : }
2186 : 0 : }
2187 : :
2188 : : } // namespace ppt;
2189 : :
2190 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|